Skip to content

mac: consume display-list-v2-window — the Mac side of FT-070's page window - #665

Merged
GoKubar merged 1 commit into
mainfrom
mac/ft-070-window-consumer
Sep 15, 2026
Merged

GoKubar merged 1 commit into
mainfrom
mac/ft-070-window-consumer

Conversation

@GoKubar

@GoKubar GoKubar commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Producer-side #294 (merged, 7e6ed07f) negotiates display-list-v2-window and serves a bounded resident page window — the mechanism that gives a long document a reply at all. No in-tree consumer sent it. This is that consumer.

Pure addition. Nothing is removed, no v1 code is touched, and an unwindowed reply stays byte-for-byte what it is today — so this is safe to merge before any v1 removal.

Why the window is engaged on demand, not by default

An unwindowed reply is a complete compile: it can be a delta base and the source of a PDF export. A windowed reply is explicitly an incomplete view (proposal §4.1). Making it the default would trade those properties away on every document, including the ones that never needed a window.

So the shell asks for one only after the producer has said the unwindowed reply cannot exist:

  • status: failed with the over-the-reply-limit diagnostic (protocol.rs), or
  • a display_list_declined diagnostic — the reply survived but the v2 sibling did not.

Then the same buffers are re-requested under a window anchored at the viewer (a new id at the same revision, exactly like a capability switch).

Scroll drives it

Once engaged, the pane's scroll anchor moves the window. Leaving the served window's comfortable interior — margin 4 of 16 pages, with document edges exempt so page 1 and the last page never thrash — re-requests anchored at the viewer. A positioned request that comes back without the echoed capability disengages, so a producer that cannot window is never asked again on every scroll.

Protocol

Request CompileRequest.displayListWindow → display_list_window {first_page, page_count}, omitted when nil
Reply RenderingV2.Window (top-level window) and Page.resident

Per §4 the residency flag is asymmetric: an elided page carries "resident": false and no items key; a resident page carries neither marker. That asymmetry is what keeps every unwindowed line's bytes — and so every dl2-canon-1 page digest and every committed fixture digest — unchanged.

Both decoders (the fast reader and JSONDecoder) read it and refuse the same malformed shapes. validate checks the window range against the document, that residency matches the window exactly, and refuses a non-resident page that has no window object to belong to.

Composition and exclusions

  • §7: -window rides with -only (both are needed for a long document to be repliable at all) and suppresses -delta — r1 makes them mutually exclusive, since a windowed producer cannot digest pages it has not materialised.
  • §4.1: a windowed frame is never installed as a delta base, and refuses both PDF exports and the parity evidence hook rather than writing blank pages as evidence.
  • Elided pages paint a geometry-only placeholder, so the document keeps its full scroll extent (scrolling toward one is what fetches it) with no bitmap, hover or navigation machinery.

Verified against the merged producer

Not a hand-written approximation of the wire — flashtex-render built from this tree, answering a real {first_page: 3, page_count: 4} request over a 30-page document:

compile_result status: ok  caps: [display-list-v2, display-list-v2-only, display-list-v2-window]  v1 pages: 0
display_list window: {first_page: 3, page_count: 4, document_page_count: 30}  pages: 30
resident: [3, 4, 5, 6]   elided: 26
elided page keys: [height, number, resident, width]
resident page has 'resident' key: False

Fixtures/display-list-v2-window.json is one such reply committed verbatim; testRealProducerWindowedLineDecodesAndPaints decodes it on both decoder paths.

Tests

V2WindowTests — wire shape on both decoders, the refusals, the controller's engage/re-anchor/disengage state machine, failure classification, the real producer's bytes, and the two §4.1 exclusions. Plus a live pair through fake_worker_v2.py's new %v2window directive: an over-limit failure engaging the window, the 40-page/16-resident frame, a scroll that moves it to a clamped {25, 16}, and a producer without the capability disengaging instead of looping.

Mac gate on an idle machine: 1355 tests, 0 failures, 12 skipped.

