Skip to content

refactor: remove shallow re-export modules and a dead branch#901

Merged
thymikee merged 1 commit into
mainfrom
refactor/remove-shallow-modules
Jun 27, 2026
Merged

refactor: remove shallow re-export modules and a dead branch#901
thymikee merged 1 commit into
mainfrom
refactor/remove-shallow-modules

Conversation

@thymikee

Copy link
Copy Markdown
Member

What

Pure-deletion dedup of shallow/dead modules — no behavior change.

  1. src/daemon/handlers/parse-utils.ts was a 6-line pure re-export alias (alert constants + parseTimeout). Inlined at its two importers (snapshot-alert.ts, snapshot.test.ts) — they now import from the real homes (alert-contract.ts, utils/parse-timeout.ts) — and deleted the file. Alias names (POLL_INTERVAL_MS, DEFAULT_TIMEOUT_MS) are preserved via as import renames, so bound identifiers are unchanged.
  2. src/daemon/handlers/handler-utils.ts re-exported mergeParentFlags from core/batch.ts. Repointed the sole importer (session-replay-action-runtime.ts) to import it from its real home and dropped the re-export. recordSessionAction (the module's real export) is untouched.
  3. src/daemon/session-routing.ts had a dead both-arms branch if (requested !== 'default') return requested; return requested; — collapsed to return requested.
  4. src/utils/device.ts normalizePlatformSelector was a documented identity no-op (return platform). Verified against every call site: all inputs (flags.platform, req.flags?.platform, lockPlatform) are typed PlatformSelector | undefined — exactly the function's return type — so inlining is type-identical. Deleted the function and inlined all 9 value sites; replaced the 3 type-position usages (ReturnType<typeof normalizePlatformSelector> -> PlatformSelector | undefined, NonNullable<...> -> NonNullable<PlatformSelector>).

Net -20 lines (28 insertions, 48 deletions across 14 files; one file deleted).

Validation

  • tsc -p tsconfig.json --noEmit -> clean
  • oxfmt --write + oxlint --deny-warnings on all changed files -> clean
  • vitest run daemon device session-routing -> 99 files / 948 tests pass (covers session-routing, request-lock-policy, session-selector, device-ready, and the parseTimeout snapshot test)

behaviorless: every change is either a pure import-source repoint (same bound identifiers/values), an unreachable-branch collapse (both arms returned the same value), or inlining an identity function whose return type matched each call-site input type exactly. No error codes, messages, or recorded shapes touched.

@github-actions

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 1.4 MB 1.4 MB -164 B
JS gzip 445.7 kB 445.7 kB -35 B
npm tarball 584.5 kB 584.5 kB -34 B
npm unpacked 2.0 MB 2.0 MB -164 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 21.7 ms 23.1 ms +1.4 ms
CLI --help 37.8 ms 38.7 ms +0.9 ms

Top changed chunks:

Chunk Raw diff Gzip diff
dist/src/9722.js -58 B -20 B
dist/src/session.js -52 B +2 B

@thymikee

Copy link
Copy Markdown
Member Author

Codex review: no actionable findings.

I checked the deleted re-export paths and the remaining import graph: parse-utils is gone with callers repointed to alert-contract / parse-timeout, mergeParentFlags now imports from core/batch, and normalizePlatformSelector was an identity over already-typed PlatformSelector | undefined inputs. The session-routing branch removal is behaviorless because both paths returned the same requested value.

Validation: all CI checks are green. I did not rerun local tests in this temp worktree because dependencies were absent, but the PR validation covers the touched routing/device/session paths and the diff has no public export/package surface change.

Residual risk: low; this is import-source cleanup plus identity/dead-branch removal.

@thymikee thymikee merged commit 9b79e21 into main Jun 27, 2026
20 checks passed
@thymikee thymikee deleted the refactor/remove-shallow-modules branch June 27, 2026 12:56
@github-actions

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

1 participant