[PR #6952] [CLOSED] test(javascript): pass the webpack helper as the factory parameter #7470

Closed
opened 2026-11-01 21:48:05 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6952
Author: @kaoru0822-kitauji
Created: 10/24/2026
Status: ❌ Closed

Base: main ← Head: fix/webpack-factory-helper-fixture


📝 Commits (1)

  • 0784b1f test(javascript): pass the webpack helper as the factory parameter

📊 Changes

1 file changed (+10 additions, -3 deletions)

View changed files

📝 tests/acceptance/applications/applicationWorkflowCli.test.ts (+10 -3)

📄 Description

What broke: main's Test shard (8/8) and Portable tests fail applicationWorkflowCli.test.ts > Webpack factory CommonJS export keys since f774dc420. REA no longer reports the from.helper key.
The fix: the fixture redeclared __webpack_require__ inside a factory whose parameter has that name, which is a SyntaxError. The bundle now uses the parameter, as webpack's runtime passes it, and only the CommonJS oracle defines a d stub.
Risk: test-only; no production code changes.

Summary

f774dc420 (fix(javascript): bind factory export roles to parameter values) gives webpack's export receivers and loader helpers their calling-convention role only while the binding at the read still holds its original parameter value, as docs/javascript-artifact-reconstruction.md now states. The acceptance fixture pasted a body containing const __webpack_require__ = { d(...) {...} } into function(module, exports, __webpack_require__) {...}. That redeclares the parameter: new Function("module","exports","__webpack_require__","const __webpack_require__ = {};") throws SyntaxError: Identifier '__webpack_require__' has already been declared. Under the new rule, __webpack_require__.d(exports, { "from.helper": ... }) is correctly no longer treated as the loader helper, so the CLI/MCP export keys lose from.helper while the Node oracle (which runs the body as a plain module) still has it. Follow-up to #6945 for main health; no issue is linked.

Problem and expected behavior

  • Trigger: npm run test:focused -- tests/acceptance/applications/applicationWorkflowCli.test.ts on main b869fa762 → expected [ '', 'dot.key', 'module.dot', …(2) ] to deeply equal [ '', 'dot.key', 'from.helper', …(3) ].
  • Expected: a valid webpack factory that calls the real __webpack_require__.d parameter reports from.helper, matching the runtime oracle.

Change and scope

  • tests/acceptance/applications/applicationWorkflowCli.test.ts only. The d stub moves out of WEBPACK_FACTORY_BODY into WEBPACK_REQUIRE_STUB. The bundle factory receives the helper as its parameter, and the oracle file is WEBPACK_REQUIRE_STUB + WEBPACK_FACTORY_BODY, so its runtime keys are unchanged.
  • Not included: any change to f774dc420's analysis. Its rule is what makes the replaced-binding case unknown.

Contract and boundary impact

  • Semantic owner and earliest changed stage: JavaScript webpack factory export analysis; unchanged here.
  • Contribution scope fit and linked maintainer decision: not applicable (test alignment with an existing maintainer change).
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests updated: tests/acceptance/applications/applicationWorkflowCli.test.ts.
  • Base reproduction (executed, local macOS, Node 24.22.1): on b869fa762 without this change, the test fails (1 failed / 36 passed) with the assertion above. The same failure appeared in #6945's CI (Test shard (8/8)).
  • User-visible CLI/MCP output (if applicable): none.
  • Remaining proof gaps: none known.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- tests/acceptance/applications/applicationWorkflowCli.test.ts (on b869fa762 + this change): 37 passed.
  • Same command without the change: 1 failed / 36 passed.
  • node -e check that the new WEBPACK_FACTORY_BODY parses as a factory with the __webpack_require__ parameter: parses.
  • npx oxfmt --check and npx oxlint on the file: clean. npm run check:fast and npm run format:check passed on the same tree before the cherry-pick onto main.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none needed (test-only).

Author readiness

Human owner: @kaoru0822-kitauji

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/6952 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/webpack-factory-helper-fixture` --- ### 📝 Commits (1) - [`0784b1f`](https://github.com/morluto/rea/commit/0784b1f265f89efd446e664f4d743bc5fd0007ea) test(javascript): pass the webpack helper as the factory parameter ### 📊 Changes **1 file changed** (+10 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `tests/acceptance/applications/applicationWorkflowCli.test.ts` (+10 -3) </details> ### 📄 Description **What broke:** main's Test shard (8/8) and Portable tests fail `applicationWorkflowCli.test.ts > Webpack factory CommonJS export keys` since f774dc420. REA no longer reports the `from.helper` key. **The fix:** the fixture redeclared `__webpack_require__` inside a factory whose parameter has that name, which is a SyntaxError. The bundle now uses the parameter, as webpack's runtime passes it, and only the CommonJS oracle defines a `d` stub. **Risk:** test-only; no production code changes. ## Summary f774dc420 (`fix(javascript): bind factory export roles to parameter values`) gives webpack's export receivers and loader helpers their calling-convention role only while the binding at the read still holds its original parameter value, as `docs/javascript-artifact-reconstruction.md` now states. The acceptance fixture pasted a body containing `const __webpack_require__ = { d(...) {...} }` into `function(module, exports, __webpack_require__) {...}`. That redeclares the parameter: `new Function("module","exports","__webpack_require__","const __webpack_require__ = {};")` throws `SyntaxError: Identifier '__webpack_require__' has already been declared`. Under the new rule, `__webpack_require__.d(exports, { "from.helper": ... })` is correctly no longer treated as the loader helper, so the CLI/MCP export keys lose `from.helper` while the Node oracle (which runs the body as a plain module) still has it. Follow-up to #6945 for main health; no issue is linked. ## Problem and expected behavior - Trigger: `npm run test:focused -- tests/acceptance/applications/applicationWorkflowCli.test.ts` on main b869fa762 → `expected [ '', 'dot.key', 'module.dot', …(2) ] to deeply equal [ '', 'dot.key', 'from.helper', …(3) ]`. - Expected: a valid webpack factory that calls the real `__webpack_require__.d` parameter reports `from.helper`, matching the runtime oracle. ## Change and scope - `tests/acceptance/applications/applicationWorkflowCli.test.ts` only. The `d` stub moves out of `WEBPACK_FACTORY_BODY` into `WEBPACK_REQUIRE_STUB`. The bundle factory receives the helper as its parameter, and the oracle file is `WEBPACK_REQUIRE_STUB + WEBPACK_FACTORY_BODY`, so its runtime keys are unchanged. - Not included: any change to f774dc420's analysis. Its rule is what makes the replaced-binding case unknown. ## Contract and boundary impact - Semantic owner and earliest changed stage: JavaScript webpack factory export analysis; unchanged here. - Contribution scope fit and linked maintainer decision: not applicable (test alignment with an existing maintainer change). - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none. Expected effects (check known effects; use documentation-only on its own). Unchecked items do not establish absence; leave uncertainties visible. - [ ] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [x] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests updated: `tests/acceptance/applications/applicationWorkflowCli.test.ts`. - Base reproduction (executed, local macOS, Node 24.22.1): on b869fa762 without this change, the test fails (1 failed / 36 passed) with the assertion above. The same failure appeared in #6945's CI (Test shard (8/8)). - User-visible CLI/MCP output (if applicable): none. - Remaining proof gaps: none known. For evidence-bearing changes: - [ ] Observed, derived, and inferred claims remain distinguishable. - [ ] Artifact identity, source provenance, and failed attempts remain preserved. - [ ] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:focused -- tests/acceptance/applications/applicationWorkflowCli.test.ts` (on b869fa762 + this change): 37 passed. - Same command without the change: 1 failed / 36 passed. - `node -e` check that the new `WEBPACK_FACTORY_BODY` parses as a factory with the `__webpack_require__` parameter: parses. - `npx oxfmt --check` and `npx oxlint` on the file: clean. `npm run check:fast` and `npm run format:check` passed on the same tree before the cherry-pick onto main. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable. - Package or release metadata impact: none. - Security, privacy, process, or containment review: none needed (test-only). ## Author readiness Human owner: @kaoru0822-kitauji - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [ ] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:48:05 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7470
No description provided.