A note on machine contention: an earlier run of this same tree reported 27 failures at load average 130 (two other agents' XCTest suites running concurrently). Every one of those was either in main's known-broken baseline or passed on re-run alone — DocumentFilesTests ×2 and HostedWindowSupportTests ×1 are helper-subprocess and window-activation tests, unrelated to display lists. The idle run above is the real number.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xd5Hmwh5GHNTiAmHUJ1MZu

…indow

#294 (merged, `7e6ed07f`) negotiates `display-list-v2-window` and serves a
bounded resident page window, which is what gives a long document a reply at
all. No in-tree consumer sent it. This is that consumer, as a pure addition:
nothing is removed, no v1 code is touched, and an unwindowed reply stays
byte-for-byte what it is today.

Protocol (FlashTeXProtocol):
* `CompileRequest.displayListWindow` -> `display_list_window {first_page,
  page_count}`, omitted from the wire when nil.
* `RenderingV2.Window` for the reply's top-level `window` object, and
  `Page.resident`. Per proposal §4 the flag is asymmetric: an elided page
  carries `"resident": false` and NO `items` key, a resident page carries
  neither marker — which is what keeps every unwindowed line's bytes, and so
  every `dl2-canon-1` page digest, unchanged.
* Both decoders (fast reader and JSONDecoder) read it and refuse the same
  malformed shapes; `validate` checks the window range against the document
  and that residency matches the window exactly, and refuses a non-resident
  page that has no window object to belong to.

Consumer (V2PageWindow.swift):
* The window is engaged ON DEMAND, never by default — an unwindowed reply is
  complete (delta base, export authority) and a windowed one is an incomplete
  view (§4.1). It engages only after the producer says the unwindowed reply
  cannot exist: the over-the-reply-limit `status: failed`, or a
  `display_list_declined` diagnostic. The same buffers are then re-requested
  under a window at the viewer, a new id at the same revision.
* Once engaged, the pane's scroll anchor drives it: leaving the served
  window's comfortable interior (margin 4 of 16 pages, with document edges
  exempt) re-requests anchored at the viewer. A positioned request that comes
  back without the echoed capability disengages, so a producer that cannot
  window is never asked again on every scroll.
* §7 composition: `-window` rides with `-only` and suppresses `-delta` (r1
  makes them mutually exclusive — a windowed producer cannot digest pages it
  has not materialised), and a windowed frame is never installed as a delta
  base.
* §4.1 exclusions: a windowed frame refuses both PDF exports and the parity
  evidence hook rather than writing blank pages as evidence.
* Elided pages paint a geometry-only placeholder, so the document keeps its
  full scroll extent (scrolling toward one is what fetches it) with no bitmap,
  hover or navigation machinery.

Verified against the MERGED producer, not a hand-written approximation:
`flashtex-render` built from this tree answers a `{first_page: 3,
page_count: 4}` request over a 30-page document with `status: ok`, zero v1
pages (`-only`), a 12-page-shaped sibling whose elided entries carry exactly
`{number, width, height, resident: false}` and whose resident entries carry no
`resident` key at all. `display-list-v2-window.json` is one such reply
committed verbatim, and `testRealProducerWindowedLineDecodesAndPaints` decodes
it on both decoder paths.

Tests: V2WindowTests (wire shape both decoders, the refusals, the controller's
engage/re-anchor/disengage state machine, failure classification, the real
producer's bytes, and the two §4.1 exclusions) plus a live pair through
fake_worker_v2.py's new `%v2window` directive — an over-limit failure engaging
the window, the 40-page/16-resident frame, a scroll that moves it to a clamped
{25, 16}, and a producer without the capability disengaging instead of
looping.

Mac gate on an idle machine: 1355 tests, 0 failures, 12 skipped.

Implementation-Agent: claude-fable-5 (mac window-consumer lane)
Commit-Executor: claude-fable-5 direct Git (observed Cursor usage limit)
Co-authored-by: GoKubar <[email protected]>
@GoKubar
GoKubar merged commit 35ead1c into main Sep 15, 2026
20 of 21 checks passed
GoKubar added a commit that referenced this pull request Sep 15, 2026
@GoKubar
GoKubar deleted the mac/ft-070-window-consumer branch September 16, 2026 04:17
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