[PR #6972] feat(javascript): model objects assigned to properties after declaration #7486

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6972
Author: @IvenKooLab
Created: 10/24/2026
Status: 🔄 Open

Base: main ← Head: feat/javascript-property-object-modeling


📝 Commits (10+)

  • d278ec9 feat(javascript): link assignment right-hand sides to their writes
  • 5554589 Merge remote-tracking branch 'upstream/main' into feat/javascript-assignment-flow
  • b25895f chore: integrate current main for assignment analysis
  • 3224aca fix(javascript): preserve computed key assignment ownership
  • 8bf2b57 test(javascript): retain nested callback assignment ownership
  • 0fbd13b chore: integrate current main for JavaScript assignments
  • d55a0b3 docs(javascript): record assignment influence verification
  • 513b637 chore: integrate current main for assignment contracts
  • 4abe550 test(mcp): isolate mocks and acknowledge cancellation boundaries
  • 8f7b403 chore: integrate current main and retain isolated test ownership

📊 Changes

7 files changed (+747 additions, -6 deletions)

View changed files

➕ src/application/javascript/JavaScriptSemanticGraphAssignedValues.ts (+196 -0)
📝 src/application/javascript/JavaScriptSemanticGraphObjectProjection.ts (+108 -3)
➕ src/application/javascript/JavaScriptSemanticGraphPropertyObjects.test.ts (+196 -0)
📝 src/application/javascript/JavaScriptSemanticGraphValueProjection.ts (+94 -1)
📝 src/domain/javascript/javascriptSemanticDerivedAnalysis.ts (+79 -2)
📝 src/domain/javascript/javascriptSemanticIr.ts (+10 -0)
➕ tests/boundary/cli/javascriptPropertyObjectModeling.test.ts (+64 -0)

📄 Description

Summary

Models an object literal assigned to a property after declaration (Game.config = { ACCEL: 0.001 }) the same way an initializer object is modelled, so literals inside it become traceable. Fixes #6192.

  • The assignment-flow IR (from #6206) now carries the statically evaluated container for an unconditional top-level assignment of a literal object/array into a static property path (assignedValue: receiver name, property path, evaluated value).
  • A shared projection helper (foldedAssignedContainerValues) applies two filters and both the value and object projections consume it: repeated top-level literal writers keep only the last value; any other write intersecting the path — conditional, inside a function or loop, or a non-literal right-hand side — leaves the value unknown, preserving the existing mutation semantics.
  • Value projection materializes the ancestor slot chain so the container slot reports object/array status; object projection folds the value into the map reads resolve against, which is what lets read:/config/ACCEL resolve.

Evidence

The issue's fixtures, through the compiled CLI on this branch (found = the full chain 0.001 → ACCEL → read:/config/ACCEL → return):

fixture slots trace(0.001)
function Game() {} + assignment config:object, config.ACCEL:literal found (control parity)
const Game = {} + assignment config:object, config.ACCEL:literal found (control parity)
initializer control unchanged found
conditional assignment unknown partial (unchanged)
assignment inside a function unknown partial (unchanged)

Also verified: later non-literal writer keeps unknown; repeated literal assignments fold to the last value; nested paths (App.settings.limits.retries) and arrays (App.list = [7, 8]) model correctly.

Testing

  • JavaScriptSemanticGraphPropertyObjects.test.ts — 9/9 (function/assigned receivers, control parity, conditional/in-function/loop guards, non-literal writer, last-write-wins, nested paths and arrays)
  • javascriptPropertyObjectModeling.test.ts (compiled CLI) — both issue fixtures through analyze-javascript-application + trace-javascript-semantics to found with the read site and return reached
  • Regression: src/application/javascript/ + the #6206 CLI acceptance 572/572; src/domain/javascript/ + tests/evaluation/ 4316 passed / 2 pre-existing skips; tsc --noEmit, knip, formatting and lint clean

Author readiness

Human owner: @IvenKooLab

  • 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.

🔄 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/6972 **Author:** [@IvenKooLab](https://github.com/IvenKooLab) **Created:** 10/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/javascript-property-object-modeling` --- ### 📝 Commits (10+) - [`d278ec9`](https://github.com/morluto/rea/commit/d278ec9981f112462ca9d6a77a4caa2caa9855d9) feat(javascript): link assignment right-hand sides to their writes - [`5554589`](https://github.com/morluto/rea/commit/55545893fb37225eab8efdf581a1ec33dd4391a7) Merge remote-tracking branch 'upstream/main' into feat/javascript-assignment-flow - [`b25895f`](https://github.com/morluto/rea/commit/b25895f9522a3432f0c2f9dfd2fc3e819510298f) chore: integrate current main for assignment analysis - [`3224aca`](https://github.com/morluto/rea/commit/3224acae383501c5559c43ef521220406f3fee5d) fix(javascript): preserve computed key assignment ownership - [`8bf2b57`](https://github.com/morluto/rea/commit/8bf2b57e6937b277388c489ba54c8c45e3981965) test(javascript): retain nested callback assignment ownership - [`0fbd13b`](https://github.com/morluto/rea/commit/0fbd13b77b15c6906138eaac232456d3a2141ac5) chore: integrate current main for JavaScript assignments - [`d55a0b3`](https://github.com/morluto/rea/commit/d55a0b3982d05bdf6cddc84fc5d064fc172f20f4) docs(javascript): record assignment influence verification - [`513b637`](https://github.com/morluto/rea/commit/513b63735ab8abcef3c75e4b1566f83ced39d9a0) chore: integrate current main for assignment contracts - [`4abe550`](https://github.com/morluto/rea/commit/4abe5509404ea459a0270d5fe30536961e42f97f) test(mcp): isolate mocks and acknowledge cancellation boundaries - [`8f7b403`](https://github.com/morluto/rea/commit/8f7b403a0b1349700a819eda373d3dcac0e6133f) chore: integrate current main and retain isolated test ownership ### 📊 Changes **7 files changed** (+747 additions, -6 deletions) <details> <summary>View changed files</summary> ➕ `src/application/javascript/JavaScriptSemanticGraphAssignedValues.ts` (+196 -0) 📝 `src/application/javascript/JavaScriptSemanticGraphObjectProjection.ts` (+108 -3) ➕ `src/application/javascript/JavaScriptSemanticGraphPropertyObjects.test.ts` (+196 -0) 📝 `src/application/javascript/JavaScriptSemanticGraphValueProjection.ts` (+94 -1) 📝 `src/domain/javascript/javascriptSemanticDerivedAnalysis.ts` (+79 -2) 📝 `src/domain/javascript/javascriptSemanticIr.ts` (+10 -0) ➕ `tests/boundary/cli/javascriptPropertyObjectModeling.test.ts` (+64 -0) </details> ### 📄 Description ## Summary Models an object literal assigned to a property after declaration (`Game.config = { ACCEL: 0.001 }`) the same way an initializer object is modelled, so literals inside it become traceable. Fixes #6192. - The assignment-flow IR (from #6206) now carries the statically evaluated container for an **unconditional top-level** assignment of a literal object/array into a static property path (`assignedValue`: receiver name, property path, evaluated value). - A shared projection helper (`foldedAssignedContainerValues`) applies two filters and both the value and object projections consume it: repeated top-level literal writers keep only the **last** value; any **other** write intersecting the path — conditional, inside a function or loop, or a non-literal right-hand side — leaves the value unknown, preserving the existing mutation semantics. - Value projection materializes the ancestor slot chain so the container slot reports object/array status; object projection folds the value into the map reads resolve against, which is what lets `read:/config/ACCEL` resolve. ## Evidence The issue's fixtures, through the compiled CLI on this branch (`found` = the full chain `0.001 → ACCEL → read:/config/ACCEL → return`): | fixture | slots | trace(0.001) | | --- | --- | --- | | `function Game() {}` + assignment | `config:object`, `config.ACCEL:literal` | **found** (control parity) | | `const Game = {}` + assignment | `config:object`, `config.ACCEL:literal` | **found** (control parity) | | `initializer` control | unchanged | found | | conditional assignment | unknown | partial (unchanged) | | assignment inside a function | unknown | partial (unchanged) | Also verified: later non-literal writer keeps `unknown`; repeated literal assignments fold to the last value; nested paths (`App.settings.limits.retries`) and arrays (`App.list = [7, 8]`) model correctly. ## Testing - `JavaScriptSemanticGraphPropertyObjects.test.ts` — 9/9 (function/assigned receivers, control parity, conditional/in-function/loop guards, non-literal writer, last-write-wins, nested paths and arrays) - `javascriptPropertyObjectModeling.test.ts` (compiled CLI) — both issue fixtures through `analyze-javascript-application` + `trace-javascript-semantics` to `found` with the read site and return reached - Regression: `src/application/javascript/` + the #6206 CLI acceptance 572/572; `src/domain/javascript/` + `tests/evaluation/` 4316 passed / 2 pre-existing skips; `tsc --noEmit`, `knip`, formatting and lint clean ## Author readiness Human owner: @IvenKooLab - [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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7486
No description provided.