Skip to content

fix: handle edge cases in ranges, translate, parsefiles, and fetching - #125

Merged
bnb merged 1 commit into
mainfrom
bnb/edge-case-fixes
Oct 29, 2026
Merged

bnb merged 1 commit into
mainfrom
bnb/edge-case-fixes

Conversation

@botandbang

Copy link
Copy Markdown
Contributor

Fixes five bugs, each with a regression test.

translate. translate() looked terms up on a plain object, so translate('toString'), 'constructor', 'hasOwnProperty' and '__proto__' resolved to Object.prototype members instead of rejecting. It now checks with Object.hasOwn. It also returned its internal arrays, so pushing onto a result changed later results. It now returns a copy.

ranges. lts/active took its newest bounds only from lts/latest and its oldest bounds only from lts/maintenance. When either was empty those fields were undefined even though lts/active had versions. On 2024-10-23 it had 36 versions and no newestLts. It now uses the other range when one is empty. Running main's ranges and this branch's on every day from 2009-06-01 to 2026-10-01, lts/active's fallback fields are the only difference. current and lts/latest keep the first-line-only bounds from #92. The filter checks now go through one wants() helper instead of repeated === || .includes() conditions, which also did substring matching on string filters. A dead conditional and some wrong comments are gone. docs/pages/ranges.md describes the fallback.

parsefiles. win-x64-exe and win-x86-exe each listed both architectures' files. Each id now lists only its own directory, so a future win-arm64-exe works too. osx-x86-tar was never turned into a file name; it now gives node-v<version>-darwin-x86.tar.gz. The two exe entries in test/data/expected.json are updated.

fetching. core's versions.js and schedule.js and @nodevu/fetchindex now throw Fetching <url> failed: <status> <statusText> on a non-OK response instead of failing to parse an error page as JSON.

ci. npm install -ws is now npm install --workspaces in ci.yml and nightly-static-build.yaml. npm 12 rejects -ws.

- translate: reject names inherited from Object.prototype and return a copy
- ranges: fall back to the other lts range for lts/active's bounds when one is empty
- parsefiles: list only the id's own directory for win-*-exe, and parse osx-x86-tar
- core, fetchindex: throw with the URL and status on a non-OK response
- ci: use --workspaces, since npm 12 rejects -ws
@bnb
bnb merged commit 2d797b4 into main Oct 29, 2026
41 checks passed
@bnb
bnb deleted the bnb/edge-case-fixes branch October 29, 2026 14:46
@nodevu-ci nodevu-ci Bot mentioned this pull request Oct 29, 2026
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