[PR #2723] [CLOSED] test(javascript): expect a parameter's provenance to stay unknown #5344

Closed
opened 2026-10-31 01:05:53 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2723
Author: @XiaoBinGan
Created: 10/13/2026
Status: ❌ Closed

Base: main ← Head: fix/javascript-parameter-provenance-test


📝 Commits (1)

  • cb14d61 test(javascript): expect a parameter's provenance to stay unknown

📊 Changes

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

View changed files

📝 src/domain/javascript/javascriptSemanticAnalysis.structure.test.ts (+6 -3)

📄 Description

Summary

Align the shadowing expectation in the JavaScript semantic structure suite with the parameter provenance rule c7a890d introduced, so the suite stops failing on main.

Problem and expected behavior

Test shard (2/6) fails on the current main for every pull request, not only for this one:

FAIL |domain| src/domain/javascript/javascriptSemanticAnalysis.structure.test.ts
  > JavaScript semantic analysis: structure 1
  > resolves imports, require destructuring, aliases, assignments, and shadowing
AssertionError: expected { Object (status, origins, ...) } to deeply equal { status: 'local', origins: [], …(1) }

- Expected
+ Received
  {
    "origins": [],
-   "reason": null,
-   "status": "local",
+   "reason": "Parameter provenance depends on caller arguments.",
+   "status": "unknown",
  }

The fixture declares function local(ipcRenderer), so the binding under test is a parameter. c7a890d ("fix(javascript): preserve unknown module-alias provenance") deliberately replaced the implicit local-provenance fallback with explicit locally constructed values and states that it keeps "opaque results, parameters and caught values unknown". The provenance test added by that same commit asserts exactly this:

// src/domain/javascript/javascriptSemanticProvenance.test.ts
for (const name of [ ..., "parameter", "caught" ]) {
  expect(onlyBinding(ir, name).provenance).toMatchObject({
    status: "unknown",
    origins: [],
  });
}

Two tests therefore disagreed about the same rule, and the older one was left describing the status the newer one removed. The expected behavior is the one the owning change defines: a parameter stays unknown, because nothing in the body establishes its origin.

Change and scope

Only src/domain/javascript/javascriptSemanticAnalysis.structure.test.ts. The shadowing case keeps its purpose: the parameter still must not resolve to the electron import it shadows, which origins: [] and a status other than a module alias both establish. The assertion now matches the rule and uses the sibling test's toMatchObject shape rather than restating the reason string in a second place.

No production code changes, so this cannot alter behavior for any caller.

Contract and boundary impact

None. The test asserts an existing contract; it does not create or narrow one. The user-visible reason text remains owned and asserted where it is produced, and this file no longer duplicates it.

Evidence and regression coverage

Bisected to the producing commit rather than assumed:

Revision javascriptSemanticAnalysis.structure.test.ts
b955b82 (parent of c7a890d) 24 passed
c7a890d 1 failed, 23 passed
c7a890d's own javascriptSemanticProvenance.test.ts asserts parameter is unknown
this branch 24 passed

Verification on macOS 26.5.1 arm64 with the pinned Node 24.18.0:

  • npm run test:focused -- src/domain/javascript/javascriptSemanticAnalysis.structure.test.ts → 24 passed (1 failed before the change)
  • npm run test:focused -- src/domain/javascript/javascriptSemanticProvenance.test.ts → 2 passed
  • npm run test:focused -- src/domain/javascript/*.test.ts → 52 files, 1178 passed
  • npm run check:fast → passed

The change is test-only, so a with/without comparison of production behavior does not apply; the before/after above is the equivalent evidence.

Unavailable coverage

The rest of Test shard (2/6) was not reproduced as a whole on this host, because npm run test:local refuses tests/boundary/**; the suite was run through npm run test:focused, which is the supported path for these files. The failing lane itself is the one this change targets, and it is green here.

No real JavaScript application was analyzed for this change: it asserts a status the semantic IR already reports, and no provider or target execution is involved.


🔄 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/2723 **Author:** [@XiaoBinGan](https://github.com/XiaoBinGan) **Created:** 10/13/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/javascript-parameter-provenance-test` --- ### 📝 Commits (1) - [`cb14d61`](https://github.com/morluto/rea/commit/cb14d6166c805193239de8ce1017e8454879fe3e) test(javascript): expect a parameter's provenance to stay unknown ### 📊 Changes **1 file changed** (+6 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascript/javascriptSemanticAnalysis.structure.test.ts` (+6 -3) </details> ### 📄 Description ## Summary Align the shadowing expectation in the JavaScript semantic structure suite with the parameter provenance rule `c7a890d` introduced, so the suite stops failing on `main`. ## Problem and expected behavior `Test shard (2/6)` fails on the current `main` for every pull request, not only for this one: ``` FAIL |domain| src/domain/javascript/javascriptSemanticAnalysis.structure.test.ts > JavaScript semantic analysis: structure 1 > resolves imports, require destructuring, aliases, assignments, and shadowing AssertionError: expected { Object (status, origins, ...) } to deeply equal { status: 'local', origins: [], …(1) } - Expected + Received { "origins": [], - "reason": null, - "status": "local", + "reason": "Parameter provenance depends on caller arguments.", + "status": "unknown", } ``` The fixture declares `function local(ipcRenderer)`, so the binding under test is a parameter. `c7a890d` ("fix(javascript): preserve unknown module-alias provenance") deliberately replaced the implicit local-provenance fallback with explicit locally constructed values and states that it keeps "opaque results, parameters and caught values unknown". The provenance test added by that same commit asserts exactly this: ```ts // src/domain/javascript/javascriptSemanticProvenance.test.ts for (const name of [ ..., "parameter", "caught" ]) { expect(onlyBinding(ir, name).provenance).toMatchObject({ status: "unknown", origins: [], }); } ``` Two tests therefore disagreed about the same rule, and the older one was left describing the status the newer one removed. The expected behavior is the one the owning change defines: a parameter stays unknown, because nothing in the body establishes its origin. ## Change and scope Only `src/domain/javascript/javascriptSemanticAnalysis.structure.test.ts`. The shadowing case keeps its purpose: the parameter still must not resolve to the `electron` import it shadows, which `origins: []` and a status other than a module alias both establish. The assertion now matches the rule and uses the sibling test's `toMatchObject` shape rather than restating the reason string in a second place. No production code changes, so this cannot alter behavior for any caller. ## Contract and boundary impact None. The test asserts an existing contract; it does not create or narrow one. The user-visible reason text remains owned and asserted where it is produced, and this file no longer duplicates it. ## Evidence and regression coverage Bisected to the producing commit rather than assumed: | Revision | `javascriptSemanticAnalysis.structure.test.ts` | | --- | --- | | `b955b82` (parent of `c7a890d`) | 24 passed | | `c7a890d` | 1 failed, 23 passed | | `c7a890d`'s own `javascriptSemanticProvenance.test.ts` | asserts `parameter` is `unknown` | | this branch | **24 passed** | Verification on macOS 26.5.1 arm64 with the pinned Node 24.18.0: - `npm run test:focused -- src/domain/javascript/javascriptSemanticAnalysis.structure.test.ts` → 24 passed (1 failed before the change) - `npm run test:focused -- src/domain/javascript/javascriptSemanticProvenance.test.ts` → 2 passed - `npm run test:focused -- src/domain/javascript/*.test.ts` → 52 files, 1178 passed - `npm run check:fast` → passed The change is test-only, so a with/without comparison of production behavior does not apply; the before/after above is the equivalent evidence. ## Unavailable coverage The rest of `Test shard (2/6)` was not reproduced as a whole on this host, because `npm run test:local` refuses `tests/boundary/**`; the suite was run through `npm run test:focused`, which is the supported path for these files. The failing lane itself is the one this change targets, and it is green here. No real JavaScript application was analyzed for this change: it asserts a status the semantic IR already reports, and no provider or target execution is involved. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:05:53 +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#5344
No description provided.