Skip to content

tokenizer: bring back to 100% coverage - #1603

Merged
sergey-shandar merged 2 commits into
mainfrom
fix-cov
Aug 16, 2026
Merged

tokenizer: bring back to 100% coverage#1603
sergey-shandar merged 2 commits into
mainfrom
fix-cov

Conversation

@sergey-shandar

Copy link
Copy Markdown
Contributor

Summary

  • Restore full line/branch coverage for fjs/js/tokenizer/module.f.mjs by exercising the union throw path directly via a type-erased unionX helper instead of an unreachable-in-practice callback construction
  • Drop unused RangeMapArray/StringToken/NumberToken/BigIntToken/ErrorToken/WhitespaceToken/NewLineToken/IdToken/CommentToken/EofToken imports and add the now-used Reduce import

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
functionalscript 126eb0b Commit Preview URL

Branch Preview URL
Aug 16 2026, 02:46 AM

@o2alexanderfedin o2alexanderfedin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage claim is exact, measured with npm run cov:

line branch funcs
fjs/js/tokenizer/module.f.mjs on origin/main 100.00 100.00 97.99
same file at c9442a6 100.00 100.00 100.00
all files, main → head 100/100/99.86 → 100/100/100.00

So this closes precisely the global 99.86% funcs gap. The cause is confirmed by #1600's own body — the old fixture declared three arrows it never invoked, which is what cost the function score; unionX(0)(1)(2) allocates none.

I checked the type-erasure angle since it runs opposite to #1594/#1600 removing unreachable branches, and it holds up: the throw proof key is a first-class convention here (fjs/emergent_testing/module.f.mjs:65,91), and this throw is a real merge guard rather than a dead defensive branch. unionX is module-local, not exported, and const union = unionX re-narrows to _CreateToToken<T>, so every production call site (module.f.mjs:184) keeps its old type — no safety loss and nothing reachable from production.

Every dropped import is genuinely unreferenced; Reduce is used at lines 165 and 174. npx tsc exit 0; suite 2855 pass / 0 fail; CI green.

One nit: the description has no Changelog: section, which CONTRIBUTING.md:201 makes mandatory either way. Proof-only with no behavior change, so no changelog/unreleased/1603.md file is needed — just Changelog: none at the end of the body.

@sergey-shandar
sergey-shandar added this pull request to the merge queue Aug 16, 2026
Merged via the queue into main with commit 5dcfbbc Aug 16, 2026
19 checks passed
@sergey-shandar
sergey-shandar deleted the fix-cov branch August 16, 2026 03:42
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