Skip to content

Stream Deck: Scroll dial scrolls a spec/plan under review (canvas viewport-scroll) - #1513

Merged
amrmelsayed merged 24 commits into
mainfrom
builder/pir-1501
Aug 18, 2026
Merged

amrmelsayed merged 24 commits into
mainfrom
builder/pir-1501

Conversation

@amrmelsayed

Copy link
Copy Markdown
Collaborator

PIR Review: Scroll dial scrolls a spec/plan under review (canvas viewport-scroll)

Closes #1501

Summary

The Stream Deck Scroll dial's rotation relayed VSCode's editorScroll, which acts only on a
text editor — so it did nothing when the reviewer was reading a spec/plan in the artifact-canvas
webview, the one long document where keyboard-free scrolling matters most. This adds a
viewport-down/viewport-up canvas command (a raw viewport pan, distinct from the existing
block/heading focus moves) and phase-switches ScrollNav.onDialRotate to drive it over
sendCanvasCommand in canvas mode — mirroring the mode split the review dials already use —
while keeping editorScroll for diff/text-editor mode. The press stays builder-diff-only by
design (#1498), so on a canvas the dial is half-live: rotation scrolls, press is inert.

Files Changed

  • packages/types/src/canvas-command.ts (+18 / -3) — new viewport-down/viewport-up in the
    CanvasCommand union and TraversalCommand.
  • packages/types/type-tests/canvas-command.type-test.ts (+2 / -0) — classification (drift guard).
  • packages/codev/src/agent-farm/servers/canvas-relay.ts (+4 / -0) — Tower relay allowlists.
  • apps/vscode/src/markdown-preview/canvas-view-registry.ts (+2 / -0) — VSCode host allowlist.
  • packages/artifact-canvas/src/components/ArtifactCanvas.tsx (+48 / -2) — scrollViewport
    (pans the host-page scroller), VIEWPORT_SCROLL_STEP_PX, count-loop signature extension.
  • apps/streamdeck/src/actions.ts (+66 / -15) — ScrollNav mode split + Scroll · read only.
  • apps/streamdeck/src/__tests__/actions.test.ts (+40 / -4) — diff/canvas rotate tests.
  • packages/artifact-canvas/playwright/remote-commands.spec.ts (+66 / -0) — real-browser scroll tests.
  • apps/streamdeck/README.md (+8 / -2) — Scroll dial doc, phase-aware split.

(Plus the plan, this review, the builder thread, and porch status.yaml.)

Commits

Test Results

  • Build: ✓ (pnpm -r build, porch build check 7.2s)
  • Tests: ✓ streamdeck 242 (10 new/changed), artifact-canvas 177 unit + 10 Playwright (4 new
    #1501, real Chromium), codev canvas-relay 30, vscode registry 17; all check-types +
    type-tests. Porch tests check 30.9s.
  • Manual verification (dev-approval, real Stream Deck hardware, by the human): rotating the Scroll
    dial scrolls a spec/plan in the artifact-canvas; the Scroll · read only label and the 60px
    step were confirmed on the dial. (One Error touchstrip appeared first — diagnosed as a stale
    globally-installed Tower rejecting the new command as invalid-request, not a code defect; see
    Lessons.)

Architecture Updates

COLD (codev/resources/arch.md): appended one clause to the #1380 artifact-canvas host-contract
entry recording that in vertical reading mode the host page (document scrolling element) is the
vertical scroll container, not the canvas body — the invariant viewportStartLine already encodes
and that the new viewport-scroll command now also depends on.

No HOT arch change: this adds no new module boundary. The viewport-scroll command follows the
existing spec-1401 pattern exactly — a closed command vocabulary mirrored across four drift-guarded
allowlists (types union/TraversalCommand, Tower canvas-relay, VSCode canvas-view-registry,
canvas-local TRAVERSAL_COMMANDS) plus the type-test classification map.

Lessons Learned Updates

COLD (codev/resources/lessons-learned.md, Testing), two entries:

  1. The host-scroller find (the most valuable catch in this lane). The approved plan said pan
    root.scrollTop; the canvas body is not the vertical scroller (in vertical mode the host page
    scrolls — viewportStartLine measures against the window, and the VSCode host leaves body
    overflow default), so that would have silently no-oped in the real webview while passing every
    jsdom test. Generalizable shape: a DOM assumption that unit tests cannot falsify (which element
    actually scrolls) needs a real-browser test, and an approved plan is not evidence about runtime.

    Caught and proven in real Chromium before writing the code, not argued.

  2. The stale-Tower Error sharpens Stream Deck SD+: Automatic diff press should open the builder's first file diff (dial-ready), not the aggregate #1414: a canvas-command Stream Deck feature spans a third
    independently-versioned artifact — Tower (the codev server validates the command in
    canvas-relay). A stale global Tower rejects a new command as invalid-request, which the deck
    renders as Error on the touchstrip, even with the deck bundle and VSCode extension both
    on-branch.

No HOT lesson: (1) sharpens the existing hot lesson "'tests pass' is not 'it works' — verify the
real user path" rather than displacing a capped entry; both are spec-adjacent recipes that belong cold.

Things to Look At During PR Review

  • The count-loop signature change (ArtifactCanvas.tsx, runCanvasCommand): the progress
    signature gained the document scroller's scrollTop (originLine:scrollLeft:scrollTop). This is
    shared by every canvas command's repeat loop — verify it still edge-stops for block/heading/column
    commands (it does: at an edge nothing moves; when focus moves originLine already differs). The
    huge-count Playwright test pins the bound (count: 1_000_000 finishes < 5s at the bottom).
  • 'canvas'-specific keying in ScrollNav.onDialRotate: the branch is reviewMode === 'canvas',
    never "not diff", so none (no builder / unknown phase) keeps editorScroll. The Stream Deck: Scroll dial names a delivery mode with no builder selected (press is inert) #1505
    empty-state guard pins this.
  • The :638 test repoint (ruled by the architect): it moved to a diff-mode builder (pir-2)
    and is the first genuine diff-mode rotate coverage — the old test rode the canvas-mode default
    fixture through then-mode-independent code. Not an accommodation of a regression.
  • CMAP consult already run at implement (advisory, at the architect's request): Gemini APPROVE,
    Codex COMMENT, Claude REQUEST_CHANGES. All addressed — the substantive one was a stale ScrollNav
    class-level doc comment (the renderTo doc was updated, the class header was missed).
  • Two review nits deliberately left, ruled by the architect: the focus-ring re-arm on a pure pan
    (via runCanvasCommand, accepted after hardware use) and the ~5-line overlap with
    ReviewNav.runCanvas (extracting a shared helper would couple two actions with different semantics).

How to Test Locally

  • View diff: VSCode sidebar → right-click builder pir-1501 → Review Diff.
  • Run dev: VSCode sidebar → Run Dev, or afx dev pir-1501. Note this is a cross-surface
    change — hardware testing needs Tower + the VSCode extension + the deck plugin all built from this
    branch, not the installed package (a stale Tower renders Error on the dial).
  • What to verify: select a builder blocked at plan/spec-approval (canvas mode), open its
    plan/spec in the artifact-canvas, rotate the Scroll dial → the page scrolls up/down; spin faster →
    proportional; at the bottom it stops. On a diff-phase builder the dial still scrolls the diff
    editor and the press still submits/queues the selection.

… mode

In canvas mode (a spec/plan under review) rotation drives the new viewport-down/up
canvas command instead of editorScroll, keyed on reviewMode 'canvas' specifically so
'none' still takes the editor path. Canvas-mode touchstrip label becomes 'read only'
(rotation scrolls, press stays diff-bound and inert).
…e diff-mode coverage

The old :638 'scrolls the editor on rotate' rode the default pir-1 fixture, which is
CANVAS mode, through then-mode-independent code — so diff-mode rotate had no real
coverage. Repointed to pir-2 (diff mode) with the mode stated, so it now asserts
byte-for-byte editorScroll on an actual diff-mode builder. Added a canvas-mode rotate
test (viewport-down/up, count = |ticks|, MRU target) and a canvas-error touchstrip test.
…tract note

3-way cmap (gemini APPROVE, codex COMMENT, claude REQUEST_CHANGES):
- Update the ScrollNav CLASS-level doc comment (renderTo's was updated, the class
  header was not) — it still described 'editor only' / both gestures inert on a canvas.
- Update apps/streamdeck/README.md Scroll bullet with the phase-aware split, matching
  the sibling dials, and note the press stays diff-only (half-live on a canvas).
- Make scrollViewport's host contract explicit (document is the vertical scroller,
  same assumption as viewportStartLine); drop the dead cancelWheelGlide call (glide is
  horizontal-only) and its misleading comment.
- ternary -> if/else in ScrollNav.onDialRotate.
…viations

3-way review consult = 3x APPROVE (no REQUEST_CHANGES). Addressed Claude's
non-blocking comments: add a Playwright test pinning viewport-scroll inert in
horizontal mode (mirror of column-paging-inert-in-vertical); document in the
review the horizontal no-op, the deliberately-dropped wheel-glide cancel, and
the synchronous-loop safety of the count-loop signature change.
… via version skew

The old comment claimed invalid-request was unreachable ('we only ever send valid
commands'), which this PR's own lessons-learned entry contradicts: a stale Tower whose
canvas-relay allowlist predates a newly added command rejects it as invalid-request, and
the deck renders 'Error'. Point the reader at the stale-Tower lesson instead of sending
them looking in the wrong place. Comment-only; no behaviour change.
@amrmelsayed
amrmelsayed merged commit ee1fffd into main Aug 18, 2026
7 checks passed
amrmelsayed added a commit that referenced this pull request Aug 18, 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.

Stream Deck: the Scroll dial can't scroll a spec/plan under review (canvas webview, not a text editor)

1 participant