[PR #3292] [CLOSED] fix(mcp): include every retained inventory substep in prompt completion #5704

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3292
Author: @sx4im
Created: 10/14/2026
Status: ❌ Closed

Base: main ← Head: fix/3220-prompt-completion-substep-inventories


📝 Commits (4)

  • 1dbf7a2 fix(mcp): include every retained inventory substep in prompt completion
  • bdd3609 test(mcp): cover malformed inventory substeps in prompt completion
  • 2d4c645 fix(mcp): guard fixture substep access in malformed-inventory test
  • 8a074f3 style(mcp): format malformed-inventory test per oxfmt

📊 Changes

2 files changed (+113 additions, -10 deletions)

View changed files

📝 src/server/promptCompletion.ts (+18 -10)
📝 tests/boundary/mcp/promptCompletion.test.ts (+95 -0)

📄 Description

Summary

Prompt completion for an imported artifact inspection only read the first inventory substep, so identifiers from later retained substeps never appeared. This collects candidates from every completed substep instead. Fixes #3220.

Problem and expected behavior

Importing an Evidence bundle with one inspection holding two inventory substeps offered only the first inventory's manifest and occurrence IDs in guided prompt completion. docs/mcp-prompts.md promises every matching value, sorted and deduplicated.

Change and scope

src/server/promptCompletion.ts: gather candidate identifiers from all retained substeps rather than substeps[0]. Malformed inventories are still skipped per-substep (safeParse + continue), so invalid payloads never yield candidates. Out of scope: coverage counting and producer output (already single-substep).

Scope decision: ordinary fix within existing boundaries; not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: MCP prompt completion projection; no contract change.

  • Contribution scope fit and linked maintainer decision: not applicable (ordinary fix).

  • CLI and MCP/tool-catalog contract: none.

  • Provider, bridge, target-format, or platform compatibility: none.

  • Evidence, artifact, provenance, or reconstruction contract: none.

  • Target selection, authority, upstream behavior, and cleanup details: not applicable.

  • Generated metadata, package, or installation impact: none.

  • Read existing files or captured data.

  • Launch or attach to a process.

  • Inject instrumentation or run scripts/code.

  • Change process memory, registers, files, or configuration.

  • Contact network services.

  • Recover protected code or work around protections.

  • Documentation or usability only; no target interaction.

  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/mcp/promptCompletion.test.ts — new case with a two-substep imported inspection. It fails before the fix (only the first manifest ID is offered) and passes after.

  • Base reproduction: the new test reproduces the exact reported symptom on the base revision.

  • User-visible CLI/MCP output: not applicable (read-only projection over the evidence ledger).

  • Remaining proof gaps: no real-provider run; completion here is a local session projection.

  • 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:focused -- tests/boundary/mcp/promptCompletion.test.ts — 7/7 pass
  • npm run test:focused -- tests/boundary/mcp/promptMcp.test.ts — 9/9 pass
  • npm run test:focused -- tests/boundary/mcp/retainedApplicationEvidenceMcp.test.ts — 5/5 pass
  • npm run test:focused -- tests/boundary/mcp/applicationEvidenceMcp.test.ts — 1/1 pass
  • npm run verify:test-discovery — 1261 test files discovered exactly once
  • npm run lint — 0 errors
  • npx oxfmt --check on touched files — clean
  • npm run typecheck (tsc --noEmit) — 0 errors

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable (local session projection).
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: read-only identifier projection; no new authority.

Author readiness

Human owner: @sx4im

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff 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/3292 **Author:** [@sx4im](https://github.com/sx4im) **Created:** 10/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/3220-prompt-completion-substep-inventories` --- ### 📝 Commits (4) - [`1dbf7a2`](https://github.com/morluto/rea/commit/1dbf7a2fc300879e772afb653898fe0d6b259d0f) fix(mcp): include every retained inventory substep in prompt completion - [`bdd3609`](https://github.com/morluto/rea/commit/bdd3609add9bac5014101b8b3c49017df3e8b551) test(mcp): cover malformed inventory substeps in prompt completion - [`2d4c645`](https://github.com/morluto/rea/commit/2d4c64583246ad0e7678144d7d8a82c9c1ff3c00) fix(mcp): guard fixture substep access in malformed-inventory test - [`8a074f3`](https://github.com/morluto/rea/commit/8a074f369df5acb8dc307c903343b8f2cbd418e5) style(mcp): format malformed-inventory test per oxfmt ### 📊 Changes **2 files changed** (+113 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `src/server/promptCompletion.ts` (+18 -10) 📝 `tests/boundary/mcp/promptCompletion.test.ts` (+95 -0) </details> ### 📄 Description ## Summary Prompt completion for an imported artifact inspection only read the first inventory substep, so identifiers from later retained substeps never appeared. This collects candidates from every completed substep instead. Fixes #3220. ## Problem and expected behavior Importing an Evidence bundle with one inspection holding two inventory substeps offered only the first inventory's manifest and occurrence IDs in guided prompt completion. `docs/mcp-prompts.md` promises every matching value, sorted and deduplicated. ## Change and scope `src/server/promptCompletion.ts`: gather candidate identifiers from all retained substeps rather than `substeps[0]`. Malformed inventories are still skipped per-substep (`safeParse` + `continue`), so invalid payloads never yield candidates. Out of scope: coverage counting and producer output (already single-substep). Scope decision: ordinary fix within existing boundaries; not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: MCP prompt completion projection; no contract change. - Contribution scope fit and linked maintainer decision: not applicable (ordinary fix). - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: none. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details: not applicable. - Generated metadata, package, or installation impact: none. - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: `tests/boundary/mcp/promptCompletion.test.ts` — new case with a two-substep imported inspection. It fails before the fix (only the first manifest ID is offered) and passes after. - Base reproduction: the new test reproduces the exact reported symptom on the base revision. - User-visible CLI/MCP output: not applicable (read-only projection over the evidence ledger). - Remaining proof gaps: no real-provider run; completion here is a local session projection. - [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:focused -- tests/boundary/mcp/promptCompletion.test.ts` — 7/7 pass - `npm run test:focused -- tests/boundary/mcp/promptMcp.test.ts` — 9/9 pass - `npm run test:focused -- tests/boundary/mcp/retainedApplicationEvidenceMcp.test.ts` — 5/5 pass - `npm run test:focused -- tests/boundary/mcp/applicationEvidenceMcp.test.ts` — 1/1 pass - `npm run verify:test-discovery` — 1261 test files discovered exactly once - `npm run lint` — 0 errors - `npx oxfmt --check` on touched files — clean - `npm run typecheck` (`tsc --noEmit`) — 0 errors ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable (local session projection). - Package or release metadata impact: none. - Security, privacy, process, or containment review: read-only identifier projection; no new authority. ## Author readiness Human owner: @sx4im - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [ ] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff 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:08:47 +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#5704
No description provided.