[PR #794] [CLOSED] fix(semantics): link wrapped arrow Promise returns #2243

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

📋 Pull Request Information

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

Base: main ← Head: fix/promise-arrow-return-range


📝 Commits (2)

  • 9830ad4 fix(semantics): link wrapped arrow Promise returns
  • 72e4f11 chore: merge main and preserve semantic regression tests

📊 Changes

3 files changed (+127 additions, -1 deletions)

View changed files

📝 src/application/JavaScriptSemanticGraphBuilder.test.ts (+38 -0)
📝 src/domain/javascriptSemanticAnalysis.promise_ownership.test.ts (+88 -0)
📝 src/domain/javascriptSemanticPromises.ts (+1 -1)

📄 Description

Summary

Restore the return-site link for an expression-bodied arrow that directly returns a Promise through a TypeScript wrapper. This is a focused follow-up to #758; no separate issue is linked.

Problem and expected behavior

const run = () => (Promise.resolve(1) as Promise<number>); is correctly classified as returned ownership, but its returnSiteId is null. Consequently the semantic graph omits returns-task.

The ownership detector unwraps the body to identify the producer. Return collection records the original arrow body range, including its wrapper. Looking up the narrower producer range cannot find that existing return site.

Change and scope

Use the original arrow-body range for the return-site lookup after direct ownership has already been established. This is one production-line change. Promise recognition, ownership boundaries, producer locations and return-site identities are unchanged.

Contract and boundary impact

  • Semantic owner and earliest changed stage: pure JavaScript Promise ownership projection.
  • CLI and MCP/tool-catalog contract: no schema/catalog changes; the existing graph relation can now be emitted for the recovered return site.
  • Provider, bridge, target-format, or platform compatibility: no provider or runtime execution changes.
  • Evidence, artifact, provenance, or reconstruction contract: uses the existing exact return-site identity and source range.
  • Process execution, authorization, cleanup, or containment impact: none.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • On d2aed17, the completed two-file regression suite has 16 failures and 35 passing controls. Failures are missing return-site IDs and graph relations.

  • Fixed focused suites pass 70 tests, also rerun after fast-forwarding to b62931f.

  • Covers as, satisfies, non-null and nested wrappers; nested arrows; constructor, aggregate and chained producers; bare/parenthesized bodies and explicit return statements.

  • Enclosing calls, arrays, objects, conditionals and sequences stay unknown; awaited producers do not gain a return link.

  • Graph tests traverse the actual returns-task relation through queryJavaScriptSemanticGraph.

  • This is source-analysis and graph/query proof, not real JavaScript execution or CLI/MCP end-to-end verification.

  • 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:local -- src/domain/javascriptSemanticAnalysis.promise_ownership.test.ts src/application/JavaScriptSemanticGraphBuilder.test.ts src/domain/javascriptSemanticAnalysis.calls.test.ts src/domain/javascriptSemanticAnalysis.function_names.test.ts — 70 passed.
  • npm run check — passed, 125 existing warnings and zero errors.
  • npm run build:cached — passed.
  • npm run jscpd, npm run scan:todos, git diff --check — passed.
  • Node 24.19.0/npm 11.9.0, exact locked dependency versions.

Compatibility, safety, and release

No migrations or package metadata changes. No real Hopper/Ghidra/browser workflow was run or required for this pure static-analysis correction. Source is not executed. Independent review verified the final three-file patch; AI assisted implementation and testing.

Review checklist

  • One focused outcome and conventional title.
  • Related PR and reason for no separate issue are stated.
  • Regression and negative controls cover changed behavior.
  • No owning schema or generated metadata changes are needed.
  • Final diff checked for unrelated cleanup and unsupported claims.

🔄 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/794 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/promise-arrow-return-range` --- ### 📝 Commits (2) - [`9830ad4`](https://github.com/morluto/rea/commit/9830ad40e835ba16d0fe28f2e5843be8f2aa56be) fix(semantics): link wrapped arrow Promise returns - [`72e4f11`](https://github.com/morluto/rea/commit/72e4f1120128c871c070f9dce6ae9bc8af7d8bf6) chore: merge main and preserve semantic regression tests ### 📊 Changes **3 files changed** (+127 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/application/JavaScriptSemanticGraphBuilder.test.ts` (+38 -0) 📝 `src/domain/javascriptSemanticAnalysis.promise_ownership.test.ts` (+88 -0) 📝 `src/domain/javascriptSemanticPromises.ts` (+1 -1) </details> ### 📄 Description ## Summary Restore the return-site link for an expression-bodied arrow that directly returns a Promise through a TypeScript wrapper. This is a focused follow-up to #758; no separate issue is linked. ## Problem and expected behavior `const run = () => (Promise.resolve(1) as Promise<number>);` is correctly classified as returned ownership, but its `returnSiteId` is null. Consequently the semantic graph omits `returns-task`. The ownership detector unwraps the body to identify the producer. Return collection records the original arrow body range, including its wrapper. Looking up the narrower producer range cannot find that existing return site. ## Change and scope Use the original arrow-body range for the return-site lookup after direct ownership has already been established. This is one production-line change. Promise recognition, ownership boundaries, producer locations and return-site identities are unchanged. ## Contract and boundary impact - Semantic owner and earliest changed stage: pure JavaScript Promise ownership projection. - CLI and MCP/tool-catalog contract: no schema/catalog changes; the existing graph relation can now be emitted for the recovered return site. - Provider, bridge, target-format, or platform compatibility: no provider or runtime execution changes. - Evidence, artifact, provenance, or reconstruction contract: uses the existing exact return-site identity and source range. - Process execution, authorization, cleanup, or containment impact: none. - Generated metadata, package, or installation impact: none. ## Evidence and regression coverage - On d2aed17, the completed two-file regression suite has 16 failures and 35 passing controls. Failures are missing return-site IDs and graph relations. - Fixed focused suites pass 70 tests, also rerun after fast-forwarding to b62931f. - Covers `as`, `satisfies`, non-null and nested wrappers; nested arrows; constructor, aggregate and chained producers; bare/parenthesized bodies and explicit return statements. - Enclosing calls, arrays, objects, conditionals and sequences stay unknown; awaited producers do not gain a return link. - Graph tests traverse the actual `returns-task` relation through `queryJavaScriptSemanticGraph`. - This is source-analysis and graph/query proof, not real JavaScript execution or CLI/MCP end-to-end verification. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:local -- src/domain/javascriptSemanticAnalysis.promise_ownership.test.ts src/application/JavaScriptSemanticGraphBuilder.test.ts src/domain/javascriptSemanticAnalysis.calls.test.ts src/domain/javascriptSemanticAnalysis.function_names.test.ts` — 70 passed. - `npm run check` — passed, 125 existing warnings and zero errors. - `npm run build:cached` — passed. - `npm run jscpd`, `npm run scan:todos`, `git diff --check` — passed. - Node 24.19.0/npm 11.9.0, exact locked dependency versions. ## Compatibility, safety, and release No migrations or package metadata changes. No real Hopper/Ghidra/browser workflow was run or required for this pure static-analysis correction. Source is not executed. Independent review verified the final three-file patch; AI assisted implementation and testing. ## Review checklist - [x] One focused outcome and conventional title. - [x] Related PR and reason for no separate issue are stated. - [x] Regression and negative controls cover changed behavior. - [x] No owning schema or generated metadata changes are needed. - [x] Final diff checked for unrelated cleanup and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:16:10 +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#2243
No description provided.