Ignore stale Muninn Move identities in live roster
This commit is contained in:
parent
8042885c6d
commit
d9005e340b
3 changed files with 45 additions and 6 deletions
|
|
@ -1718,19 +1718,38 @@ static int RunMuninnMoveIdentitySmoke()
|
|||
State: "bluetooth-unreachable",
|
||||
Detail: "Muninn sees this trusted PS Move in BlueZ and will attempt bounded pickup while disconnected. Last pickup attempt: Failed to connect: org.bluez.Error.Failed br-connection-create-socket",
|
||||
ObservedAt: "2026-06-17T02:24:22.0000000Z");
|
||||
var staleUsb = new MuninnMoveIdentityDocument(
|
||||
IdentityId: "starfire:move-000704a99999:move-identity",
|
||||
HostId: "starfire",
|
||||
MoveId: "move-000704a99999",
|
||||
SourcePath: @"windows-psmove:\\?\hid#vid_054c&pid_03d5&col01#old#{guid}",
|
||||
BluetoothHostAddress: "5C:93:A2:9C:A8:A8",
|
||||
State: "usb-visible",
|
||||
Detail: "Old USB observation retained in CultCache history.",
|
||||
ObservedAt: "2026-06-17T02:20:00.0000000Z");
|
||||
var freshWaitingAfterStaleUsb = new MuninnMoveIdentityDocument(
|
||||
IdentityId: "nightwing:move-000704a99999:move-identity",
|
||||
HostId: "nightwing",
|
||||
MoveId: "move-000704a99999",
|
||||
SourcePath: "bluetooth:00:07:04:A9:99:99",
|
||||
BluetoothHostAddress: "5C:93:A2:9C:A8:A8",
|
||||
State: "bluetooth-waiting",
|
||||
Detail: "Fresh Bluetooth pickup witness after stale USB observation.",
|
||||
ObservedAt: "2026-06-17T02:24:30.0000000Z");
|
||||
|
||||
var encoded = MessagePackSerializer.Serialize(identity);
|
||||
var decoded = MessagePackSerializer.Deserialize<MuninnMoveIdentityDocument>(encoded);
|
||||
var snapshot = MimirMuninnMoveEvidenceAdapter.BuildIdentitySnapshots([decoded]).Single();
|
||||
var expectedHash = MimirMuninnMoveEvidenceAdapter.Fnva64("starfire:move-000704a800d0");
|
||||
var roster = MimirMuninnMoveEvidenceAdapter.BuildIdentityRoster([decoded, nightwingWaiting, connected, pickupReady, unreachable]);
|
||||
var roster = MimirMuninnMoveEvidenceAdapter.BuildIdentityRoster([decoded, nightwingWaiting, connected, pickupReady, unreachable, staleUsb, freshWaitingAfterStaleUsb]);
|
||||
var rotating = roster.Single(entry => entry.MoveId == "move-000704a800d0");
|
||||
var pickedUp = roster.Single(entry => entry.MoveId == "move-000704a6be5f");
|
||||
var ready = roster.Single(entry => entry.MoveId == "move-000704a39772");
|
||||
var blocked = roster.Single(entry => entry.MoveId == "move-000704a12345");
|
||||
var staleReleased = roster.Single(entry => entry.MoveId == "move-000704a99999");
|
||||
|
||||
Console.WriteLine(
|
||||
$"muninn-move-identity-smoke identity={snapshot.IdentityId} move={snapshot.MoveId} source={snapshot.SourcePath} bluetoothHost={snapshot.BluetoothHostAddress} state={snapshot.State} observedNs={snapshot.ObservedAtNs} controllerHash=0x{snapshot.ControllerIdHash:X} roster={roster.Count} rotating={rotating.StateSummary}/{rotating.PickupReadiness} usbHosts={string.Join(',', rotating.UsbHostIds)} pickupHosts={string.Join(',', rotating.BluetoothPickupHostIds)} pickedUp={pickedUp.StateSummary}/{pickedUp.PickupReadiness} ready={ready.StateSummary}/{ready.PickupReadiness} blocked={blocked.StateSummary}/{blocked.PickupReadiness}");
|
||||
$"muninn-move-identity-smoke identity={snapshot.IdentityId} move={snapshot.MoveId} source={snapshot.SourcePath} bluetoothHost={snapshot.BluetoothHostAddress} state={snapshot.State} observedNs={snapshot.ObservedAtNs} controllerHash=0x{snapshot.ControllerIdHash:X} roster={roster.Count} rotating={rotating.StateSummary}/{rotating.PickupReadiness} usbHosts={string.Join(',', rotating.UsbHostIds)} pickupHosts={string.Join(',', rotating.BluetoothPickupHostIds)} pickedUp={pickedUp.StateSummary}/{pickedUp.PickupReadiness} ready={ready.StateSummary}/{ready.PickupReadiness} blocked={blocked.StateSummary}/{blocked.PickupReadiness} staleReleased={staleReleased.StateSummary}/{staleReleased.PickupReadiness}");
|
||||
|
||||
return snapshot.IdentityId == identity.IdentityId &&
|
||||
snapshot.HostId == "starfire" &&
|
||||
|
|
@ -1740,7 +1759,7 @@ static int RunMuninnMoveIdentitySmoke()
|
|||
snapshot.State == "usb-visible" &&
|
||||
snapshot.ObservedAtNs > 0 &&
|
||||
snapshot.ControllerIdHash == expectedHash &&
|
||||
roster.Count == 4 &&
|
||||
roster.Count == 5 &&
|
||||
rotating.HasUsbWitness &&
|
||||
rotating.UsbHostIds.SequenceEqual(["starfire"]) &&
|
||||
rotating.BluetoothPickupHostIds.SequenceEqual(["nightwing"]) &&
|
||||
|
|
@ -1760,7 +1779,11 @@ static int RunMuninnMoveIdentitySmoke()
|
|||
blocked.PickupReadiness == "bluetooth-unreachable" &&
|
||||
!blocked.IsBluetoothPickupReady &&
|
||||
blocked.BluetoothPickupHostIds.Length == 0 &&
|
||||
blocked.UsbBlockingHostIds.Length == 0
|
||||
blocked.UsbBlockingHostIds.Length == 0 &&
|
||||
staleReleased.StateSummary == "bluetooth-waiting" &&
|
||||
staleReleased.PickupReadiness == "pickup-ready" &&
|
||||
staleReleased.IsBluetoothPickupReady &&
|
||||
staleReleased.UsbBlockingHostIds.Length == 0
|
||||
? 0
|
||||
: 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,6 +89,8 @@ public sealed record MimirMuninnMoveEvidenceStreamFrame(
|
|||
|
||||
public static class MimirMuninnMoveEvidenceAdapter
|
||||
{
|
||||
private const ulong LiveIdentityWindowNs = 60_000_000_000UL;
|
||||
|
||||
public const string StreamMetadataSchemaId = "mimir.muninn_move_evidence_stream_frame.v1";
|
||||
|
||||
public static CultMeshStreamDescriptor CreateStreamDescriptor(
|
||||
|
|
@ -205,12 +207,19 @@ public static class MimirMuninnMoveEvidenceAdapter
|
|||
private static MimirMuninnMoveRosterEntry ToRosterEntry(
|
||||
IGrouping<string, MimirMuninnMoveIdentitySnapshot> group)
|
||||
{
|
||||
var snapshots = group
|
||||
var orderedSnapshots = group
|
||||
.OrderByDescending(identity => identity.ObservedAtNs)
|
||||
.ThenBy(identity => identity.HostId, StringComparer.Ordinal)
|
||||
.ThenBy(identity => identity.SourcePath, StringComparer.Ordinal)
|
||||
.ToArray();
|
||||
var latest = snapshots[0];
|
||||
var latest = orderedSnapshots[0];
|
||||
var snapshots = orderedSnapshots
|
||||
.Where(identity => IsLiveIdentitySnapshot(identity, latest.ObservedAtNs))
|
||||
.ToArray();
|
||||
if (snapshots.Length == 0)
|
||||
{
|
||||
snapshots = [latest];
|
||||
}
|
||||
var usbHostIds = snapshots
|
||||
.Where(IsUsbVisible)
|
||||
.Select(identity => identity.HostId)
|
||||
|
|
@ -300,6 +309,12 @@ public static class MimirMuninnMoveEvidenceAdapter
|
|||
private static bool IsUsbVisible(MimirMuninnMoveIdentitySnapshot identity) =>
|
||||
identity.State.Equals("usb-visible", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
private static bool IsLiveIdentitySnapshot(MimirMuninnMoveIdentitySnapshot identity, ulong latestObservedAtNs) =>
|
||||
identity.ObservedAtNs <= 0 ||
|
||||
latestObservedAtNs <= 0 ||
|
||||
identity.ObservedAtNs > latestObservedAtNs ||
|
||||
latestObservedAtNs - identity.ObservedAtNs <= LiveIdentityWindowNs;
|
||||
|
||||
private static bool IsBluetoothPickupState(MimirMuninnMoveIdentitySnapshot identity) =>
|
||||
identity.State.Equals("bluetooth-waiting", StringComparison.OrdinalIgnoreCase) ||
|
||||
identity.State.Equals("bluetooth-connected", StringComparison.OrdinalIgnoreCase);
|
||||
|
|
|
|||
|
|
@ -153,3 +153,4 @@
|
|||
{"ts": "2026-06-17T12:39:58+01:00", "type": "verification", "status": "ok", "note": "Muninn ca4e49b deployed on Nightwing: released local USB-visible Move IDs now clear Bluetooth pickup backoff before the centralized BlueZ connect loop. cargo test -p muninn-daemon passed 41/41; Nightwing health reports store_age=0s and four identities. Live A6/A8 still classify bluetooth-unreachable with br-connection-create-socket, so physical wake/reattach remains the blocker."}
|
||||
{"ts": "2026-06-17T13:16:04+01:00", "type": "verification", "status": "ok", "note": "Odin ef4c51a deployed to Starfire Muninn. Windows Move identity status now reads paired Bluetooth host from the sibling PS Move pairing collection when --move-host is omitted: no-flag move-identity-status reports A8 as usb-visible with bluetooth_host=5C:93:A2:9C:A8:A8, and the claim log shows controller=00:07:04:a8:00:d0 host_after=5c:93:a2:9c:a8:a8. Installed Starfire Muninn hash matches target/debug hash 6062D174FF9DF281C098B35E84E7D3488606F6EC8842D6B5F1C8B6ACBD30C7E7."}
|
||||
{"ts": "2026-06-17T13:27:55+01:00", "type": "verification", "status": "ok", "note": "Mimir live Muninn roster smoke after Odin ef4c51a and refreshed Nightwing store loaded Starfire+Nightwing identity stores 2/2, identities=6, roster=4, readinessCoherent=True. A8 now resolves as usb-owned on Starfire with bluetoothHost=5C:93:A2:9C:A8:A8 while Nightwing contributes bluetooth-unreachable for the same move id; F5 is bluetooth-connected, A3 is usb-owned on Nightwing, and A6 remains bluetooth-unreachable."}
|
||||
{"ts": "2026-06-17T14:05:52+01:00", "type": "verification", "status": "ok", "note": "After Odin b6f8119 deployed to Nightwing and Starfire, Muninn live source merge drops stale configured platform Move sources when platform discovery has live sources, so static --move-state joystick paths no longer keep unplugged Moves USB-owned. Mimir roster derivation now ignores identity snapshots older than the live identity window relative to each Move's newest observation. Focused identity smoke reports staleReleased=bluetooth-waiting/pickup-ready. Cross-host live roster smoke with refreshed Nightwing store loaded stores=2/2, identities=6, roster=4, readinessCoherent=True: F5 bluetooth-connected, A3 usb-owned on Starfire with Nightwing unreachable witness, A6 bluetooth-unreachable, A8 usb-owned on Nightwing."}
|
||||
|
|
|
|||
Loading…
Reference in a new issue