Skip to content

test: cover least-tested parsing modules + verify public exports reach npm; drop dead daemon barrels#749

Merged
thymikee merged 3 commits into
mainfrom
claude/friendly-goldberg-7yqb6w
Jun 10, 2026
Merged

test: cover least-tested parsing modules + verify public exports reach npm; drop dead daemon barrels#749
thymikee merged 3 commits into
mainfrom
claude/friendly-goldberg-7yqb6w

Conversation

@thymikee

Copy link
Copy Markdown
Member

What & why

Started from the coverage report (coverage/) and targeted the least-covered, genuinely testable modules — exercising real behavior, not padding metrics. Then hardened the public-export test and removed internal re-export barrels that obscured where code lives.

1. Unit tests for the least-covered pure-logic modules

Module Before After
utils/source-value.ts (env/config value parsing) 42% 100% lines
commands/cli-grammar/gesture.ts (CLI↔daemon gesture args) 41% 100%
commands/cli-grammar/system.ts (back/rotate/keyboard/clipboard/react-native) 57% 100%
core/device-rotation.ts (orientation parsing + aliases) 60% 100%
core/dispatch-payload.ts (push payload loading, temp-file I/O) 42% 58%

The remaining gap in dispatch-payload.ts is intentional — the uncovered lines are defensive fs error branches (ENOENT/EISDIR/EACCES) that are unreachable through the public entry point because the path is stat-validated first. I deliberately did not fabricate tests to hit them.

2. Stronger public-export test (package-exports.test.ts)

The existing test only checked that package.json declared the expected subpaths. It now verifies the real publish-time invariant: every exports subpath maps to a configured rslib build entry → an existing source module that actually exposes named exports, with import/types targets kept in lockstep. This catches "added a public export but forgot the build entry" (which would ship a broken import).

3. Removed dead internal barrels

Four src/daemon files were pure 1:1 forwarders to their src/utils source. Repointed all importers at the real module and deleted the forwarders so it's obvious where code lives:

  • daemon/is-predicates.tsutils/selector-is-predicates.ts
  • daemon/selectors-build.tsutils/selector-build.ts
  • daemon/snapshot-diff.tsutils/snapshot-diff.ts
  • daemon/snapshot-processing.tsutils/snapshot-processing.ts

The curated daemon/selectors.ts facade was kept; only blind forwarders were removed. No behavior change.

Also gitignored the generated coverage/ report.

Verification

  • pnpm typecheck
  • pnpm lint (852 files) ✅ · oxfmt
  • Unit suite: 245 files / 2302 tests pass
  • Rebased onto latest main (resolved conflicts from a concurrent react-native-overlay move)
  • Project coverage totals: lines 86.4% · statements 84.4% · functions 91.8% · branches 74.2% (thresholds: lines 80, statements 78)

https://claude.ai/code/session_018i1mhcSe6sqM4mKLUKgYXe


Generated by Claude Code

claude added 3 commits June 10, 2026 12:57
Add focused unit tests for the modules the coverage report flagged as
least covered, exercising real behavior rather than padding metrics:

- utils/source-value: env/config value parsing (booleans, enums, enum
  flags with setValue, int bounds, multiple) — 42% -> 100% lines
- commands/cli-grammar/gesture: CLI<->daemon gesture argument
  translation for every gesture kind incl. error paths — 41% -> 100%
- commands/cli-grammar/system: back/rotate/keyboard/clipboard/
  react-native readers and writers incl. validation — 57% -> 100%
- core/device-rotation: orientation parsing with aliases/errors — 100%
- core/dispatch-payload: push payload loading from inline JSON and
  files, with temp-file I/O and JSON/shape error handling

https://claude.ai/code/session_018i1mhcSe6sqM4mKLUKgYXe
…rels

Strengthen the package-exports test so it verifies the real
publish-time invariant: every package.json "exports" subpath maps to a
configured rslib build entry that points at an existing source module
which actually exposes named exports. This catches a subpath being added
to package.json without a matching build entry (which would ship a
broken import), and keeps import/types targets in lockstep.

Remove four internal re-export barrels under src/daemon that were pure
1:1 forwarders to their src/utils source, and repoint all importers at
the real module so it is obvious where the code lives:

- daemon/is-predicates.ts      -> utils/selector-is-predicates.ts
- daemon/selectors-build.ts    -> utils/selector-build.ts
- daemon/snapshot-diff.ts      -> utils/snapshot-diff.ts
- daemon/snapshot-processing.ts -> utils/snapshot-processing.ts

The curated daemon/selectors.ts facade is kept; only blind forwarders
were removed. No behavior change.

https://claude.ai/code/session_018i1mhcSe6sqM4mKLUKgYXe
@github-actions

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 1.2 MB 1.2 MB 0 B
JS gzip 385.4 kB 385.4 kB 0 B
npm tarball 497.3 kB 497.3 kB 0 B
npm unpacked 1.7 MB 1.7 MB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 24.4 ms 24.2 ms -0.2 ms
CLI --help 39.3 ms 38.3 ms -1.0 ms

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

@thymikee

Copy link
Copy Markdown
Member Author

Review status: no blockers found.

I checked the changed export test against package.json/rslib.config.ts, verified the deleted daemon barrels were internal one-line forwarders with importers repointed to the real utils/* modules, and sampled the added CLI grammar/config/payload tests against their implementations. The PR is CI-green and mergeable from my review.

@thymikee thymikee merged commit c322495 into main Jun 10, 2026
19 checks passed
@thymikee thymikee deleted the claude/friendly-goldberg-7yqb6w branch June 10, 2026 14:28
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-06-10 14:28 UTC

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.

2 participants