Skip to content

feat(evidence): name a standalone Evidence record with detected_kind on every bundle refusal - #11039

Merged
morluto merged 1 commit into
mainfrom
feat/evidence-record-detected-kind
Nov 15, 2026
Merged

morluto merged 1 commit into
mainfrom
feat/evidence-record-detected-kind

Conversation

@morluto

@morluto morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

Refs #10508 (Phase 6.1). Supplying one Evidence record where a bundle is required was refused by three producers (the bundle file reader, the inline evidence_bundle reader of the reconstruction tools, and the investigation ledger's import), and only the message said why. Each refusal now carries detected_kind: "evidence-record", matching the existing detected_kind: "analysis-snapshot" on the file reader.

Problem and expected behavior

  • Tests and agents told a standalone record apart from a malformed bundle by matching "this JSON is one Evidence record".
  • Expected: a structured fact names the kind detected, at every producer of this refusal, so consumers do not parse prose.

Change and scope

  • evidenceErrors.ts: EvidenceFileDetectedKind = "analysis-snapshot" | "evidence-record" for EvidenceFileError.detectedKind (already projected as details.detected_kind).
  • EvidenceBundleFiles.ts: the wrong-kind refusal for a record sets detectedKind: "evidence-record".
  • evidenceBundle.ts: singleEvidenceRecordIssue(path, message) builds the invalid_value issue with observed: { detected_kind: "evidence-record" }; readEvidenceBundle uses it at the caller's argument path, and EvidenceLedger.import uses it at the input root (it previously had no issue, so its projection had no details).
  • inlineEvidenceBundleKind.test.ts was failing on main before this change: since compact input schemas (feat(mcp): project compact input schemas into the portable advertised dialect #10632), MCP no longer rejects the altered record by schema, so it reaches the domain reader like the CLI. The test now asserts CLI and MCP return the same error (including detected_kind for the record cases, and evidence_integrity_mismatch for the altered record) instead of a schema-only invalid_request.

Not included: message text is unchanged; no other refusal kinds gain detected_kind.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: describeEvidenceBundleFailure (domain) still classifies single-record; singleEvidenceRecordIssue (domain) owns its input-issue projection; EvidenceBundleFiles owns the file reader's wrong-kind fact
  • Contribution scope fit and linked maintainer decision: approved owner change (Phase 6.1, [Design] Assert structured remediation facts instead of guidance prose #10508)
  • CLI and MCP/tool-catalog contract: additive: error.details.detected_kind: "evidence-record" on file refusals; error.details.issues[].observed.detected_kind on inline and ledger refusals. Codes, categories and messages unchanged
  • Provider, bridge, target-format, or platform compatibility: none
  • Evidence, artifact, provenance, or reconstruction contract: none
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • 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: 6 assertions in 5 files move from the sentence "this JSON is one Evidence record" to detected_kind; the record's evidence_id (caller data) is still checked in the message where it was before
  • Base reproduction or other evidence: mutation (run, reverted): with the file reader's kind changed to analysis-snapshot and the issue's to another value, 5 of 89 tests fail, one per producer path
  • User-visible CLI/MCP output (if applicable): rea evidence-import record.json --json → {"code":"invalid_request","category":"invalid_input","details":{"path":"…/record.json","detected_kind":"evidence-record",…}}
  • Remaining proof gaps: none known

For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.

For evidence-bearing changes:

  • 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/filesystem/evidenceBundleFiles.test.ts tests/boundary/mcp/bundleComparisonMcp.test.ts tests/boundary/cli/evidenceBundleCommands.test.ts tests/boundary/cli/inlineEvidenceBundleKind.test.ts src/application/investigation/EvidenceLedger.test.ts: 89 passed (28.8 s wall incl. build)
  • Same with the two producer values mutated: 5 failed (expected), then restored
  • tests/boundary/cli/inlineEvidenceBundleKind.test.ts on unmodified origin/main (53f1b62): 1 failed (MCP returned evidence_integrity_mismatch where the test expected invalid_request)
  • npm run check:fast: passed
  • command — result

Compatibility, safety, and release

  • Breaking changes or migration steps: none (additive field)
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; macOS only
  • Package or release metadata impact: none
  • Security, privacy, process, or containment review: none

Author readiness

Human owner:

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

…on every bundle refusal

The file reader, inline bundle reader and investigation ledger refused a
single Evidence record with only a message saying so. The file reader's
wrong-kind failure now carries detected_kind "evidence-record" (as it
already did for analysis snapshots), and the inline and ledger refusals
carry it on their input issue through one domain helper. Tests assert the
field instead of the sentence. The inline CLI/MCP case now asserts full
parity: since compact input schemas, MCP reaches the same domain reader.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T10:39:51.693955Z
We couldn’t complete this review. Comment @codex review to try again.
25f3189 PR opened
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] This PR appears safe to merge; the new error facts preserve existing record checks and refusal behavior.

Summary

Adds detected_kind: "evidence-record" when callers supply one authenticated Evidence record where a bundle is required.

  • Bundle refusals now name standalone Evidence records in error details.

Reviews (1) · Last reviewed commit: "feat(evidence): name a standalone Eviden..." · Reviewed by Greptile

@morluto
morluto merged commit 0d86953 into main Nov 15, 2026
14 of 15 checks passed
@morluto
morluto deleted the feat/evidence-record-detected-kind branch November 15, 2026 11:34
@morluto morluto added area: evidence Evidence, artifacts, and reconstruction enhancement New feature or request labels Nov 22, 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 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant