Skip to content

Trim own-file-only core exports; workerd parity never passes when it compared nothing - #899

Merged
jimhoyd merged 2 commits into
mainfrom
claude/trim-exports
Sep 29, 2026
Merged

jimhoyd merged 2 commits into
mainfrom
claude/trim-exports

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Two small cleanups. Neither changes runtime behavior.

Core exports

Method: the TypeScript language service over tsconfig.json, plus a text search of every candidate across the repo. "Public" means reachable from any package.json#exports entry.

Category Count Action
Public API 409 kept
Used by other core modules or scripts 390 kept
Policy-module contract members (read through PolicyModule) 22 kept
Used only in their own file 61 export removed
Not referenced anywhere (BodySchemaFormat) 1 deleted
Used only by genuine unit tests 57 kept
In files other open work is editing 38 untouched; can go in a later pass
  • RUNTIME-IMPLEMENTATION's source maps still point at symbols that exist; none claims a public seam.

workerd parity

  • Cause: a direct node scripts/workerd-parity.ts never compared anything. npm_execpath is only set under npm run, so it skipped at once, and printed one terse line and exited 0.
  • Fix:
    • The verdict moves to scripts/workerd-parity-verdict.ts.
    • A skip now says SKIP: compared 0 requests: … with the reason, and WORKERD_PARITY_REQUIRED=1 turns it into FAIL and exit 1.
    • The run fails when the number of cases compared is 0 or below the number declared.
    • A success line reports the count.
  • Test: a new test in test/workflows.test.ts covers these rules and a direct invocation.

Evidence (macOS, Node 26)

  • npm run verify passes (1160 root tests plus the workspaces). npm run test:package passes.
  • WORKERD_PARITY_REQUIRED=1 npm run test:workerd: 37/37 identical.

🤖 Generated with Claude Code

jimhoyd and others added 2 commits September 29, 2026 03:31
A direct `node scripts/workerd-parity.ts` has no npm_execpath, so it
skipped before building anything and printed one terse SKIP line with
exit 0; that is why PR #898's second run showed no SAME lines. The skip
now says it compared 0 requests and why, and the comparison fails when it
compared zero requests or fewer than it declared. The verdict lives in
scripts/workerd-parity-verdict.ts so a test reaches it without the network.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ir own file

The TypeScript language service found 61 core exports that no other
module, test or script references and that no package.json#exports entry
reaches; they are now module-local. BodySchemaFormat had no reference at
all and is removed. Policy-module members (name, phases, compile, ...)
stay exported: the registry reads them through the PolicyModule contract.
Test-only and script-only exports are kept (they back unit tests and the
repository checks). No behavior changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jimhoyd
jimhoyd enabled auto-merge (squash) September 29, 2026 08:31
@jimhoyd
jimhoyd merged commit 72fb55a into main Sep 29, 2026
21 checks passed
@jimhoyd
jimhoyd deleted the claude/trim-exports branch September 29, 2026 08:35
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