Skip to content

fix(artifacts): report unknown inventory traversal in inspection coverage - #5867

Merged
kaoru0822-kitauji merged 2 commits into
mainfrom
fix/artifact-inventory-unknown-coverage
Oct 21, 2026
Merged

kaoru0822-kitauji merged 2 commits into
mainfrom
fix/artifact-inventory-unknown-coverage

Conversation

@kaoru0822-kitauji

Copy link
Copy Markdown
Collaborator

What broke: inspect_artifact reported coverage.status: "complete-within-substeps" (and its summary source_complete: true with no source_coverage) even when the nested inventory reported container-entries traversal coverage unknown, e.g. a directory with an omitted FIFO.
Fix: The inspection producer derives its status from the inventory substep's typed coverage (unknown traversal → partial), and artifact summaries always carry the producer's source_coverage plus the traversal-unknown caveat.
Risk: Low. Additive summary field (already declared optional in the output schema); inspections of roots with unknown traversal now report partial instead of complete-within-substeps.

Summary

Fixes #5837. Machine consumers reading an inspection or its summary were told coverage was complete while the inventory owner had already recorded unknown traversal. Only limitation prose or a separate inventory-view call revealed the gap.

Problem and expected behavior

Trigger: open_binary + inspect_artifact (or CLI rea inspect-artifact) on a directory that contains ordinary files and a FIFO. The inventory omits the FIFO and reports coverage: {scope: "container-entries", status: "unknown"}.

Violated invariant (docs/tool-design.md): completeness must come from examined coverage, and missing coverage is unknown. A completed inventory substep does not establish exhaustive traversal.

Change and scope

  • src/domain/artifactInspection.ts: inspectionCoverage now reads the inventory substep's coverage. It previously ignored that argument and checked only omission counts, which are always zero. Unknown traversal yields the existing partial status. truncated still takes precedence for omissions.
  • src/domain/analysisView/artifactInventoryView.ts: source_coverage and the "Producer traversal coverage is unknown" unknown no longer depend on the PCK/PyInstaller-only gate, so summaries of every format read the owner's fact instead of hiding it. That gate now controls only available_hash_status_counts and the hash-unknown caveat, which keep their existing behavior. This also fixes summaries of historical inline inspections that still say complete-within-substeps.
  • docs/mcp-contracts.md: documents the summary's source_coverage and the partial mapping.

Not included: no new status enum value. partial already existed and the precise unknown stays available as source_coverage.status. source_coverage stays exactOptional in the view schema so that older retained view Evidence still parses.

Contribution scope: ordinary fix within existing boundaries; maintainer scope decision not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: inventory producer owns traversal coverage (unchanged); inspection coverage composition in src/domain/artifactInspection.ts is the earliest changed stage.

  • Contribution scope fit and linked maintainer decision: existing artifact inspection boundary; not applicable.

  • CLI and MCP/tool-catalog contract: no schema change. inspect_artifact can now emit the already-declared partial status. Artifact summaries now always include the already-declared optional source_coverage.

  • Provider, bridge, target-format, or platform compatibility: all artifact formats. Roots whose traversal is unknown (omitted entries, DMG/PKG/universal Mach-O without a native adapter, encrypted PCK, opaque PyInstaller) now report partial.

  • Evidence, artifact, provenance, or reconstruction contract: inspection IDs change for those roots because the status is part of the digested result. Nested inventory Evidence is unchanged.

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

  • Generated metadata, package, or installation impact: none (docs:check passes).

  • 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/artifactInspectionCoverageMcp.test.ts uses the production createServer session over MCP. It covers a directory with a FIFO and one without, and checks inspect_artifact coverage plus both summary paths (inspect_analysis_view summary of the retained parent, and inspect_artifact {detail: "summary"}) against the advertised output schema.

  • Base reproduction or other evidence (executed): with src/ changes stashed, the new test fails on base in both cases: expected 'complete-within-substeps' to be 'partial' for the FIFO case, and expected undefined to deeply equal { scope: 'container-entries', … } for the summary's source_coverage. With the fix, both cases pass.

  • User-visible CLI/MCP output (executed, rea inspect-artifact <dir with Info.plist, main.js, FIFO> from the built CLI with isolated HOME/XDG/TMPDIR):

    Before (base f801b2f):

    {"inspection_status":"complete-within-substeps","inventory_coverage":{"scope":"container-entries","status":"unknown"}}
    {"summary_inspection_status":"complete-within-substeps","source_complete":true,
     "unknowns":["Inventory does not establish application runtime behavior or complete format-specific analysis."]}

    After:

    {"inspection_status":"partial","inventory_coverage":{"scope":"container-entries","status":"unknown"}}
    {"summary_inspection_status":"partial","source_complete":true,
     "source_coverage":{"scope":"container-entries","status":"unknown"},
     "unknowns":["Inventory does not establish application runtime behavior or complete format-specific analysis.",
                 "Producer traversal coverage is unknown; missing matches do not prove source absence."]}
  • Cost: the CLI summary response for this fixture grows from 4531 to 4667 bytes (+136, measured). A complete-traversal summary adds only the source_coverage object (~67 bytes, computed, not measured). Token counts were not measured. There is no extra call, and the projection does no new work beyond reading the already-parsed coverage.

  • Remaining proof gaps: only the macOS directory+FIFO case was exercised end-to-end. Other unknown-traversal formats (DMG/PKG, encrypted PCK, opaque PyInstaller) go through the same composition but their new partial status was not asserted individually.

  • 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/artifactInspectionCoverageMcp.test.ts on base (src stashed): 2 failed (expected). With fix: 2 passed.
  • npm run test:focused -- <39 related files> (artifact inspection/inventory/comparison domain tests, artifact/PCK/PyInstaller/desktop/prompt/session MCP boundary tests, artifact provider boundary tests, Apple/mobile/Harmony/ZIP/PCK/PyInstaller acceptance tests, CLI logging/environment): 39 files, 252 tests passed.
  • Real CLI repro (node scripts/rea.mjs inspect-artifact … --json and --detail summary --evidence_output …): before/after output above.
  • npm run check:fast: passed.
  • npm run format:check: passed.
  • npm run docs:check: passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. The status value and the summary field were both already declared in the output schemas.
  • Real Hopper/Ghidra, browser, or OS coverage: no provider needed; macOS (Darwin arm64, Node 26) only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new reads, processes or effects.

Author readiness

Human owner: @kaoru0822-kitauji

  • 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.

🤖 Generated with Claude Code

…ection coverage

Artifact inspection derived its coverage status only from always-zero
omission counts, so an inventory substep with unknown container-entry
traversal (for example, an omitted FIFO) yielded
complete-within-substeps. Analysis-view summaries also exposed the
inventory's typed source_coverage only for PCK and PyInstaller roots.

Derive the inspection status from the inventory substep's coverage
(unknown traversal is partial), and carry the producer's source_coverage
plus the traversal-unknown caveat in every artifact summary. Hash-count
fields keep their existing format gating.

Fixes #5837

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kaoru0822-kitauji kaoru0822-kitauji added bug Something isn't working track:bugs Small-bug loop track PRs labels Oct 21, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T11:48:48.259472Z a289813 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking defects were found.

Summary

The PR makes inspection coverage follow the inventory producer’s traversal coverage.

  • Artifact inspections now show when inventory traversal is unknown.

No actionable defects or new security issues were found. Tests were not run during this review. Live supersession status could not be checked because GitHub authentication was unavailable.

Reviews (2) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

@kaoru0822-kitauji
kaoru0822-kitauji merged commit ce1f4b1 into main Oct 21, 2026
40 checks passed
@kaoru0822-kitauji
kaoru0822-kitauji deleted the fix/artifact-inventory-unknown-coverage branch October 21, 2026 11:59
@github-actions github-actions Bot mentioned this pull request Oct 21, 2026
3 tasks done
@morluto morluto added the area: evidence Evidence, artifacts, and reconstruction label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: evidence Evidence, artifacts, and reconstruction bug Something isn't working track:bugs Small-bug loop track PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Artifact inspection reports complete coverage when its inventory traversal is unknown

2 participants