Repository navigation
fix: preserve JSG constructor parameter names - #7696
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
recheck |
|
This pull request's reviews are posted as pull request reviews: see the review of |
|
clanker review |
There was a problem hiding this comment.
⚠️ Out of date: this review is ofb7a28809; the pull request is now at249d6ace. Someone with write access can commentclanky review(orclanker reviewor@clanky-the-clanker review) to review the new commits.
✅ Approved — A small, well-tested fix: native C++ constructors are no longer merged with the JavaScript constructor factory's parameter names. No issues found.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🔒 Security: ✅ LGTM
This is a build-time tool and a test change. It has no security impact.
📖 AGENTS.md: ✅ LGTM
The tests follow the <module>-test.rs convention for Rust unit tests. No AGENTS.md updates are needed.
📋 Code Quality: ✅ LGTM
The extractor change is minimal. Native constructors now fall through to Other and contribute no parameters. The regression tests cover the TextDecoder-style overlap.
⚡ Performance: ✅ LGTM
No performance concerns.
📝 Documentation: ✅ LGTM
The new comments describe how the code behaves now.
Reviewed commit: b7a28809
Closes #3870.
Native C++ constructors were renamed to
constructorduring parameter extraction and merged with JavaScript-facing JSG static constructor factories. Their parameter indexes could overwrite the factory's names, producing the duplicateoptionsnames reported in the issue.Exclude
CXXConstructorDeclwhile retaining static factory, method and function parameters. Add three Rust regression tests and enable the existing//src/workerd/tools:param_extractor_bin_testBazel target. The TextDecoder type override remains in place.Clippy follow-up
The October 26 Bazel lint job reports an actionable
clippy::needless_pass_by_valueerror in the new test helper, in addition to remote-cache HTTP 500 errors. The earlier description identified the cache errors but omitted that Rust diagnostic.Borrow the fixture children in
nodeandextract, updating their callers. Keep the existing empty-result assertion as explicit vector equality, which also satisfies the additionalassert_is_emptylint in Rust 1.99. The production extractor and Bazel build definitions are unchanged by this follow-up; all three regression scenarios and their expected results are preserved.Follow-up validation
Rechecked on October 30 for commit
b7a28809feb6519efa36dc3b61a45c893d815bd3with Rust 1.99.0 against the actual worktree source through a small standalone Cargo manifest:260ba50c63e550dbd5e334e851cfa59df151f799passes all three tests but fails Clippy withneedless_pass_by_valueand Rust 1.99'sassert_is_empty.build/rust_lint.bazelrc, including pedantic/nursery lints and-D warnings, together with the repository'sclippy.toml.git diff --checkpass. A separate read-only Codex review found no blockers.A clean virtual merge with current main
29767ec979e61dab2a3d3e508cf3573574bf7742preserves the exact extractor, tests, Bazel definitions, lint flags and formatting inputs that were tested. Although the overall Cargo files contain newer unrelated dependencies, all six extractor dependency declarations and every reachable locked package record are unchanged. The three tests and strict Clippy also pass after resolving the harness from that virtual merge's actual lockfile.A clean virtual merge with current main
29767ec979e61dab2a3d3e508cf3573574bf7742keeps the extractor, fixture, build macros and lint configuration identical to the tested files. The reachable dependency records also match; the three tests and strict Clippy passed again using the merged lockfile.Rust 1.97 was unavailable in the current local environment, so this follow-up does not claim a fresh run on that version. No full Bazel build was run locally. Hosted CI must validate the new head; the separate remote-cache HTTP 500 failure may still require a maintainer retry.
Current hosted status
The new head's Lint, CodSpeed, Tests and Coverage workflows require maintainer approval before execution. The new internal-build job stops at the fork-owner organization-membership check. This status is separate from the locally reproduced and repaired Clippy violation; no successful new-head Bazel CI run is claimed.
Previous validation
The previously recorded local checks used the actual extractor source and repository dependency versions. The two constructor regression cases failed before the original production fix; all three passed afterward with Rust 1.97.1 and 1.99.0. The pinned buildifier and Rust formatting passed. CLI checks against a real Clang AST preserved
js,labelandoptionsfor JSON and gzip input. Those checks predate this test-helper follow-up.For previous head
260ba50c, the Tests run passed Linux, Linux ARM, ASan, debug, TSan, macOS, Windows, snapshot and workers-sdk jobs. Separate Lint, coverage and CLA checks passed. These results do not validate the new head.The previous internal build stopped at the external fork's Cloudflare organization-membership gate before running the build. Retrying the failed Bazel job was denied because repository admin rights are required.
The timeline contains approvals from petebacondarwin (October 23) and NuroDev (October 26), which predate this follow-up. Codex assisted with implementation and verification; no independent human review of the new change is claimed.