test: cover least-tested parsing modules + verify public exports reach npm; drop dead daemon barrels#749
Merged
Merged
Conversation
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
Size Report
Startup median (7 runs, lower is better):
Top changed chunks: no changes in the largest emitted chunks. |
Member
Author
|
Review status: no blockers found. I checked the changed export test against |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
utils/source-value.ts(env/config value parsing)commands/cli-grammar/gesture.ts(CLI↔daemon gesture args)commands/cli-grammar/system.ts(back/rotate/keyboard/clipboard/react-native)core/device-rotation.ts(orientation parsing + aliases)core/dispatch-payload.ts(push payload loading, temp-file I/O)The remaining gap in
dispatch-payload.tsis intentional — the uncovered lines are defensivefserror 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.jsondeclared the expected subpaths. It now verifies the real publish-time invariant: everyexportssubpath maps to a configured rslib build entry → an existing source module that actually exposes named exports, withimport/typestargets kept in lockstep. This catches "added a public export but forgot the build entry" (which would ship a brokenimport).3. Removed dead internal barrels
Four
src/daemonfiles were pure 1:1 forwarders to theirsrc/utilssource. Repointed all importers at the real module and deleted the forwarders so it's obvious where code lives:daemon/is-predicates.ts→utils/selector-is-predicates.tsdaemon/selectors-build.ts→utils/selector-build.tsdaemon/snapshot-diff.ts→utils/snapshot-diff.tsdaemon/snapshot-processing.ts→utils/snapshot-processing.tsThe curated
daemon/selectors.tsfacade was kept; only blind forwarders were removed. No behavior change.Also gitignored the generated
coverage/report.Verification
pnpm typecheck✅pnpm lint(852 files) ✅ ·oxfmt✅main(resolved conflicts from a concurrentreact-native-overlaymove)https://claude.ai/code/session_018i1mhcSe6sqM4mKLUKgYXe
Generated by Claude Code