Skip to content

test: dedupe lease admission tests - #5165

Merged
thymikee merged 3 commits into
mainfrom
test/lease-admission-audit
Nov 28, 2026
Merged

thymikee merged 3 commits into
mainfrom
test/lease-admission-audit

Conversation

@thymikee

@thymikee thymikee commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

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 7985fdc, the three changed files: 40/40 passed with loopback required (base: 42/42).

Disposable worktree at fc50f31, 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.

View guided diff Turn on auto-fix

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.68 MB 6.68 MB 0 B
Package (unpacked) 6.68 MB 6.68 MB 0 B
Package (download) 2.04 MB 2.04 MB -9 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 22.7 ms 22.7 ms -0.0 ms
CLI --help 50.5 ms 47.9 ms -2.6 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

View guided diff | Turn on auto-fix | Re-trigger cubic

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

This comment has been minimized.

@thymikee

Copy link
Copy Markdown
Member Author

The PR is ready at 8ca1819, and the change touches tests only.

Coverage, Integration Tests, Lint/Typecheck and Repo Guards pass, none of the 20 checks is failing, and only Proof is skipped.

Not verified here: tests and mutants were not run, so coverage equivalence rests on reading the code, the reported 40/40 run and 40-mutant experiment were not reproduced, and CI job logs were not read to confirm that the loopback-dependent proxy cases ran instead of being skipped.

Not blocking, take it or leave it: sendAdmissionChecked builds its transport without a host and so wraps sendToDaemon, while the CLI builds a host-bound one, and the removed no-upstream proxy cases were what drove that host-bound path to a capability refusal, so to match the header comment the helper could use the CLI’s route, for example createEnsuredDaemonTransport({ host: createTestHostEnvironment() }) with the helper from @agent-device/test-kit.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 28, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 35eae2c

Since the review of 8ca1819: 0 new · 0 still open · 0 no longer raised

No open findings.

Reviewed with this repository's own Sentinel configuration (fc50f31d3870).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee
thymikee merged commit 2c5995f into main Nov 28, 2026
21 checks passed
@thymikee
thymikee deleted the test/lease-admission-audit branch November 28, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant