Skip to content

Measure which changed lines a Briefing shows in each hunk - #29

Open
rcosteira79 wants to merge 4 commits into
feat/briefing-grounding-part-3-resolve-import-edges-on-both-sidesfrom
feat/briefing-grounding-part-4-measure-briefing-coverage-of-changed-lines
Open

rcosteira79 wants to merge 4 commits into
feat/briefing-grounding-part-3-resolve-import-edges-on-both-sidesfrom
feat/briefing-grounding-part-4-measure-briefing-coverage-of-changed-lines

Conversation

@rcosteira79

Copy link
Copy Markdown
Collaborator

What

  • briefingCoverage(comparison, document) reports, for every hunk of a captured comparison, which changed lines a saved Briefing cites, which it shows only because an excerpt expanded, and which it never shows. Each hunk is explained, partly explained or not explained, and the result carries totals.
  • Only excerpts a reader can reach count: source blocks in the story, and the excerpts of elements in diagrams the story places.
  • A code excerpt shows the added and deleted rows of its stored diff. Rows hidden behind a "lines omitted" marker stay unexplained.
  • A Markdown excerpt shows exactly its quoted lines and never expands.
  • A Briefing from another captured comparison gets the state "unavailable".

Why

An agent writes every Briefing, and nothing tells the reader which parts of the diff its story never shows. A later trust layer needs that answer derived by the server, not reported by the agent. This branch builds the measure.

Decisions and trade-offs

Choice Why
A replacement cited on one side explains both sides The excerpt shows the deleted and added rows together; those lines go in expanded, kept apart from cited
A Markdown excerpt counts only its quoted lines It has no stored diff, so a reworded paragraph cited on its new side reads partly explained
A placed diagram's element excerpts count as shown The reader opens them in the inspector; an excerpt no block or placed diagram uses counts as nothing

Please check the shown-excerpt rule at src/briefing-coverage.ts:18 against what public/briefing.js renders. A mismatch would count lines the reader never sees.

No ADR was added or amended on this branch.

How to test

Nothing calls briefingCoverage yet, so no hand can exercise it in the app. Read src/briefing-coverage.ts against excerptRows in src/briefing-diff.ts. Then reason about a 200-line replacement cited at its middle line: the rows behind the omitted-lines marker must come out unexplained. Nothing here needs a human eye.

@rcosteira79
rcosteira79 added this pull request to stack #25 October 29, 2026 18:31
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