[PR #1385] [CLOSED] test(javascript): expect provable precision for the short-circuit mutation #2844

Closed
opened 2026-10-17 21:10:56 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1385
Author: @BaaRai
Created: 10/10/2026
Status: ❌ Closed

Base: main ← Head: test/short-circuit-mutation-provable-presence


📝 Commits (1)

  • 9c8c7d8 test(javascript): expect provable precision for the short-circuit mutation

📊 Changes

1 file changed (+28 additions, -4 deletions)

View changed files

📝 src/application/javascript/JavaScriptSemanticGraphBuilder.test.ts (+28 -4)

📄 Description

Summary

main has been red on Test shard 1/4 since 001851fd ("preserve capture-time guards and ordering"): JavaScriptSemanticGraphBuilder.test.ts > preserves possible alias mutation uncertainty in queries: short-circuit mutation expects unknown-coverage but the graph now reports present for the shared slot. The new presence is the correct outcome of that commit's capture-time ordering: the reassignment alias = { mode: "other" } and the guarded mutation flag && (alias.mode = "updated") share one statement list, so the analysis proves the mutation cannot reach the earlier alias target. The test table now states each row's expected shared presence explicitly and additionally asserts the mutation itself stays recorded on the alias binding in every row.

Problem and expected behavior

Smallest trigger: npm run test on main at 001851fd and later (reproduced deterministically on Linux and Windows, 15/15 and 8/8 local runs; main CI run 38003459598 failed the same test at 08ec2bf8, and PR #1382's shard hit it too).

Root cause chain, from bisecting 39dabd06 (passes) to 001851fd (fails):

  • directMutationPosition now climbs from the assignment to its enclosing statement, so a mutation nested inside a logical expression receives a position in the program's statement list instead of no position at all.
  • positionPrecedes then proves the preceding reassignment dominates the mutation, and the member mutation is attributed only to the reassigned object; the shared slot keeps its captured present value.
  • The if-guarded form keeps no such proof because its mutation's position lives in the consequent block body, so it correctly stays unknown-coverage. Both outcomes match the semantics documented in the reference_lifetimes tests added by the same commit.

Violated invariant: the test table's single hardcoded unknown-coverage expectation encoded the pre-001851fd conservative behavior and was not updated with that change.

Change and scope

src/application/javascript/JavaScriptSemanticGraphBuilder.test.ts only: the seven-row table gains an explicit expected-shared-presence column (unknown-coverage for the six rows whose reassignment or proof is conditional, present for the short-circuit row), and the assertions add the alias slot staying unknown-coverage in every row, proving the guarded mutation is still recorded on the current alias target. No product code changes.

Contract and boundary impact

  • Semantic owner and earliest changed stage: test only; no runtime stage changes.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: not applicable.
  • Process execution, authorization, cleanup, or containment impact: not applicable.
  • Generated metadata, package, or installation impact: not applicable.

Evidence and regression coverage

  • Tests added or updated: the corrected table (explicit per-row presence plus the alias-slot recording assertion).
  • Base reproduction and other evidence:
    • Deterministic local failures at 001851fd and later on both platforms (Windows 15/15, Linux 8/8); 39dabd06 passes; bisect isolates 001851fd.
    • Presence matrix dumped for all seven rows before writing expectations: shared is unknown-coverage in six rows and present only in the short-circuit row; the alias slot is unknown-coverage in all seven.
    • With this change the file is 54/54 green and javascriptSemanticAnalysis.reference_lifetimes.test.ts stays 79/79 green; the four remaining JavaScript failures in my local full-directory run are the known Windows-only ?/# filename NTFS artifacts, untouched by this change.
    • npm run check:fast passes.
  • User-visible CLI/MCP output: not applicable.

🔄 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/1385 **Author:** [@BaaRai](https://github.com/BaaRai) **Created:** 10/10/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `test/short-circuit-mutation-provable-presence` --- ### 📝 Commits (1) - [`9c8c7d8`](https://github.com/morluto/rea/commit/9c8c7d834320a036ed44f1292e2b3965d0bc703b) test(javascript): expect provable precision for the short-circuit mutation ### 📊 Changes **1 file changed** (+28 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/application/javascript/JavaScriptSemanticGraphBuilder.test.ts` (+28 -4) </details> ### 📄 Description ## Summary main has been red on Test shard 1/4 since 001851fd ("preserve capture-time guards and ordering"): `JavaScriptSemanticGraphBuilder.test.ts > preserves possible alias mutation uncertainty in queries: short-circuit mutation` expects `unknown-coverage` but the graph now reports `present` for the shared slot. The new presence is the correct outcome of that commit's capture-time ordering: the reassignment `alias = { mode: "other" }` and the guarded mutation `flag && (alias.mode = "updated")` share one statement list, so the analysis proves the mutation cannot reach the earlier alias target. The test table now states each row's expected shared presence explicitly and additionally asserts the mutation itself stays recorded on the alias binding in every row. ## Problem and expected behavior Smallest trigger: `npm run test` on main at 001851fd and later (reproduced deterministically on Linux and Windows, 15/15 and 8/8 local runs; main CI run 38003459598 failed the same test at 08ec2bf8, and PR #1382's shard hit it too). Root cause chain, from bisecting 39dabd06 (passes) to 001851fd (fails): - `directMutationPosition` now climbs from the assignment to its enclosing statement, so a mutation nested inside a logical expression receives a position in the program's statement list instead of no position at all. - `positionPrecedes` then proves the preceding reassignment dominates the mutation, and the member mutation is attributed only to the reassigned object; the shared slot keeps its captured `present` value. - The if-guarded form keeps no such proof because its mutation's position lives in the consequent block body, so it correctly stays `unknown-coverage`. Both outcomes match the semantics documented in the `reference_lifetimes` tests added by the same commit. Violated invariant: the test table's single hardcoded `unknown-coverage` expectation encoded the pre-001851fd conservative behavior and was not updated with that change. ## Change and scope `src/application/javascript/JavaScriptSemanticGraphBuilder.test.ts` only: the seven-row table gains an explicit expected-shared-presence column (`unknown-coverage` for the six rows whose reassignment or proof is conditional, `present` for the short-circuit row), and the assertions add the alias slot staying `unknown-coverage` in every row, proving the guarded mutation is still recorded on the current alias target. No product code changes. ## Contract and boundary impact - Semantic owner and earliest changed stage: test only; no runtime stage changes. - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: not applicable. - Process execution, authorization, cleanup, or containment impact: not applicable. - Generated metadata, package, or installation impact: not applicable. ## Evidence and regression coverage - Tests added or updated: the corrected table (explicit per-row presence plus the alias-slot recording assertion). - Base reproduction and other evidence: - Deterministic local failures at 001851fd and later on both platforms (Windows 15/15, Linux 8/8); 39dabd06 passes; bisect isolates 001851fd. - Presence matrix dumped for all seven rows before writing expectations: shared is `unknown-coverage` in six rows and `present` only in the short-circuit row; the alias slot is `unknown-coverage` in all seven. - With this change the file is 54/54 green and `javascriptSemanticAnalysis.reference_lifetimes.test.ts` stays 79/79 green; the four remaining JavaScript failures in my local full-directory run are the known Windows-only `?`/`#` filename NTFS artifacts, untouched by this change. - `npm run check:fast` passes. - User-visible CLI/MCP output: not applicable. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:10:56 +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#2844
No description provided.