[PR #2758] [MERGED] fix(native): keep bounded trace edges and depth consistent #5369

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2758
Author: @IvenKooLab
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @morluto

Base: main ← Head: fix/native-bounded-trace


📝 Commits (2)

  • db570a8 fix(native): keep bounded trace edges and depth consistent
  • 6d2224c Merge remote-tracking branch 'upstream/main' into fix/native-bounded-trace

📊 Changes

2 files changed (+63 additions, -4 deletions)

View changed files

📝 src/domain/native/nativeInvestigationGraph.test.ts (+55 -0)
📝 src/domain/native/nativeInvestigationGraph.ts (+8 -4)

📄 Description

Summary

Keep node-budget admission and retained edges consistent in traceNativeInvestigationGraph, and report the depth of retained nodes even when a later sibling exhausts a budget before those nodes are expanded.

Problem and expected behavior

With valid input graph a -> b, max_nodes: 1 previously returned nodes: [a] but retained the resolved edge a -> b. The same issue affected backward tracing. On a branching graph a -> b and a -> c, a node or edge bound could stop processing while b was queued, returning nodes: [a, b] with reached_depth: 0.

A node bound should prevent retaining an edge to the node that could not be admitted. reached_depth should describe reached, retained nodes, rather than only nodes already dequeued for expansion.

No issue is linked: these domain regressions were independently reproduced against 2995ec6.

Change and scope

Check capacity for an unvisited destination before committing its edge. Edges to already visited nodes still survive when the node budget is full. Update depth when a node is admitted to the trace.

This is a focused correctness fix within existing static-analysis contribution scope; a new-provider or new-capability maintainer scope decision is not applicable.

Contract and boundary impact

  • Semantic owner: domain graph traversal, at node/edge admission.
  • CLI/MCP/tool catalog: no input/output schema changes; correct existing edges and reached_depth values at budget boundaries.
  • Provider/bridge/platform: no provider, bridge, target-format, or platform-specific changes.
  • Evidence/provenance: retained edges keep their Evidence; omitted node-bound edges are marked by existing truncation state and reason. Existing missing-target diagnostics remain unchanged.
  • Authority and cleanup: operates on an already supplied graph; no added target operations, process launch, mutation, resource acquisition, or cleanup behavior.
  • Generated metadata/packages/installation: no changes.

Expected effects:

  • Read existing files or captured data (the supplied graph).

Evidence and regression coverage

  • Forward and backward max_nodes: 1 cases return only the seed and no edge to a rejected node.
  • Branching node- and edge-bound cases return nodes: [a, b], one retained edge, and reached_depth: 1.
  • Cycle edges to already admitted nodes remain present at a full node budget.
  • Four new cases fail against the original domain implementation; the new cycle guard and seven existing domain cases pass there.
  • Existing native UI composition, unresolved dispatch, depth bounds, cancellation, and dispatch joins are covered by the selected suites.

Representative node-bound result, showing the corrected fields:

{
  "nodes": [{ "id": "a" }],
  "edges": [],
  "reached_depth": 0,
  "truncated": true,
  "reason": "max_nodes_reached"
}

Other unchanged node and trace fields are omitted for readability. Reproduction is domain-level; an independently failing real CLI/MCP/provider workflow is not claimed.

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity and source provenance of retained facts remain preserved.
  • Budget truncation and uncertainty remain visible.

Validation performed

  • Node 24.18.0, npm 11.16.0, locked dependencies installed with npm ci.
  • npm run test:local -- src/domain/native/nativeInvestigationGraph.test.ts src/application/native/EnhancedNativeInvestigation.test.ts — 28 tests passed.
  • npm run check — typecheck, lint, format, knip, package metadata, module boundaries, and architecture guards passed.
  • git diff --check — passed.

Compatibility, safety, and release

No breaking schema change, migration, package/release metadata change, or new authority. Real Hopper/Ghidra verification was not run because the engines are unavailable on this host. This PR makes no real-provider compatibility expansion or performance claim.

Before merge

  • Concrete problem, one focused outcome, Conventional Commit title.
  • Material scope and authority questions for this routine domain fix resolved.
  • Reason for not linking an issue stated above.
  • Changed behavior and relevant boundary cases tested.
  • No docs/contracts/generated metadata change required.
  • Representative corrected trace fields included.
  • Final diff checked for secrets, 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/2758 **Author:** [@IvenKooLab](https://github.com/IvenKooLab) **Created:** 10/13/2026 **Status:** ✅ Merged **Merged:** 10/13/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/native-bounded-trace` --- ### 📝 Commits (2) - [`db570a8`](https://github.com/morluto/rea/commit/db570a8ccb41928fef6e041bee4ad73054b3e33c) fix(native): keep bounded trace edges and depth consistent - [`6d2224c`](https://github.com/morluto/rea/commit/6d2224c9739493dfae1bb746e0efbc0233cf9c2a) Merge remote-tracking branch 'upstream/main' into fix/native-bounded-trace ### 📊 Changes **2 files changed** (+63 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/native/nativeInvestigationGraph.test.ts` (+55 -0) 📝 `src/domain/native/nativeInvestigationGraph.ts` (+8 -4) </details> ### 📄 Description ## Summary Keep node-budget admission and retained edges consistent in `traceNativeInvestigationGraph`, and report the depth of retained nodes even when a later sibling exhausts a budget before those nodes are expanded. ## Problem and expected behavior With valid input graph `a -> b`, `max_nodes: 1` previously returned `nodes: [a]` but retained the resolved edge `a -> b`. The same issue affected backward tracing. On a branching graph `a -> b` and `a -> c`, a node or edge bound could stop processing while `b` was queued, returning `nodes: [a, b]` with `reached_depth: 0`. A node bound should prevent retaining an edge to the node that could not be admitted. `reached_depth` should describe reached, retained nodes, rather than only nodes already dequeued for expansion. No issue is linked: these domain regressions were independently reproduced against `2995ec6`. ## Change and scope Check capacity for an unvisited destination before committing its edge. Edges to already visited nodes still survive when the node budget is full. Update depth when a node is admitted to the trace. This is a focused correctness fix within existing static-analysis [contribution scope](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#contribution-scope); a new-provider or new-capability maintainer scope decision is not applicable. ## Contract and boundary impact - Semantic owner: domain graph traversal, at node/edge admission. - CLI/MCP/tool catalog: no input/output schema changes; correct existing `edges` and `reached_depth` values at budget boundaries. - Provider/bridge/platform: no provider, bridge, target-format, or platform-specific changes. - Evidence/provenance: retained edges keep their Evidence; omitted node-bound edges are marked by existing truncation state and reason. Existing missing-target diagnostics remain unchanged. - Authority and cleanup: operates on an already supplied graph; no added target operations, process launch, mutation, resource acquisition, or cleanup behavior. - Generated metadata/packages/installation: no changes. Expected effects: - [x] Read existing files or captured data (the supplied graph). ## Evidence and regression coverage - Forward and backward `max_nodes: 1` cases return only the seed and no edge to a rejected node. - Branching node- and edge-bound cases return `nodes: [a, b]`, one retained edge, and `reached_depth: 1`. - Cycle edges to already admitted nodes remain present at a full node budget. - Four new cases fail against the original domain implementation; the new cycle guard and seven existing domain cases pass there. - Existing native UI composition, unresolved dispatch, depth bounds, cancellation, and dispatch joins are covered by the selected suites. Representative node-bound result, showing the corrected fields: ```json { "nodes": [{ "id": "a" }], "edges": [], "reached_depth": 0, "truncated": true, "reason": "max_nodes_reached" } ``` Other unchanged node and trace fields are omitted for readability. Reproduction is domain-level; an independently failing real CLI/MCP/provider workflow is not claimed. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity and source provenance of retained facts remain preserved. - [x] Budget truncation and uncertainty remain visible. ## Validation performed - Node `24.18.0`, npm `11.16.0`, locked dependencies installed with `npm ci`. - `npm run test:local -- src/domain/native/nativeInvestigationGraph.test.ts src/application/native/EnhancedNativeInvestigation.test.ts` — 28 tests passed. - `npm run check` — typecheck, lint, format, knip, package metadata, module boundaries, and architecture guards passed. - `git diff --check` — passed. ## Compatibility, safety, and release No breaking schema change, migration, package/release metadata change, or new authority. Real Hopper/Ghidra verification was not run because the engines are unavailable on this host. This PR makes no real-provider compatibility expansion or performance claim. ## Before merge - [x] Concrete problem, one focused outcome, Conventional Commit title. - [x] Material scope and authority questions for this routine domain fix resolved. - [x] Reason for not linking an issue stated above. - [x] Changed behavior and relevant boundary cases tested. - [x] No docs/contracts/generated metadata change required. - [x] Representative corrected trace fields included. - [x] Final diff checked for secrets, 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-31 01:06:06 +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#5369
No description provided.