GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — benchmark: throw on invalid type in fs and webstorage by irontaek · Pull Request #66647 · nodejs/node

Conversation

@irontaek

@irontaek irontaek commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

In 21 fs and webstorage benchmarks, the default: branch of the type switch
creates new Error('Invalid type') without throwing it. An unknown type then
falls through and benchmarks an undefined path instead of failing.

Before:

$ node benchmark/fs/bench-existsSync.js type=bogus n=10
fs/bench-existsSync.js n=10 type="bogus": 42,410.43975384981

After, the same command throws Error: Invalid type. Every type listed in each
benchmark's config still has a matching case, so valid runs are unchanged.

Disclosure: this change was found by a static check for discarded new Error(...)
expressions and prepared with a coding agent, which also ran the commands above.
I'll handle review feedback myself.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nodejs-github-bot

nodejs-github-bot commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/performance
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added benchmark Issues and PRs related to Node.js benchmarks and benchmarking infrastructure. fs Issues and PRs related to file-system APIs and the fs module. labels Oct 10, 2026
@github-actions github-actions Bot added the agentscan:automated-account label Oct 10, 2026
@github-actions

github-actions Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

  • the guide for first-time contributors
  • the contribution and automation policies
  • the pull request guide
  • the AI use policy
  • the Code of Conduct

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

Caution

AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@yoominho91 yoominho91 mentioned this pull request Oct 10, 2026
chore: register nodejs/node #66647 m1kapp/fixearly#186
Merged
@atlowChemi

atlowChemi commented Oct 11, 2026

Copy link
Copy Markdown
Member

Probably worth adding a lint rule that doesn't allow calling the error constructor without throwing/assigning/returning it.
Maybe no-new could work, though might cause unrelated noise

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@irontaek

irontaek commented Oct 11, 2026

Copy link
Copy Markdown
Contributor Author

Good idea. no-new would flag ~310 sites (mostly tests that construct objects for side effects). A narrower selector next to the existing ThrowStatement one, ExpressionStatement > NewExpression[callee.name=/Error$/], flags only 2 sites after this PR — both intentional (benchmark/error/error.js measures Error construction, and test/parallel/test-errors-systemerror.js asserts the constructor throws), which I disabled inline. Added it as a second commit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@MikeMcC399

This comment was marked as resolved.

Sign in to view
@irontaek
irontaek force-pushed the benchmark-throw-invalid-type branch from 622bc2e to 2c08205 Compare October 13, 2026 15:08
@irontaek

irontaek commented Oct 13, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, added the sign-off to both commits.

MikeMcC399 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codecov

codecov Bot commented Oct 13, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.73%. Comparing base (5884b8e) to head (b66ce2a).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66647      +/-   ##
==========================================
+ Coverage   90.71%   90.73%   +0.01%     
==========================================
  Files         801      801              
  Lines      280906   280906              
  Branches    54249    54258       +9     
==========================================
+ Hits       254832   254877      +45     
+ Misses      16246    16193      -53     
- Partials     9828     9836       +8     

see 35 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@irontaek

irontaek commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Friendly ping for review. Both commits now include sign-offs, and all GitHub checks are passing. This also includes the targeted lint rule suggested above. Is there anything else needed from my side?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@irontaek

irontaek commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

@atlowChemi since the lint rule here came from your suggestion, would you be able to take a look when you have a moment? Happy to adjust the selector or split the rule into a separate PR if that's easier to review.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mcollina
mcollina approved these changes Nov 18, 2026
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
atlowChemi
atlowChemi approved these changes Nov 19, 2026
View reviewed changes
@atlowChemi

atlowChemi commented Nov 19, 2026

Copy link
Copy Markdown
Member

@irontaek can you rebase over main so we don't land the PR and have the lint rule error on code in main not fixed by the PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

irontaek added 2 commits November 20, 2026 21:43
@irontaek
benchmark: throw on invalid type in fs and webstorage
705a25c
The default branch of the type switch constructed an Error without
throwing it, so an unknown type silently benchmarked an undefined
path instead of failing.

Assisted-by: a closed-source coding agent
Signed-off-by: Minho Yoo <[email protected]>
@irontaek
tools: disallow constructing an Error without using it
b66ce2a
Add a no-restricted-syntax selector next to the existing
ThrowStatement one. It would have caught the benchmark bug fixed in
the previous commit; the two intentional sites are disabled inline.

