Skip to content

feat(diff): read a diff in the order a walkthrough sets - #14

Merged
fiddur merged 4 commits into
developfrom
diff-walkthrough
Aug 21, 2026
Merged

feat(diff): read a diff in the order a walkthrough sets#14
fiddur merged 4 commits into
developfrom
diff-walkthrough

Conversation

@fiddur

@fiddur fiddur commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Slice 1. Tours already carried an ordered list of file-and-line stops with narrative, and the tour
skill already had a review mode that scopes them to a PR's diff — but only the repository browser
could render one, so a walkthrough of a diff had nowhere to appear.

The diff page now reads the session's most recent tour and reorders the whole view by it. Sidebar and
diff body both, because they render from one list: files the walkthrough visits come first in visit
order, everything else keeps the order it had, under a "Not in the walkthrough" divider. A toggle in
the sidebar header returns to the alphabetical tree.

  • the sidebar switches to a flat numbered list in that mode — position, file, and the stop's one-line annotation — with the existing filter and comment-only controls still applied
  • a stepper under the toolbar walks the stops with prev/next and scrolls to each file
  • keyboard file navigation follows the reading order rather than the alphabetical one
  • tours are polled on the same 2s interval as comments, and one still being written shows its steps as they arrive, so a reader watches the order being worked out
  • the tour skill's hand-off now sends a review tour to /diff, and says an annotation should explain why a file is read at that point

Measured on NaturalCycles/NCBackend3#14360, 11 files:

alphabetical                                    review order
 1. src/email/email.service.test.ts             1. server/services/idempotency.service.ts   the primitive
 2. src/email/email.service.ts                  2. server/services/idempotency.service.test.ts  the contract
 3. src/sendgrid/sendgridApi.service.ts         3. sendgrid/sendgridApi.service.ts          first consumer
 4. src/server/…/idempotency.service.test.ts    4. twilio/twilioApi.service.ts              skipped vs failed
 5. src/server/…/idempotency.service.ts         5. shipping/shippingItem.service.ts         threading it through
 6. src/shipping/…/shelflessWebhook.test.ts     6. shipping/…/shelflessWebhook.handler.ts   the P1 lives here
 7. src/shipping/…/shelflessWebhook.handler.ts  ── not in the walkthrough ──
 8. src/shipping/shippingItem.service.test.ts   ·  the five signature-only test files
 …

The primitive moves from 5th to 1st, the file holding the blocking finding from 7th to last, and the
five files that are signature updates only drop below the divider.

Ordering is a pure function with tests: first-visit wins when a walkthrough returns to a file, files
it names that the diff does not contain are dropped, no file is lost or duplicated, and an empty
walkthrough is the identity. 120 UI tests pass.

Also fixes a TS2883 from #12tsc could not name the sanitize schema's inferred type. Note that
npm run typecheck -w @diffity/ui still reports four pre-existing TS6059 errors that are present
on upstream main too; the script is not wired into npm test.

Follow-ups worth doing: the stepper scrolls to the file, not the line, because DiffViewHandle
exposes only scrollToFile; and a step's line range is not highlighted in the diff yet.

Stacked on #12.

🤖 Generated with Claude Code

https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs

fiddur and others added 3 commits August 21, 2026 11:15
Tours already carried an ordered list of file-and-line stops with narrative, but only the
repository browser could show them, so a walkthrough of a diff had nowhere to appear.

The diff page now reads the session's most recent tour and reorders the whole view by it -
sidebar and diff body both, since they render from one list. Files the walkthrough visits
come first in visit order, everything else keeps the order it had, under a divider. A
toggle in the sidebar header returns to the alphabetical tree.

The sidebar switches to a flat numbered list in that mode: position, file, and the stop's
one-line annotation, with the existing filter and comment controls still applied. A stepper
under the toolbar walks the stops with prev/next and scrolls to each file.

Tours are polled on the same 2s interval as comments, and a tour still being written shows
its steps as they arrive, so a reader watches the order being worked out.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs
A review tour's steps now drive the diff view, so the hand-off pointed the reader at
/tour/<id>, which browses the repository instead of the change. Also notes that a review
tour's --annotation becomes the file's label in the reordered list.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs
@fiddur
fiddur changed the base branch from sanitize-markdown to develop August 21, 2026 13:35
@fiddur
fiddur marked this pull request as ready for review August 21, 2026 13:35
@fiddur
fiddur merged commit 68be75a into develop Aug 21, 2026
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