Skip to content

fix: preserve JSG constructor parameter names - #7696

Merged
bartlomieju merged 4 commits into
cloudflare:mainfrom
haranishi:fix/3870-constructor-parameter-names
Nov 28, 2026
Merged

bartlomieju merged 4 commits into
cloudflare:mainfrom
haranishi:fix/3870-constructor-parameter-names

Conversation

@haranishi

@haranishi haranishi commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #3870.

Native C++ constructors were renamed to constructor during parameter extraction and merged with JavaScript-facing JSG static constructor factories. Their parameter indexes could overwrite the factory's names, producing the duplicate options names reported in the issue.

Exclude CXXConstructorDecl while retaining static factory, method and function parameters. Add three Rust regression tests and enable the existing //src/workerd/tools:param_extractor_bin_test Bazel target. The TextDecoder type override remains in place.

Clippy follow-up

The October 26 Bazel lint job reports an actionable clippy::needless_pass_by_value error 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 node and extract, updating their callers. Keep the existing empty-result assertion as explicit vector equality, which also satisfies the additional assert_is_empty lint 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 b7a28809feb6519efa36dc3b61a45c893d815bd3 with Rust 1.99.0 against the actual worktree source through a small standalone Cargo manifest:

  • The public head 260ba50c63e550dbd5e334e851cfa59df151f799 passes all three tests but fails Clippy with needless_pass_by_value and Rust 1.99's assert_is_empty.
  • After the fixture change, all three tests and all-target Clippy pass using the exact flags from build/rust_lint.bazelrc, including pedantic/nursery lints and -D warnings, together with the repository's clippy.toml.
  • All six direct dependencies are pinned to the repository's Cargo.lock versions, and every resolved transitive dependency version also matches that lockfile.
  • Rust formatting and git diff --check pass. A separate read-only Codex review found no blockers.

A clean virtual merge with current main 29767ec979e61dab2a3d3e508cf3573574bf7742 preserves 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 29767ec979e61dab2a3d3e508cf3573574bf7742 keeps 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, label and options for 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.

@haranishi
haranishi requested review from a team as code owners October 11, 2026 11:39
@haranishi
haranishi requested review from NuroDev and a balanced review from Copilot and removed request for Copilot October 11, 2026 11:39
@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@haranishi haranishi changed the title fix: 型生成のコンストラクター引数名の衝突を修正 fix: 型生成のコンストラクター引数名の衝突を修正 (preserve JSG constructor parameter names) Oct 11, 2026
@haranishi

Copy link
Copy Markdown
Contributor Author

recheck

Copilot AI balanced review requested due to automatic review settings October 26, 2026 16:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@clanky-the-clanker

clanky-the-clanker Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

This pull request's reviews are posted as pull request reviews: see the review of b7a28809.

@haranishi haranishi changed the title fix: 型生成のコンストラクター引数名の衝突を修正 (preserve JSG constructor parameter names) fix: preserve JSG constructor parameter names Oct 30, 2026
@petebacondarwin

Copy link
Copy Markdown
Contributor

clanker review

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Out of date: this review is of b7a28809; the pull request is now at 249d6ace. Someone with write access can comment clanky review (or clanker review or @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

@bartlomieju
bartlomieju merged commit 938d0b0 into cloudflare:main Nov 28, 2026
40 of 44 checks passed
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.

Bug in workers types generation logic

6 participants