Assisted-by: a closed-source coding agent
Signed-off-by: Minho Yoo <[email protected]>
@irontaek
irontaek force-pushed the benchmark-throw-invalid-type branch from 2c08205 to b66ce2a Compare November 20, 2026 12:45
@irontaek

irontaek commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (2d8a7f3). I also ran ESLint with only the new selector enabled across lib/, test/ and benchmark/ on the rebased tree. It reports no hits beyond the ones this PR already handles, and lint-js-and-md passes on the new head.

atlowChemi reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mcollina
mcollina approved these changes Nov 21, 2026
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 21, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 21, 2026
@nodejs-github-bot

nodejs-github-bot commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/79389/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@atlowChemi atlowChemi added commit-queue PRs queued for automated landing through the Commit Queue. commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. labels Nov 22, 2026
@nodejs-github-bot

nodejs-github-bot commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Landed in 2b365b2...2ab7bc0

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

nodejs-github-bot pushed a commit that referenced this pull request Nov 22, 2026
@irontaek @nodejs-github-bot
benchmark: throw on invalid type in fs and webstorage
8fd96f4
The default branch of the type switch constructed an Error without
throwing it, so an unknown type silently benchmarked an undefined
path instead of failing.

Assisted-by: a closed-source coding agent
Signed-off-by: Minho Yoo <[email protected]>
PR-URL: #66647
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
nodejs-github-bot pushed a commit that referenced this pull request Nov 22, 2026
@irontaek @nodejs-github-bot
tools: disallow constructing an Error without using it
2ab7bc0
Add a no-restricted-syntax selector next to the existing
ThrowStatement one. It would have caught the benchmark bug fixed in
the previous commit; the two intentional sites are disabled inline.

Assisted-by: a closed-source coding agent
Signed-off-by: Minho Yoo <[email protected]>
PR-URL: #66647
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
@nodejs-github-bot nodejs-github-bot closed this Nov 22, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 22, 2026
aduh95 pushed a commit that referenced this pull request Nov 23, 2026
@irontaek @aduh95
benchmark: throw on invalid type in fs and webstorage
b6567ea
The default branch of the type switch constructed an Error without
throwing it, so an unknown type silently benchmarked an undefined
path instead of failing.

Assisted-by: a closed-source coding agent
Signed-off-by: Minho Yoo <[email protected]>
PR-URL: #66647
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
aduh95 pushed a commit that referenced this pull request Nov 23, 2026
@irontaek @aduh95
tools: disallow constructing an Error without using it
c3e7d57
Add a no-restricted-syntax selector next to the existing
ThrowStatement one. It would have caught the benchmark bug fixed in
the previous commit; the two intentional sites are disabled inline.

Assisted-by: a closed-source coding agent
Signed-off-by: Minho Yoo <[email protected]>
PR-URL: #66647
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
@github-actions github-actions Bot mentioned this pull request Nov 24, 2026
2026-11-25, Version 27.0.0-alpha.0.2.0 (Alpha) #67757
Merged
gabylb pushed a commit to gabylb/node that referenced this pull request Nov 27, 2026
@irontaek @gabylb
benchmark: throw on invalid type in fs and webstorage
5458f1e
The default branch of the type switch constructed an Error without
throwing it, so an unknown type silently benchmarked an undefined
path instead of failing.

Assisted-by: a closed-source coding agent
Signed-off-by: Minho Yoo <[email protected]>
PR-URL: nodejs#66647
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
gabylb pushed a commit to gabylb/node that referenced this pull request Nov 27, 2026
@irontaek @gabylb
tools: disallow constructing an Error without using it
3925cae
Add a no-restricted-syntax selector next to the existing
ThrowStatement one. It would have caught the benchmark bug fixed in
the previous commit; the two intentional sites are disabled inline.

Assisted-by: a closed-source coding agent
Signed-off-by: Minho Yoo <[email protected]>
PR-URL: nodejs#66647
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes
@atlowChemi atlowChemi atlowChemi approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

agentscan:automated-account benchmark Issues and PRs related to Node.js benchmarks and benchmarking infrastructure. commit-queue-rebase PRs the Commit Queue should land as multiple self-contained commits. fs Issues and PRs related to file-system APIs and the fs module.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@irontaek @nodejs-github-bot @atlowChemi @MikeMcC399 @mcollina
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.