Skip to content

Let a sequence step show several code chunks - #628

Open
jykim256 wants to merge 4 commits into
devdotfast:mainfrom
jykim256:feat/multi-chunk-sequence-steps
Open

jykim256 wants to merge 4 commits into
devdotfast:mainfrom
jykim256:feat/multi-chunk-sequence-steps

Conversation

@jykim256

@jykim256 jykim256 commented Sep 27, 2026 •

Copy link
Copy Markdown

Stacked on #627. Please merge #627 first. This branch sits on top of it, so the diff here shows only the new commit once #627 lands.

What changed

A sequence step could point at one code range. Real steps often touch two or three places, so the author had to pick one. Now a step can carry several.

  • A step takes a new optional sources array, with 1 to 10 ranges.
  • A step still needs exactly one of source, sources, explanation, or code. The error message now says so.
  • When the guided tour lands on the step, it shows every chunk.
  • The first chunk anchors the step. Jump-to-source on a card opens that card's first chunk.
  • A step whose sources has only one entry looks exactly like a step with source.
  • The MCP edit guidance and the scratchpad instructions now mention sources.

Authoring guidance

  • instructions/authoring.md now tells authors to use sources when a step's story spans several places, in reading order.

Stored data

There's no migration. sources is additive. Stored steps that use source parse, render and tour exactly as before.

Each chunk becomes its own document reference, with the id <step id>:<index>. That means each chunk gets the same checks a single source gets: whitespace-only ranges get rejected, pins get validated, and staleness is tracked per chunk. A single-source step keeps its old reference id, so existing stale-source state still lines up.

How I checked it

image
  • pnpm --filter @dev.fast/review typecheck and tsc --noEmit -p packages/review/app pass.
  • pnpm lint passes. oxfmt --check passes on the changed files.
  • pnpm --filter @dev.fast/review test:node: 1196 passed. One run hit a failure in src/sharing/export.test.ts (the diff-count watch stream test). It passed on four reruns of this branch and on the base branch, so it looks like a timing flake under load.
  • Canvas browser suite (vitest --project browser): 46 files, 275 tests pass. That includes a new test where three chunks across two files make two editors, with the same-file editor getting both ranges.
  • Canvas node suite (test:node, Node 24.18.0): 48 files, 247 tests pass, including the new sequence-tour.test.ts and code-peek-groups.test.ts.
  • New server tests: a step with three chunks is stored, a step with both source and sources is rejected, and a whitespace-only range in sources[1] is rejected.

Things to look at

  • CodePeekCard now wraps a new CodePeekFileCard that takes a list of sources. Single-source callers (code peeks, side peeks) get the same title, ranges and reveal behavior as before.
  • The tour uses a new peek content kind, sources. Only sequence steps produce it right now. Flow-diagram attachments still make one tour stop per source. I left that alone on purpose, but it could adopt the same stack later.
  • I picked 10 as the max. It's easy to change if that's too tight.
  • No desktop (Code - OSS) changes. The desktop lens already handles several disjoint ranges in one file.

🤖 Generated with Claude Code

jykim256 and others added 4 commits September 26, 2026 19:57
Tour steps and code peeks build a "document:" lens that goes through
lensContextGaps(). Since devdotfast#502, when diffr supplies contextScopes, any
unfolded run of lines that touches the lens range is shown whole. An
added file is one unfolded run, so the card shows the entire file
instead of the pinned lines.

Add ReviewDiffLens.exact, set it on the document lens, and have
withLens() drop contextScopes before computing gaps for an exact lens.
Diff tab lenses never set exact, so devdotfast#502's behavior there is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A sequence step could carry only one source range, so a step that
touches two places in the code had to pick one. Add an optional
`sources` array (1 to 10 ranges) as a fourth alternative to `source`,
`explanation` and `code`. A step still needs exactly one of them, and
stored steps that use `source` read and render as before.

The guided tour shows every chunk when it lands on the step. Chunks
that share a file, side and pins go into one code card with several
ranges, so the exact document lens folds the code between them. Chunks
in other files get their own stacked cards. The first chunk anchors the
step for jump-to-source.

Each chunk is its own document reference (`<step id>:<index>`), so it
gets the same whitespace, pin and staleness checks as a single source.
The MCP edit guidance and scratchpad instructions mention `sources`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jykim256
jykim256 force-pushed the feat/multi-chunk-sequence-steps branch from e2b487d to b192a69 Compare September 27, 2026 00:30
@thesiti92
thesiti92 requested review from ketan0 and sidkmenon and removed request for ketan0 September 28, 2026 17:37
@sidkmenon

Copy link
Copy Markdown
Contributor

hey! @jykim256 tysm for the contribution !! sorry for the delay on this, have been working on some diffr data model improvements to fix up the diagram code snippets.

i'm a bit confused by this though - "the multiple code snippets in a stop" doesn't feel very natural for a sequence diagram? are the other code snippets like context or something? and the limit of 10 feels a bit arbitrary.

@milanb17
milanb17 self-requested a review September 30, 2026 17:46
@milanb17 milanb17 self-assigned this Sep 30, 2026

This branch has not been deployed

No deployments
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.

3 participants