fix: slotsfull is occupancy, not free slots, and cover it end to end

Running the e2e suite against a real soulfind showed the per-member slots
field was implemented backwards. The wire field is `slotsfull` -- a boolean
that is true when the member's upload slots are all occupied -- not a count
of free ones. `slots_free: u32` named it, documented it and printed it as
the opposite of what the server means, so a caller reading it would pick the
busiest peer to download from.

- types: `slots_full: bool`, with the wire name in the doc comment
- the DTO, the `room users` output and SKILL.md follow
- a new e2e test joins a room with a member sharing a known three files and
  asserts the counts, the roster alignment and the slot flag against
  soulfind, so the parsing is checked against a real server rather than only
  against frames this repo wrote itself
This commit is contained in:
Michel de Graaf
2026-08-28 14:39:34 +00:00
parent 60f7100e30
commit 35a6fed3c3
10 changed files with 109 additions and 25 deletions
+4 -3
View File
@@ -468,7 +468,8 @@ pub struct RoomUserStatsDto {
pub average_speed: u32,
pub shared_files: u32,
pub shared_folders: u32,
pub slots_free: u32,
/// True when the member's upload slots are all occupied.
pub slots_full: bool,
pub country: Option<String>,
}
@@ -480,7 +481,7 @@ impl From<&RoomUserStats> for RoomUserStatsDto {
average_speed: stats.average_speed,
shared_files: stats.shared_files,
shared_folders: stats.shared_folders,
slots_free: stats.slots_free,
slots_full: stats.slots_full,
country: stats.country.clone(),
}
}
@@ -494,7 +495,7 @@ impl From<RoomUserStatsDto> for RoomUserStats {
average_speed: dto.average_speed,
shared_files: dto.shared_files,
shared_folders: dto.shared_folders,
slots_free: dto.slots_free,
slots_full: dto.slots_full,
country: dto.country,
}
}
+2 -2
View File
@@ -614,7 +614,7 @@ mod tests {
.expect("member stats");
assert_eq!(stats["members"][0]["username"], "alice");
assert_eq!(stats["members"][0]["status"], "online");
assert_eq!(stats["members"][0]["slots_free"], 1);
assert_eq!(stats["members"][0]["slots_full"], true);
assert_eq!(stats["members"][0]["country"], "NL");
}
@@ -819,7 +819,7 @@ mod tests {
average_speed: 1024,
shared_files: 20,
shared_folders: 3,
slots_free: 1,
slots_full: true,
country: Some("NL".to_string()),
}]
}