Repository navigation
fix(semantics): link wrapped arrow Promise returns - #794
kaoru0822-kitauji wants to merge 2 commits into
Conversation
|
@codex review |
N0zoM1z0
left a comment
There was a problem hiding this comment.
Source review passed on head9830ad40e8. Direct returned Promise ownership already unwraps TS syntax; using the original arrow-body range now selects the exact existing return-site identity, while the producer location stays unchanged. Wrapped, nested-arrow, aggregate/chained and negative ownership controls passed in the focused suites. All19 exact-head hosted checks are green. No blocking source finding. Integration is currently blocked by a test-only conflict with merged#764 in JavaScriptSemanticGraphBuilder.test.ts; update that branch and rerun relevant checks before merge. No conflict resolution was performed in this review.
Resolve the test-only conflict with #764 by retaining both appended test blocks unchanged. Keep the wrapped Promise return correction and domain regressions unchanged. Validation: 302 semantic and graph tests; 11 CLI acceptance tests; npm run check, build:cached, jscpd, scan:todos; independent conflict-resolution review.
|
Superseded by #815, which integrated this change and has now merged (3af3811). Thanks @kaoru0822-kitauji for the fix and tests — much appreciated! |
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 itsreturnSiteIdis null. Consequently the semantic graph omitsreturns-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
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-taskrelation throughqueryJavaScriptSemanticGraph.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.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