Skip to content

refactor(daemon): relocate the settle, disclosure and capture tests by what they assert - #3698

Merged
thymikee merged 10 commits into
refactor/daemon-find-testsfrom
refactor/daemon-settle-tests
Oct 16, 2026
Merged

thymikee merged 10 commits into
refactor/daemon-find-testsfrom
refactor/daemon-settle-tests

Conversation

@thymikee

@thymikee thymikee commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Part 2 of 3 of the find/settle batch of the daemon test redesign (no test exports of any kind). Stacked on #3693 (green and mergeable; this PR retargets to main when it merges). The five root tests under src/__tests__/daemon-composition/interaction/ for capture disclosure, the fill-scrubbing common cases, dispatch disclosure and settle wiring are placed by what they assert. Daemon halves (a) run against the package fakes; assertions about what the real src/commands/interaction/** code does (c) moved beside that code. Part 3 (target evidence) follows.

New package fixture, a new unexported file: support/touch-forwarding-surface-fake.ts (a touch surface that also observes a settle and carries the capture preference). Edits to existing fixtures: command-surface-override-fake.ts (additive: settle observation and capture preference pass-through, from #3693).

a / c split and test-count parity

Before = exact count at the old path (vitest JSON reporter, origin/main); after = run count per destination on this head. Package paths are under packages/daemon/src/execution/interaction/internal/; command paths under src/commands/interaction/runtime/.

Source (before) Daemon half (a) Command half (c)
interaction-capture-disclosure (4) interaction-capture-disclosure.test.ts (4) selector-target-resolution-post-gesture.test.ts (1: the full-tree retry inherits the unsettled post-gesture outcome)
interaction-common (5) interaction-common.test.ts (5; parameterized fill scrubbing runs on the touch finalizer) none
interaction-dispatch-disclosure (16) interaction-dispatch-disclosure.test.ts (15: driver check, 10 daemon rows, 4 verdict cases), interaction-android-escape-dispatch-disclosure.test.ts (2: driver check, post-action-guard row) none (17 in total: the second driver file needs its own driver check)
interaction-settle (10) interaction-settle.test.ts (10) settle-capture-deadline.test.ts (2: stalled capture gets its deadline signal and a "stalled" hint; fill on a @ref with --settle); settle diff, removals-only tail and broken-capture hint were already pinned in settle.test.ts
interaction-settle-private-ax-route (1) interaction-settle-private-ax-route.test.ts (1; installs the fake InteractorResolution) the pinning rule and runner request construction are pinned by settle.test.ts and packages/platform-apple

36 tests before; 41 after (the +5: one command test, the second driver check, two settle command tests, and the ref-frame authority case in interaction-common.test.ts). No assertion was dropped.

Gap, stated rather than hidden. The private-ax route no longer exercises the composed path from daemon to runner request; its rule is pinned in settle.test.ts and in platform-apple. If that must remain a root (b) test it needs a full startDaemonRuntime session flow, which this PR does not build.

Mutation checks

  • Replacing issueSettleRefs(...) in interaction-touch-response.ts with undefined fails three settle tests: "press --settle responds with the settled diff, refsGeneration, and activates a partial ref frame", "held touch settle publishes refs into the current record of its scoped lifetime" and "press --settle on a removals-only diff attaches the unchanged interactive tail at the diff generation" (expected 'expired' to be 'active'). Reverted.
  • The agent that wrote the batch also broke the isSessionRecording gate and preferredBackend forwarding and saw the suites fail.

vi.mock

No vi.mock in any destination file (rg 'vi\.mock\(' over the destinations returns nothing). The snapshot-interactor-capture mock these tests used is replaced by the installed InteractorResolution.

Selection

All destinations match packages/*/src/**/*.test.ts or src/**/*.test.ts, so unit-core selects them (pnpm test:unit, test:coverage); the sources were already in unit-core. check:affected --run runs the vitest related leg.

Subpath exports

Package Before After
daemon 81 79

Deleted: interaction/internal/interaction-android-escape, interaction/internal/types. No other package changed; no new subpath, barrel or export *.

Notes

  • Registry repoints for moved tests: DISPATCH_DISCLOSURE_DRIVER_OWNERS ('daemon.' and 'post-action-guard.' lines) in packages/contracts/src/dispatch-disclosure.fixtures.ts, and one path in .device-evidence/CHECKLIST.md.
  • The command halves are new files, not appends to another worker's tests, and are named for modules beside them (R84).

Validation

check:quick, check:layering, check:fallow and check:gate-manifest pass on this head. check:affected --run ran 15,437 tests and failed three, all 5-second timeouts under heavy host contention (the run took 649 s): two in scripts/fuzz/harness.test.ts and one in scripts/__tests__/test-file-size-ratchet.test.ts, neither touching this change. Rerun alone, harness.test.ts passes (2/2) and the ratchet passes (3/3).

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 5.29 MB 5.29 MB 0 B
Package (unpacked) 5.29 MB 5.29 MB 0 B
Package (download) 1.59 MB 1.59 MB +8 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.7 ms 28.5 ms +0.8 ms
CLI --help 79.2 ms 77.9 ms -1.3 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.

All reported issues were addressed across 14 files

Reply with feedback, questions, or to request a fix.

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

Comment thread src/commands/interaction/runtime/selector-target-resolution-post-gesture.test.ts Outdated
Comment thread packages/daemon/src/__tests__/support/touch-forwarding-surface-fake.ts Outdated
@thymikee

Copy link
Copy Markdown
Member Author

The test moves at 656bd27 look correct, and all 15 checks pass. I did not run the suite myself, so the 36/41 test-count parity and the mutation checks come from the PR body and CI, and I derived the ref-frame authority case by reading the fixture rects, not by running it. No conflicts. Nothing blocks merge from the code side.

Not blocking, and you can take or leave each: the package now has two touch command-surface fakes, so could you fold the new one into touch-command-surface-fake.ts (an observeSettle option, a preferredBackend pass-through, session write-back on capture) or state in both headers which suites use which; interaction-settle-private-ax-route.test.ts re-declares the pin rule in its own observer, so renaming it to the forwarding invariant it pins (the daemon carries preferredBackend to the resolved interactor) would match what it proves; the stalled-capture test in interaction-settle.test.ts hand-writes the deadline and hint it then asserts, which settle-capture-deadline.test.ts already owns; and the doc comment in interaction-capture-disclosure.test.ts says the miss is retried on a full tree, but that retry is only asserted in selector-target-resolution-post-gesture.test.ts.

Could one fake do the job? If touchCreateCommandSurface took the settle observer and preferredBackend as options and wrote the captured snapshot to the session, touch-forwarding-surface-fake.ts (228 lines) could go. First you would need to choose one selector grammar (label/id regex vs || key=value terms) and one capture rule, and check that the other 18 users of the older fake tolerate the write-back.

I did not check whether the platform-apple tests still cover the preferredBackend-to-runner request path that the removed root private-ax test used to exercise, so please confirm that route is covered somewhere. I also did not check whether the old handlers/interaction-android-escape path at scripts/layering/architecture-ownership.ts:61 predates this PR.

The three Cubic P2 threads look fixed at this head, so please resolve them: the Android escape-dispatch assertions (#3698 (comment)), the post-gesture selector-miss assertions (#3698 (comment)), and the ref-frame-first lookup now pinned by the fill handler test in interaction-common.test.ts (#3698 (comment)).

@thymikee
thymikee added this pull request to stack #3703 October 16, 2026 05:50
@thymikee

Copy link
Copy Markdown
Member Author

Answers to the open questions, with no code change:

  • preferredBackend to the runner request: still covered in platform-apple. interactor-runner-provider.test.ts ("snapshot forwards either forceable preferredBackend into the emitted runner command") asserts it lands in the emitted RunnerCommand for tree and leaves it undefined otherwise. snapshot-route.test.ts ("a pinned backend") covers route selection and index-runner-requests.test.ts covers the request shape. The daemon side is pinned by interaction-settle-private-ax-route.test.ts.
  • scripts/layering/architecture-ownership.ts:61: the handlers/interaction-android-escape.ts entry is in INTERACTION_RETIRED_HANDLER_PATHS, a list of paths that must not exist. It predates this PR (added in refactor(daemon): move interaction and find routes behind facade #2228) and this PR does not touch it.
  • Cubic threads: all three are already resolved.

The non-blocking suggestions (folding the two touch fakes into one, renaming the private-ax test, the disclosure doc comment) are declined here. The fake merge needs a single selector grammar and a write-back check across the other 18 users of the older fake, which is its own change. I'd rather not churn the stack's heads, and with them CI, for those.

@thymikee

Copy link
Copy Markdown
Member Author

Taking the suggestion to fold touch-forwarding-surface-fake.ts into touch-command-surface-fake.ts: it lands as a follow-up PR right after this stack merges, so the stack is not delayed. It will show per-caller test-count parity and change no assertions.

@thymikee

Copy link
Copy Markdown
Member Author

Thanks, that settles it at 656bd27. I found the preferredBackend forwarding test in packages/platform-apple/src/__tests__/interactor-runner-provider.test.ts, and the interaction-android-escape entry is in the retired-paths list, so neither is a gap. Folding the second touch fake in a follow-up right after the stack is fine with me. Nothing blocks this from the code side.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 16, 2026
thymikee and others added 10 commits October 16, 2026 09:53
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndler (a); the full-tree retry outcome inheritance is a command test (c)

interaction-capture-disclosure: all four cases are daemon disclosure decisions (a) over a
touch-forwarding surface and the legacy capture interactor resolution; the unsettled-outcome
inheritance by the full-tree retry, which the miss case relied on the real command for, is now
pinned directly by selector-target-resolution-post-gesture (c).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h finalizer (a)

interaction-common: all five cases are daemon response-boundary and recorder decisions (a); the two
handler-route cases run on the touch-forwarding surface, which now answers with the selector chain
the command family builds for the resolved node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…teraction handler (a); the guard row moves beside its guard (a)

interaction-dispatch-disclosure: the ten daemon rows and the four daemon verdict cases (a) drive
the interaction handler over a touch-forwarding surface with get and gesture members, installing
the interactor resolution instead of mocking the capture module. The post-action-guard row is
driven by its own file beside interaction-android-escape; the contracts driver-owner map names both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…arry the capture preference

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (a); stalled-capture deadline and fill settle land as command tests (c)

interaction-settle: all ten cases are daemon decisions (request signal inheritance, settle flag to
parameter mapping, refsGeneration and the partial ref frame, the settled tree stored under the
scoped lifetime, expired-frame refusal, flag guards) run over a settling touch-forwarding surface.
The diff, tail, unavailable-observation hint, and deadline behaviors those cases leaned on are
command behavior: settle.test.ts already pins the diff, tail, and broken-capture cases, and
settle-capture-deadline adds the stalled-capture signal and fill --settle (c).

interaction-settle-private-ax-route: (a) daemon forwarding of the settle loop's private-ax preference
to the interactor snapshot options, over the installed interactor resolution; the pin decision and
the runner request construction are covered by settle.test.ts and the platform-apple suites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e-disclosure test and format

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e batch left without importers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…re cases, and resolve refs against the ref frame in the touch-forwarding fake

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…andler test and drop the standalone fake test (R84)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee thymikee removed the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 16, 2026
@thymikee

Copy link
Copy Markdown
Member Author

The code verdict on 656bd27 is unchanged: no findings. The branch now conflicts with main, so I removed ready-for-human for now. Please rebase on main; if the rebase only moves tests, the label can come back without a new review.

@thymikee
thymikee force-pushed the refactor/daemon-settle-tests branch from 656bd27 to 9c7f710 Compare October 16, 2026 08:47
@thymikee
thymikee merged commit 87215fb into main Oct 16, 2026
22 of 34 checks passed
@thymikee
thymikee deleted the refactor/daemon-settle-tests branch October 16, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant