test: dedupe lease admission tests
Summary
Audit of the lease-admission tests added by #5151: each behaviour now has one owner. Test-only, 3 files, +119 โ249 (net โ130), 42 โ 40 cases.
- Daemon-client cases now send through the CLI's transport and assert
LeaseAdmissionUnsupportedError, so they own what the deleted proxy cases proved. - Proxy tests share one real daemon-and-proxy fixture.
- Successful and twice-refused resends share one table.
Daemon lease-lifecycle and lease-expiry tests are untouched.
Behaviour Action Owner
CLI: cli-lease-admission.test.ts
reused lease: marked, no heartbeat, TTL (2) kept same
no capability: heartbeat, command once kept same
refused lease: reallocate, resend succeeds merged resend table
resend refused: no third send merged resend table
undisclosed/unknown/timeout/scope/daemon
"unsupported": never resent (5) kept same
refused close: no allocation or resend kept same
heartbeat kept, per condition/command (14) kept same
Metro open replaces lease before bridge kept same
refusal precedes stdin read kept same
Proxy: cli-lease-admission-proxy.test.ts
dropped lease reallocated, real stack kept same
checked connection: no-lease command trimmed same
checked connection: reused lease health-first deleted CLIENT checked + CLI marked
no upstream, first health check deleted CLIENT no-upstream + CLI no-capability
no upstream, after instance mismatch deleted CLIENT replacement + CLI no-capability
CLIENT: index-lease-admission.test.ts
daemon/proxy capability accepted (2) kept same
refused before send (6) kept same, + error class
replacement refused before resend (2) kept same, + error class
checked connection goes health-first kept same
Daemon: request-admission.test.ts (#5151 rows)
ended other lease: LEASE_NOT_FOUND kept same
live other lease: LEASE_SESSION_MISMATCH kept same (only typed-reason assertion)
Validation
At 7985fdce04, the three changed files: 40/40 passed with loopback required (base: 42/42).
Disposable worktree at fc50f31d38, same test diff: 40 planted production bugs; base and head each catch 39. Neither catches removing the backend-match heartbeat condition (existing gap).
Gates, typecheck and the full suite are pending CI. No independent review; diff self-reviewed.
Security
No production change. Never-resend, dispatch-disclosure, owner-scope and instance-identity cases remain. For the deleted instance-mismatch case, client route assertions still forbid resending to the replacement; the CLI case pins one rerun.
๐ค Generated with Claude Code
Open in [code]smith ยท Need help on this PR? Tag @codesmith-bot with what you need.