Skip to content

refactor(daemon): relocate the target-evidence tests by what they assert - #3700

Merged
thymikee merged 3 commits into
refactor/daemon-settle-testsfrom
refactor/daemon-target-evidence-tests
Oct 16, 2026
Merged

thymikee merged 3 commits into
refactor/daemon-settle-testsfrom
refactor/daemon-target-evidence-tests

Conversation

@thymikee

@thymikee thymikee commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Part 3 of 3 of the find/settle batch of the daemon test redesign (no test exports of any kind): the root interaction-target-evidence test (10 tests, 461 lines) that drove press, get and is with the real command surface. Stacked on #3698 (green and mergeable), which is stacked on #3693 (green and mergeable); this PR retargets as those merge.

Daemon halves (a) run against the package fakes; what the real command code puts into a resolution (c) moved beside that code. New unexported fixture: support/target-evidence-fixture.ts.

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.

Source (before) Daemon half (a) Command half (c)
interaction-target-evidence (10) execution/interaction/internal/interaction-target-evidence.test.ts (3: press @ref with and without recording; press on an identity-empty container), execution/selector-runtime-target-evidence.test.ts (7: get and is reads while recording, without recording, and the deferred-coverage cases) src/commands/interaction/runtime/selector-read-resolution-payload.test.ts (4: which reads carry node and preActionNodes; is exists and is absent carry neither)

10 tests before; 14 after (+4: the command-side payload cases the real surface used to cover implicitly). No assertion was dropped. One was replaced: "the runner querySelector command is not called" had become vacuous after the R36/R37 refactors, because the daemon no longer calls it for get and is. It now asserts mockQuerySelector not called with querySelectorAvailable switched on in the fixture. That spy is a fixture spy (not a vi.mock) behind a negative assertion: it can only fail if the daemon starts calling the runner for these reads again, which is what it guards; it cannot be broken without adding such a call.

Mutation checks

  • Removing targetEvidence from the recorded action in interaction-common.ts fails the two press cases (2/10): "press @ref while recording attaches target-v1 evidence…" and "press on an identity-empty container…".
  • Dropping the isSessionRecording() gate (computing evidence without recording) fails "press @ref without recording never computes target-v1 evidence" (1/10).

vi.mock

No vi.mock in any destination file.

Selection

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

Subpath exports

Package Before After
daemon 79 78

Deleted: session-script-writer. No other package changed; no new subpath, barrel or export *. With this part the find/settle batch removes 3 of the daemon's ./testing/* entries net across the three PRs (81 → 78).

Notes

  • Colocation (R84): selector-read-resolution-payload.test.ts is named for selector-read.ts; the daemon halves sit beside interaction-common.ts and the selector runtime.
  • The command half is a new file, not an append to another worker's test.

Validation

check:quick, check:layering and check:fallow pass on this head. check:affected --run passed format, lint, typecheck, layering, di-seams, fallow, mcp-metadata, build and package, then stopped at integration-node (it stops at the first failure, so its unit lane did not run locally; CI runs it). The integration-node failures are test/integration/smoke-daemon-clean.test.ts "clean daemon script stops a live daemon before removing metadata" (20 s, exit 1) and test/integration/smoke-web-platform.test.ts "web shutdown cleanup reaps the exact daemon that survived graceful shutdown". Both pass when run alone on this head (3/3 and 1/1), and this branch changes no file under test/integration or scripts. They fail only inside the full node-integration run on a host that other sessions are loading; CI is the authority.

Break-proof (mockQuerySelector not-called): adding a querySelector call in interaction-runtime.ts (the only daemon spot that holds the operation outside touch/gesture) left selector-runtime-target-evidence.test.ts at 7/7 passing, so the assertion was vacuous: ADR 0011 (2026-09-11) retired querySelector as the backing for get/is/wait, and no get/is route is handed a touch executor. Both negative-only assertions and the stale querySelectorAvailable switches are removed in the last commit; the positive assertions (snapshot dispatched, evidence recorded) stay. Reverted; 7 tests before and after.

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

@github-actions

github-actions Bot commented Oct 16, 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 +19 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 27.0 ms 27.4 ms +0.4 ms
CLI --help 76.6 ms 76.8 ms +0.2 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 6 files

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

@thymikee

Copy link
Copy Markdown
Member Author

The PR is ready at 29ba824. The change only moves tests and drops one unused package.json subpath, and I found no code problems. The only check not yet green is one Smoke Tests job, still pending, and this diff does not touch what those jobs exercise. There are no conflicts. Once that job passes, this can merge. I did not run the tests or the mutation checks, so the "fails 2/10" and "fails 1/10" claims are unverified on my side. One more limit: no single test now runs the real command surface into the daemon's evidence recording, so the fake-to-real payload match rests on types and the assertions in the c half. Not blocking, take or leave: selector-runtime-target-evidence.test.ts:57 re-implements the label/id lookup that defaultMatchSelector already has in touch-forwarding-surface-fake.ts:60, so exporting that matcher would let this test reuse it, and the fake get result at line 88 is cast as DaemonGetResult where building the exact shape would avoid the cast, with the SAVE_BUTTON_NODES as RawSnapshotNode[] cast also redundant because the fixture is already typed.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Oct 16, 2026
@thymikee
thymikee added this pull request to stack #3703 October 16, 2026 05:50
@thymikee

Copy link
Copy Markdown
Member Author

Taking the notes as non-blocking and leaving them: the label/id matcher and the as DaemonGetResult / SAVE_BUTTON_NODES casts in this test mirror the fixtures they sit beside, and tidying them would change the fake shared with #3698. The Smoke Tests job has since passed; all 15 checks are green at 2d57dd0. The mockQuerySelector assertion the review flagged as spy-only was proven vacuous and removed (see the PR body break-proof line).

@thymikee

Copy link
Copy Markdown
Member Author

The test-only delta since 29ba824 looks good, and I found no code problems at 2d57dd0. CI is green. There are no conflicts, and nothing else stands between this PR and merge. I did not run the test suite or mutate the removed assertion, and I did not re-trace open threads from earlier heads.

thymikee and others added 3 commits October 16, 2026 09:55
…nalizer (a) and the get/is recorder (a); resolution payload cases land beside the selector reads (c)

interaction-target-evidence: press (2) and the identity-empty container retarget (1) run beside the
interaction handler over the touch-forwarding surface; get (3) and is (4) run beside the selector
runtime over a selector-read surface member. The live-selector-read gate assertion now reads the
bound querySelector spy instead of a runner mock. Which reads carry the resolution payload is pinned
as four new (c) tests in selector-resolution-payload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e the test-kit entry, drop the testing subpath left without importers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t/is path can break (ADR 0011 2026-09-11)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@thymikee
thymikee force-pushed the refactor/daemon-target-evidence-tests branch from 2d57dd0 to 2c6f9e9 Compare October 16, 2026 08:47
@thymikee
thymikee merged commit 6e0844f into main Oct 16, 2026
22 of 34 checks passed
@thymikee
thymikee deleted the refactor/daemon-target-evidence-tests branch October 16, 2026 08:58
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-16 08:59 UTC

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