perf(daemon): classify a device claim owner only for refusals and settlement

Merged
TH
3d ago
+171-40

Summary

Claim admission took a process-identity snapshot (ps on POSIX, a CIM query on Windows) before knowing whether the claim record alone answered. Covered claims, current-owner held claims, and this daemon's abandoned claims are now decided from the decoded record. The same entry is classified only for a conflict or a foreign settlement.

Not changed: the claim scan of a macOS or web host still takes its list snapshot.

Security (ownership boundary): no ownership decision changed. The record-only checks never read the classification, keep their order and inputs, and still run under the same claim locks. A claim reaching a refusal or foreign settlement is classified before that decision, so reboot proof, reconciliation permission and public reasons see the same value. Host-scoped, stale-release and startup-sweep paths are untouched.

Value

Owner classifications per call, base โ†’ head:

  • covered or held claim: 1 โ†’ 0
  • transient refusal or preview over a foreign or other-session owner: 2 โ†’ 1
  • open refusal: 1 โ†’ 1

Validation

Tested a25a0d7f5: device-claim-settlement.test.ts, 33/33. Against base sources, 6 new cases fail on counts (10 instead of 0; 2 instead of 1).

A scratch comparison of preview and acquire, for install and open, over live, superseded, dead, reused-PID, other-session, in-flight and undecodable claims gave identical status and classification at base and head.

Other tests, typecheck and gates are left to CI. No independent review; the author re-read the diff.

๐Ÿค– Generated with Claude Code


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