Skip to content

test(daemon): remove daemon pins that cannot fire - #2942

Merged
thymikee merged 1 commit into
mainfrom
test/daemon-pins-that-cannot-fire
Sep 25, 2026
Merged

thymikee merged 1 commit into
mainfrom
test/daemon-pins-that-cannot-fire

Conversation

@thymikee

Copy link
Copy Markdown
Member

Summary

Five daemon assertions that no production change could contradict. −56 / +4, all test-only, in
four files under src/daemon.

Site Why it could not fire Action
session-relaunch-guards.test.ts — "…for active sessions before device refresh" byte-identical to the test above it (diff of the two bodies is empty), and its ordering claim is unobservable here: on the existing-session path the refresh is refreshSessionDeviceIfNeeded, which returns early for a non-iOS device deleted
session-relaunch-guards.test.ts — "…before resolving a new device" also byte-identical to the first binary-path test — but its name promises something real and fixable: validatePreResolvedOpenRequest (session-open.ts:262) runs before resolveTargetDeviceSelection (:269) repaired: asserts mockResolveTargetDevice was not called
response-views.test.ts:23,125,574 — "X view is registered" each is a lone typeof x === 'function', and the very next test calls that same view; the ! is erased at runtime, so an unregistered view throws there first. Exact entailment deleted (3 tests + 5 matching probe lines inside the shared-view tests)
providers-plugin-routing-parity.test.ts:129 assert.equal(getPlugin('apple'), getPlugin('apple')) — one Map.get call compared to itself; the comment above it described an ios/macos alias the collapsed PLATFORMS union no longer has deleted, comment corrected
interaction-response-construction-guard.test.ts:247 positive control run over a file-local fixture — no production file in scope. The ADR 0011 guard's real positive control (:183) scans the actual dispatcher deleted

Proof for the repair. Hoisting resolveTargetDeviceSelection above the pre-resolved guard while
leaving every message identical fails exactly one test — 1 failed | 7 passed. The message-only
siblings stay green, because reading the message is all they do. The old body of this test was among
those seven.

Two things I deliberately kept against my own finding list:

  • the findView === getView and press === click === fill === longpress identity pins — splitting a
    shared view into two instances genuinely reddens those; only the typeof lines in the same tests go
  • the exact-array facet assertions in providers-plugin-routing-parity — the membership scan above
    them cannot see a resolver listed twice, so those arrays are the only duplicate detector

Validation

Tested at 07ef1039f.

  • 4 touched files → 51 tests passed (--project unit-core)
  • mutant run, then reverted; git status clean of production changes before committing
  • pnpm check:affected --run — all runnable checks passed
  • oxlint . --deny-warnings, repo-wide oxfmt, tsc -p tsconfig.json

No production file touched, so no device lane is selected.

Four daemon tests asserted things no production change could contradict.

- `session-relaunch-guards.test.ts`: "…for active sessions before device refresh" was
  byte-identical to the test above it (`diff` empty). Its ordering claim is not
  observable through any mock in this harness — on the existing-session path the refresh
  is `refreshSessionDeviceIfNeeded`, which returns early for a non-iOS device — so the
  test only re-asserted the message. Deleted.
- `session-relaunch-guards.test.ts`: "…before resolving a new device" was byte-identical
  to the first binary-path test, but its name promises something real and fixable: the
  pre-resolved guard at `session-open.ts:262` runs before `resolveTargetDeviceSelection`
  at :269. It now asserts `mockResolveTargetDevice` was not called, which makes the name
  true. Proven: hoisting the selection above the guard while leaving the messages
  untouched fails exactly this test (`1 failed | 7 passed`) — every sibling stays green
  because they only read the message.
- `response-views.test.ts`: three `typeof x === 'function'` tests, each immediately
  followed by a test that calls that same view and asserts its digest — the `!` is erased
  at runtime, so an unregistered view throws there first. Entailment is exact. The five
  matching `typeof` lines inside the shared-view tests go too; the `findView === getView`
  and `press === click === fill === longpress` identity pins stay, since splitting a
  shared view really does redden those.
- `providers-plugin-routing-parity.test.ts`: `assert.equal(getPlugin('apple'),
  getPlugin('apple'))` compares one `Map.get` call to itself, and its comment claimed an
  ios/macos alias the collapsed `PLATFORMS` union no longer has. The exact-array
  assertions in that block are kept — they are the only thing that catches a facet
  listing a resolver twice, which the membership scan above cannot see.
- `interaction-response-construction-guard.test.ts`: a positive control run over a
  file-local fixture with no production file in scope. The ADR 0011 guard's real positive
  control scans the actual dispatcher; and the fixture case is already entailed by the
  negative controls, each of which mutates one case and asserts a one-element violation
  array, proving every other case contributes nothing.
@github-actions

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 4.81 MB 4.81 MB 0 B
Package (unpacked) 4.81 MB 4.81 MB 0 B
Package (download) 1.44 MB 1.44 MB -5 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 18.8 ms 19.3 ms +0.5 ms
CLI --help 51.2 ms 52.2 ms +1.0 ms

@thymikee

Copy link
Copy Markdown
Member Author

Reviewed at 07ef103. The removed assertions are ones that cannot fire, so dropping them is correct; the mechanism checks out, since mockResolveTargetDevice is the same mock resolveTargetDeviceSelection wraps through selectionFromResolveTargetDevice, so the new assertion genuinely observes whether device resolution ran. This is test-only (no production route touched), and all 17 checks are green on head. I did not run the full suite locally or reproduce the cited mutation run myself, and traced the test bodies and diff statically instead to confirm each removed assertion's entailment claim. No action is needed.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Sep 24, 2026
@thymikee
thymikee merged commit 21d959e into main Sep 25, 2026
17 checks passed
@thymikee
thymikee deleted the test/daemon-pins-that-cannot-fire branch September 25, 2026 05:42
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-25 05:42 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