Collapse the video parity wire builder to one frame; test stale-identity pruning without bluetoothctl

video_wire_records_with_parity keeps only its single-frame caller. The stale
move-identity prune is split out of reconcile_move_identity_records so its
test no longer shells out to the host Bluetooth binary.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-29 16:02:33 +02:00
commit 88f9ed7ccd
2 changed files with 17 additions and 25 deletions

View file

@ -1827,7 +1827,14 @@ fn reconcile_move_identity_records(
) -> Result<()> {
publish_move_identity_records(node, options, sources)?;
publish_bluetooth_move_identity_records(node, options, active)?;
prune_stale_move_identity_records(node, options, sources)
}
fn prune_stale_move_identity_records(
node: &mut cultmesh_rs::CultMeshNode,
options: &Options,
sources: &[MoveStateSource],
) -> Result<()> {
let current_ids = current_move_identity_records_from_sources(options, sources)?
.into_iter()
.map(|identity| identity.identity_id)
@ -14325,7 +14332,8 @@ Device 00:07:04:A8:00:D0 (public)
hidraw_path: "windows-psmove://current".to_string(),
}];
reconcile_move_identity_records(&mut node, &options, &current, &[]).unwrap();
publish_move_identity_records(&mut node, &options, &current).unwrap();
prune_stale_move_identity_records(&mut node, &options, &current).unwrap();
assert!(
node.get::<MuninnMoveIdentityRecord>("starfire:move-0006f523e2d1:move-identity")

View file

@ -688,31 +688,15 @@ pub fn build_video_parity_shards(
}
fn video_wire_records_with_parity(
records: &[GameCultMediaVideoAccessUnitRecord],
frame_records: &[GameCultMediaVideoAccessUnitRecord],
) -> Result<Vec<GameCultMediaWireRecord>> {
let mut wire_records = Vec::new();
let mut offset = 0_usize;
while offset < records.len() {
let first = &records[offset];
let mut end = offset + 1;
while end < records.len()
&& records[end].stream_id == first.stream_id
&& records[end].session_id == first.session_id
&& records[end].frame_id == first.frame_id
{
end += 1;
}
let frame_records = &records[offset..end];
wire_records.extend(
frame_records
.iter()
.cloned()
.map(GameCultMediaWireRecord::Video),
);
for parity in build_video_parity_shards(frame_records)? {
wire_records.push(GameCultMediaWireRecord::VideoParity(parity));
}
offset = end;
let mut wire_records: Vec<GameCultMediaWireRecord> = frame_records
.iter()
.cloned()
.map(GameCultMediaWireRecord::Video)
.collect();
for parity in build_video_parity_shards(frame_records)? {
wire_records.push(GameCultMediaWireRecord::VideoParity(parity));
}
Ok(wire_records)
}