Skip to content

test(daemon): extract shared fixtures from the snapshot handler suite - #2254

Merged
thymikee merged 1 commit into
mainfrom
claude/test-fixtures-session-handlers
Sep 3, 2026
Merged

test(daemon): extract shared fixtures from the snapshot handler suite#2254
thymikee merged 1 commit into
mainfrom
claude/test-fixtures-session-handlers

Conversation

@thymikee

@thymikee thymikee commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

snapshot-handler.test.ts repeated its setup inline: the device literals, the token-fixed daemon request, the bind-counting runtime, the Android capture reply, the text rows, the freshness-window session, and the location-required / Battery surfaces. Those move to snapshot-handler.fixtures.ts (the existing snapshot-handler-fixture.ts, renamed to the *.fixtures.ts convention) as named exports. Every scenario keeps its title, its inputs, and its own expect lines.

  • Test count 41 -> 41; expect( calls 162 -> 162.
  • jscpd (--min-tokens 80 --min-lines 8): 536 -> 58 duplicated lines; the two remaining clones are assertion blocks.
  • File length 2,120 -> 1,656 lines (history-backed size ratchet passes; no pin to lower).

Scope: the 1,000-line gross-diff budget fits only the largest file (this diff is 981 lines). react-native.test.ts (909 duplicated lines) and session-relaunch-close.test.ts (511) are left for follow-up PRs.

Validation

  • npx vitest run --project unit-core src/daemon/handlers/__tests__/snapshot-handler.test.ts --reporter=json: 41/41 before and after.
  • pnpm check:quick, scripts/layering/check.ts, pnpm check:fallow, test-file-size-ratchet and fallow-fixture-policy gate tests: green.
  • Planted red 1 (production revert): selector-wait.ts:273 includeHiddenContentHints: false -> true; wait selector polling skips hidden-content hint derivation on every poll (#1270) fails: AssertionError: expected true to be false. Restored.
  • Planted red 2 (fixture corruption): makeAndroidFreshnessSession routeComparable: true -> false; snapshot warns when Android freshness retries still return the previous route fails: AssertionError: expected undefined to deeply equal [ StringContaining{…} ]. Restored.

Full affected gate: pending (serialized gate stage will append the result)

Tradeoffs / follow-ups

  • No enforcement artifact changed, so there is no chore(gates) commit.

The snapshot handler suite repeated its setup inline: the device
literals, the token-fixed daemon request, the bind-counting runtime,
the Android capture reply, the flat text rows, the freshness-window
session with its baseline signatures, and the location-required and
Battery surfaces. Those move to the sibling fixtures module (renamed
from snapshot-handler-fixture.ts to the *.fixtures.ts convention) as
named exports; every scenario keeps its title, its inputs, and its own
assertions.

jscpd (--min-tokens 80 --min-lines 8): 536 -> 58 duplicated lines in
snapshot-handler.test.ts (the two remaining clones are assertion
blocks). Test count 41 -> 41, expect( calls 162 -> 162.
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 2.58 MB 2.58 MB 0 B
JS gzip 868.4 kB 868.4 kB 0 B
npm bundled raw 2.58 MB 2.58 MB 0 B
npm bundled gzip 868.4 kB 868.4 kB 0 B
npm tarball 1.02 MB 1.02 MB +7 B
npm unpacked 3.46 MB 3.46 MB 0 B
npm clean-installed 3.46 MB 3.46 MB 0 B

npm unpacked components

Component Base Current Diff
JS / dist source 2.74 MB 2.74 MB 0 B
Apple runner source/project 544.4 kB 544.4 kB 0 B
Apple snapshot presentation source 33.8 kB 33.8 kB 0 B
macOS helper source 54.8 kB 54.8 kB 0 B
Android helper artifacts 43.3 kB 43.3 kB 0 B
Other package files 46.3 kB 46.3 kB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 24.1 ms 23.6 ms -0.6 ms
CLI --help 63.4 ms 59.8 ms -3.5 ms

Top changed chunks: no changes in the largest emitted chunks.

Top changed packed files

No changed packed files.

@thymikee thymikee changed the title test(daemon): extract shared fixtures from the react-native, relaunch-close, and snapshot handler suites test(daemon): extract shared fixtures from the snapshot handler suite Sep 2, 2026
@thymikee

thymikee commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

READY at 9ef08191fd55987aaba04280aa28e2a2bdd74fef.

Test-only fixture extraction preserves the 41 snapshot-handler scenarios and their assertion ownership; production routing is unchanged. Exact-head CI is clean, including Coverage, Integration Tests, Repo Guards, and Android/Linux/macOS smoke. Size is unchanged for npm unpacked/bundled output (tarball metadata +7 B only). No linked dependencies or unresolved review findings.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Sep 2, 2026
@thymikee
thymikee merged commit 2215a22 into main Sep 3, 2026
17 checks passed
@thymikee
thymikee deleted the claude/test-fixtures-session-handlers branch September 3, 2026 06:01
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-03 06:01 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