perf(daemon): judge host claim scan owners only when liveness decides

Merged
TH
3d ago
+340-46

Summary

Follow-up to #5210. The macOS and web host claim scan classified every listed claim, then never read that classification, so reopening a held claim still ran ps. The scan now only decodes. Owners are judged only for host-scoped claims this daemon did not abandon; the preview judges them in one snapshot.

No ownership decision changed:

  • Locked settlement still re-reads each claim and snapshots under that claim's lock. A pre-lock batch was rejected because settlement unlinks claims. Several foreign claims therefore cost one snapshot each, one fewer than before.
  • Unreadable and abandoned-own claims were already decided from the record.
  • Conflicts, classifications, reasons, and hints come from the judged entry, including retained settlements.
  • The lock-free preview drops its second file read. It skips decoded claims outside their canonical path, which acquisition never reads; a misnamed copy no longer repeats its canonical claim.

Before / after

Only snapshot count and latency differ. Measured at 3b3282feea.

real ps, temporary claim store, 40 calls per round, 2 alternating rounds, busy host
scenario                        snapshots  median ms per round, base -> head
open reopen, held host claim    1 -> 0     9.9, 9.5  -> 1.3, 1.4
uncovered install               1 -> 0     3.9, 3.4  -> 1.2, 1.4
preview, own abandoned claim    2 -> 0     4.6, 4.1  -> 0.10, 0.11
open refusal, live app claim    2 -> 1     6.5, 10.8 -> 4.3, 5.0
preview, live app claim         2 -> 1     4.2, 7.4  -> 2.2, 2.5
open refusal, dead app claim    2 -> 1     5.4, 5.3  -> 3.6, 4.0
preview, dead app claim         2 -> 1     3.0, 3.3  -> 1.7, 1.8

Validation

Tested f5779c9490.

  • device-claims-host-scan.test.ts and device-claims-app.test.ts: 44 passed.
  • The 6 new misnamed-file tests failed against 3b3282feea source.
  • At 3b3282feea, base a0c616cd95: 14 of 14 new tests failed on base. Mutations: returning the unjudged record failed 2; judging abandoned claims failed 6.
  • Gates and typecheck: CI, pending.
  • Self-review only. No live device run; native execution is unchanged.

🤖 Generated with Claude Code


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.