[PR #3822] [MERGED] fix(javascript): keep the request endpoint on a uniquely consumed response #5924

Closed
opened 2026-10-31 01:10:29 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3822
Author: @kaoru0822-kitauji
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/3328-response-endpoints


📝 Commits (2)

  • 6c5b55c fix(javascript): keep the request endpoint on a uniquely consumed response
  • b8bd436 fix(javascript): drop the endpoint when another write can replace the response

📊 Changes

2 files changed (+73 additions, -8 deletions)

View changed files

➕ src/domain/javascript/javascriptSemanticAnalysis.response_endpoints.test.ts (+59 -0)
📝 src/domain/javascript/javascriptSemanticDataEffects.ts (+14 -8)

📄 Description

Fixes #3328

Root cause

collectResponseConsumers (javascriptSemanticDataEffects.ts) creates a response-consumer operation for each json() / text() / arrayBuffer() call on a request's result binding. It already decided when the consumer is uniquely linked to one request (resolution: "complete"), but it always emitted endpoint: null. The semantic graph's response node, and its consumed-by edge marked resolved, therefore lost the request's literal endpoint, contrary to docs/javascript-application-workflows.md ("request and response nodes keep the exact endpoint").

Change

Under the same uniqueness condition that already makes the consumer complete (one linked request, consumed through that request's own result binding rather than a projected one), the response takes that request's endpoint. Ambiguous consumers, such as a binding reassigned to different requests, keep endpoint: null and stay partial. The duplicated uniqueness expression is now one uniqueRequest value that drives both endpoint and resolution.

Validation

The issue's repro and control (public CLI, semantic_graph):

source main this PR
fetch("…/data") → response.json() response endpoint null https://example.test/data
two fetches → a.json(), b.text() both null …/a and …/b respectively

Tests:

  • New javascriptSemanticAnalysis.response_endpoints.test.ts checks that uniquely consumed responses keep their request's endpoint (complete), and that a binding reassigned between two fetches leaves the consumer null/partial. The first test fails on main; I checked by restoring main's producer.
  • 159 JavaScript/domain test files pass (2,970 tests), as do 8 endpoint-trace and workflow boundary/acceptance files (70 tests: semantic trace Evidence, retained application Evidence, agent known answers, literal payloads, mutation presence, export shape, application workflow, event payload) and npm run check:fast.

Real application / cost: Notion app.asar (--integrity-policy record-and-continue): 125,791,536 → 125,791,532 B, 41.4 s vs 41.7 s. Its retained semantic graph contains no response nodes, so nothing changes there. The change is one property assignment per consumer; function fingerprints only record whether network effects exist, so they are unaffected.

🤖 Generated with Claude Code


🔄 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/3822 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/3328-response-endpoints` --- ### 📝 Commits (2) - [`6c5b55c`](https://github.com/morluto/rea/commit/6c5b55c9c333a977c62ce2f7659c5453579942a6) fix(javascript): keep the request endpoint on a uniquely consumed response - [`b8bd436`](https://github.com/morluto/rea/commit/b8bd43698271d490b7cb8e325d70d679c73eeef1) fix(javascript): drop the endpoint when another write can replace the response ### 📊 Changes **2 files changed** (+73 additions, -8 deletions) <details> <summary>View changed files</summary> ➕ `src/domain/javascript/javascriptSemanticAnalysis.response_endpoints.test.ts` (+59 -0) 📝 `src/domain/javascript/javascriptSemanticDataEffects.ts` (+14 -8) </details> ### 📄 Description Fixes #3328 ## Root cause `collectResponseConsumers` (`javascriptSemanticDataEffects.ts`) creates a `response-consumer` operation for each `json()` / `text()` / `arrayBuffer()` call on a request's result binding. It already decided when the consumer is uniquely linked to one request (`resolution: "complete"`), but it always emitted `endpoint: null`. The semantic graph's response node, and its `consumed-by` edge marked `resolved`, therefore lost the request's literal endpoint, contrary to `docs/javascript-application-workflows.md` ("request and response nodes keep the exact endpoint"). ## Change Under the same uniqueness condition that already makes the consumer `complete` (one linked request, consumed through that request's own result binding rather than a projected one), the response takes that request's endpoint. Ambiguous consumers, such as a binding reassigned to different requests, keep `endpoint: null` and stay `partial`. The duplicated uniqueness expression is now one `uniqueRequest` value that drives both `endpoint` and `resolution`. ## Validation **The issue's repro and control** (public CLI, `semantic_graph`): | source | `main` | this PR | |---|---|---| | `fetch("…/data")` → `response.json()` | response endpoint `null` | `https://example.test/data` | | two fetches → `a.json()`, `b.text()` | both `null` | `…/a` and `…/b` respectively | **Tests:** - New `javascriptSemanticAnalysis.response_endpoints.test.ts` checks that uniquely consumed responses keep their request's endpoint (`complete`), and that a binding reassigned between two fetches leaves the consumer `null`/`partial`. The first test **fails on `main`**; I checked by restoring main's producer. - 159 JavaScript/domain test files pass (2,970 tests), as do 8 endpoint-trace and workflow boundary/acceptance files (70 tests: semantic trace Evidence, retained application Evidence, agent known answers, literal payloads, mutation presence, export shape, application workflow, event payload) and `npm run check:fast`. **Real application / cost:** Notion `app.asar` (`--integrity-policy record-and-continue`): 125,791,536 → 125,791,532 B, 41.4 s vs 41.7 s. Its retained semantic graph contains no response nodes, so nothing changes there. The change is one property assignment per consumer; function fingerprints only record whether network effects exist, so they are unaffected. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:10:29 +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#5924
No description provided.