feat(quiz): diff coverage map in the sidebar - #27
Merged
Conversation
Shows which of the PR's changed files have a question anchored to them, so the reader can see at a glance what the quiz does and doesn't probe. - web: `GET /changed-files` returns the PR's changed-file paths (`changed_files` callable, wired in server.py to the shared `_DiffProvider`). 503 when unwired. - frontend: a "Diff coverage" sidebar block (answering view) listing each changed file with a covered/uncovered marker + an "N of M files probed" count. Coverage is computed client-side by matching question anchors to changed files with the same exact / repo-relative-suffix / basename logic the server's do_file_diff uses. Display only — the "ask the host to cover this file" steer is Track B. Builds on the anchors feature (#26). Tested: /changed-files endpoint (list + 503). Verified in a real browser: exact and basename-only anchors both mark their file covered; files with no anchored question show uncovered; count is correct. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jonasbrami
added a commit
that referenced
this pull request
May 29, 2026
…29) The anchored hunk now renders inline with the question (always visible, fetched on render) instead of behind a click-to-expand panel — the code context is right there next to the prompt. To keep that readable when a question anchors into a large diff hunk, the inline view is clipped to a tight window around the anchored lines (± a few context lines), with the anchored lines highlighted and trimmed regions marked by an ellipsis. Falls back to the full hunk when there's no window to clip to. Verified end-to-end by generating a real quiz with `cognit` against PR #27 and serving it through the real web app: 5 questions (4 anchored + mermaid + open), each inline hunk clipped to 12–20 lines (from 46) with ellipsis + highlighting, plus the diff coverage map. Frontend only. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A "Diff coverage" sidebar block showing which of the PR's changed files have a question anchored to them — so the reader sees at a glance what the quiz probes and what it skips. Builds directly on the anchors feature (#26).
Changes
GET /changed-filesreturns the PR's changed-file paths via a newchanged_filescallable (wired inserver.pyto the shared_DiffProvider). Returns503when no diff source is wired (mirrors/diff).do_file_diff, so a covered marker lines up with what/diffwould actually serve.Display only — the one-click "ask the host to cover this file" steer is Track B (needs the host-wake mechanism), intentionally out of scope here.
Invariants preserved
QuizState;/changed-filesis browser↔web (in-process).textContent-only frontend (file names viatext:).Testing
/changed-filesreturns the list;503when unavailable. Fullmcp/enginesuite green;ruff+ruff format --check+mypy --strictclean.🤖 Generated with Claude Code