Skip to content

chore: slim evidence model per ADR 0010#60

Merged
Asgarrrr merged 2 commits into
mainfrom
chore/slim-evidence-model
May 20, 2026
Merged

chore: slim evidence model per ADR 0010#60
Asgarrrr merged 2 commits into
mainfrom
chore/slim-evidence-model

Conversation

@Asgarrrr

Copy link
Copy Markdown
Owner

Context

Postmortem-001 and the post-ADR-0007 review surfaced that Mira's evidence model was overbuilt: 7 domain types, 3 of them with zero or write-only consumers, 3 theater fields on CommandObservation (relatedFiles, suggestedNextActions, verificationHints) that were always empty in 369/369 historical observations on disk.

Finding was a Mira-invented shape (title, description, excerpts) parallel to industry-standard SARIF 2.1, the 12-year-old OASIS interchange format already produced by clang, rustc, biome, ESLint 9, Semgrep, CodeQL, and consumed by Agent Audit and most CI quality gates in 2026.

ADR 0010 (new) records the four cuts.

What changed

Domain model (slim per ADR 0010):

  • Drop typed Evidence record (zero importers).
  • Drop EvidenceExcerpt (write-only).
  • Drop CommandObservation.{relatedFiles, suggestedNextActions, verificationHints} (always empty in 369/369 historical obs; z.object strip-mode keeps backward compat).
  • Reshape Finding to SARIF-flavored: { id, severity, ruleId?, message, location?, evidenceRefs[] }. 1:1 mapping documented in src/core/finding.ts.

Renderer:

  • Wire Finding[] into renderObservationMd (## Findings section). Type is no longer write-only.
  • Render file:line:column (tsc-native shape).
  • Single em-dash separator; no double-em-dash edge cases.

Filter:

  • src/filter/filters/tsc/index.ts emits the new shape.

Docs:

  • docs/adr/0010-slim-evidence-model.md (new).
  • docs/adr/0001-core-abstractions.md marked partially superseded.
  • docs/domain-model.md slim revision.
  • CLAUDE.md core abstractions list updated.
  • docs/plans/filter-engine/* annotated with ADR 0010 banners; obsolete excerpts refs struck through.

Eval fixture:

  • eval/scenarios/B1/base.patch rewritten to anchor on post-slim observation schema.

How to verify

bun run typecheck   # exit 0
bun test            # 358 pass / 0 fail
bun run check       # 69 files, 0 fixes

Empirical backward-compat check: parsed all 369 .mira/runs/*/observation.json against the new schema → 369/369 round-trip cleanly (strip-mode handles dropped fields).

Risk / rollback

  • Risk: any external consumer reading CommandObservation.relatedFiles (or the two other dropped fields) breaks. Scope: none known — Mira's only consumers are CLI, MCP, and the renderer, all updated here.
  • Risk: any consumer reading Finding.title / Finding.description / Finding.excerpts breaks. Scope: filter + renderer + tests, all updated here. No external Finding-producing tools in tree.
  • Rollback: git revert 819ee86 36ae658. ADR 0001 line 38 mention restores to inline form; ADR 0010 becomes a planning document. No data migration needed (no on-disk format change, only schema shape changed).

Review notes

Post-dev review (fresh-context reviewer) ran typecheck + tests + biome + empirical 369-obs parse and returned FLAG verdict. The 6 soft issues flagged were addressed in commit 819ee86 (post-review follow-up) before this PR.

Asgarrrr added 2 commits May 20, 2026 03:31
Drop dead types and theater fields after the evidence-model cartography
showed three cuts paying off with zero risk:

- EvidenceExcerpt: 100% write-only. Produced by tsc filter, never read.
- Evidence (typed record): zero importers in src/ or tests/.
- CommandObservation.{relatedFiles,suggestedNextActions,verificationHints}:
  369/369 historical observations had all three empty.

Reshape Finding to SARIF-flavored fields (ruleId, message, location?,
evidenceRefs[]) so future Semgrep/CodeQL/biome ingest maps 1:1 without a
translator. Wire findings into renderObservationMd so Finding stops being
write-only — the tsc filter's output now surfaces in observation.md.

Pre-ADR-0010 observations remain readable: zod's z.object strips unknown
fields by default, so old JSON round-trips without error.

Verified: typecheck clean, 349 tests pass, 0 fail.
Address 6 soft issues from the post-dev code review of ADR 0010.

Renderer (src/render/render-observation.ts):
- Render location.column (file:line:column, tsc-native shape) — fixes
  the 'parsed but never consumed' theater the slim model attacks.
- Restructure renderFindingLine to use a single em-dash separator
  between the structured prefix and the message. No more double
  em-dash when ruleId is absent but location present.
- Drop dead '?? ""' on String.split(_, 1)[0] (always non-empty).

Tests (tests/render-observation.test.ts):
- Add 9 positive tests for the '## Findings' section: full finding,
  ruleId-absent, location-absent, minimal, multi-line message,
  line-without-column, file-only, multiple findings, empty findings.

Docs:
- docs/adr/0001-core-abstractions.md: rewrite the supporting-types
  sentence so it no longer inlines 'Evidence' and 'EvidenceExcerpt'
  as canonical (both removed by ADR 0010).
- docs/plans/filter-engine/00-decisions.md L271 & L300: strikethrough
  obsolete 'excerpts[].lineStart/lineEnd' refs and clarify the
  post-0010 replacement.

Verification:
  bun run typecheck → pass
  bun test          → 358 pass / 0 fail (was 349, +9 new tests)
  bun run check     → 69 files, 0 fixes
@Asgarrrr
Asgarrrr merged commit 51819b0 into main May 20, 2026
2 checks passed
@Asgarrrr
Asgarrrr deleted the chore/slim-evidence-model branch May 20, 2026 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant