[PR #758] [MERGED] fix(semantics): preserve direct promise ownership boundaries #2221

Closed
opened 2026-10-16 21:15:53 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/758
Author: @rudycelekli
Created: 10/6/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @morluto

Base: main ← Head: fix/promise-direct-ownership-20261006


📝 Commits (1)

  • e7d3dd3 fix(semantics): preserve direct promise ownership boundaries

📊 Changes

3 files changed (+124 additions, -8 deletions)

View changed files

📝 src/application/JavaScriptSemanticGraphBuilder.test.ts (+24 -0)
➕ src/domain/javascriptSemanticAnalysis.promise_ownership.test.ts (+61 -0)
📝 src/domain/javascriptSemanticPromises.ts (+39 -8)

📄 Description

Summary

Preserve the direct value boundary when recovering static Promise ownership. A Promise nested inside consume(Promise.resolve(1)) previously acquired ownership from the enclosing assignment, await, or return, even when consume returns a scalar. That produced resolved owns, awaits, or returns-task relations for the wrong value.

Assignment, await and return now require the Promise operation itself after transparent syntax wrappers. Chaining requires a direct receiver, and aggregation requires a direct array element. Intervening calls remain unknown. This is bounded static syntax recovery, not a claim of complete transitive Promise ownership.

Verification

  • Actual built public analyze-javascript-application over eight local source scenarios: the three indirect ownership cases become unknown; direct assignment, await, return, chaining and aggregation remain correct.
  • Native JavaScript consume(Promise.resolve(1)) fixture returns scalar 7.
  • Upstream regression attempt: 9 fail, 13 pass. Final relevant semantic/graph suites: 63 pass across 5 files, including 14 ownership controls and graph relation assertions.
  • npm run build:cached, npm run check, npm run check:fast pass with 124 lint warnings and zero errors.
  • An initial local build exposed an optional AST return argument type error; it was corrected before these final gates.
  • No real Hopper/Ghidra verification performed: this affects inert JavaScript semantic recovery only. No schema or public signature changes.

Codex assisted on behalf of @rudycelekli. Signed DCO source received independent review before publication. Hosted CI is tracked separately.


🔄 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/758 **Author:** [@rudycelekli](https://github.com/rudycelekli) **Created:** 10/6/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/promise-direct-ownership-20261006` --- ### 📝 Commits (1) - [`e7d3dd3`](https://github.com/morluto/rea/commit/e7d3dd3158214de79d1b1c8d12ab0a71c3c1b1a5) fix(semantics): preserve direct promise ownership boundaries ### 📊 Changes **3 files changed** (+124 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src/application/JavaScriptSemanticGraphBuilder.test.ts` (+24 -0) ➕ `src/domain/javascriptSemanticAnalysis.promise_ownership.test.ts` (+61 -0) 📝 `src/domain/javascriptSemanticPromises.ts` (+39 -8) </details> ### 📄 Description ## Summary Preserve the direct value boundary when recovering static Promise ownership. A Promise nested inside `consume(Promise.resolve(1))` previously acquired ownership from the enclosing assignment, await, or return, even when `consume` returns a scalar. That produced resolved `owns`, `awaits`, or `returns-task` relations for the wrong value. Assignment, await and return now require the Promise operation itself after transparent syntax wrappers. Chaining requires a direct receiver, and aggregation requires a direct array element. Intervening calls remain unknown. This is bounded static syntax recovery, not a claim of complete transitive Promise ownership. ## Verification - Actual built public `analyze-javascript-application` over eight local source scenarios: the three indirect ownership cases become unknown; direct assignment, await, return, chaining and aggregation remain correct. - Native JavaScript `consume(Promise.resolve(1))` fixture returns scalar 7. - Upstream regression attempt: 9 fail, 13 pass. Final relevant semantic/graph suites: 63 pass across 5 files, including 14 ownership controls and graph relation assertions. - `npm run build:cached`, `npm run check`, `npm run check:fast` pass with 124 lint warnings and zero errors. - An initial local build exposed an optional AST return argument type error; it was corrected before these final gates. - No real Hopper/Ghidra verification performed: this affects inert JavaScript semantic recovery only. No schema or public signature changes. Codex assisted on behalf of @rudycelekli. Signed DCO source received independent review before publication. Hosted CI is tracked separately. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:15: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#2221
No description provided.