Skip to content

presentations export: a picture is kept only from a frame drawn after its staging (tracker P4 (presentations, export)) - #329

Merged
SSFSKIM merged 2 commits into
masterfrom
presentations-export-staged-frame
Oct 29, 2026
Merged

SSFSKIM merged 2 commits into
masterfrom
presentations-export-staged-frame

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

The flake and its cause

e2e/presentations-export.spec.ts, "the export entries under Deck actions save each format where the owner chooses", now and then found two identical PNGs among the three that PNG (all slides) saves (tracker row "P4 (presentations, export)"; sightings 40125301159, 40124518939, 40743240635, 40797738368).

A throwaway probe, not in this PR, ran the all-slides export 160 times on a hosted Mac, half of them with every core busy, and classified each PNG by its top-left pixel. On master's code (40805188367), 9 of 160 exports were wrong, idle (4 of 80) and loaded (5 of 80) alike:

  • 7 times slide-02.png was byte for byte slide-01.png: the body's picture showed the cover;
  • 2 times slide-03.png was byte for byte slide-02.png: the hidden slide's picture showed the body.

Each wrong picture was the slide staged just before, so the window was copied before the deck had moved to its next slide. No two writes raced to one name. The export window is an offscreen BrowserWindow, and capturePage copies the frame the compositor drew last. STAGE's two requestAnimationFrames show only that the page has handed its staging to its compositor, not that this frame has been drawn yet. The cover never shows the fault: the page as loaded already shows the cover on top.

With this change, the same probe (40806676854) got 160 of 160 right.

The change (src/main/presentations/export.ts)

  • The deck window is one row taller (1920×1081). Each staging draws a 1 px mark of its own along that last row, in the same task as its last DOM change. The marks are two colours in turn: a stale copy can only be the staging before, which drew the other mark.
  • stagedCopy copies the picture's rect down to that row and keeps it, cut to the rect, only when the row shows this staging's mark. Otherwise it copies again after the window's next paint. A window that has not drawn the staging within 10 s fails the export, naming the slide, rather than give a wrong picture.
  • The staging hides the viewport's scrollbars (scrollbar-width: none on the root). With macOS's "always" scrollbars, an unclipped element could otherwise bring a horizontal scrollbar that lifts the fixed mark off the last row. The reviewer's Electron probe showed that would make a valid element export time out.
  • A grown window (an element larger than the slide) keeps the row below its content. The picture's top is clamped so the mark row is never inside a picture.

Every picture taken through the deck window goes through this: the all-slides PNGs, the single PNG and artifact_screenshot's slide, PPTX pictures and element fallbacks, the PDF's embed pictures, and a design's PNG and PDF embeds.

A copy the compositor refuses (second commit, 93f01d5)

Chromium's compositor now and then refuses a capturePage copy: it rejects with UnknownVizError. The merge-tree gate (run 40811348904) met it once, as a flaky pass at e2e/design-export.spec.ts:236, failing at :267. CI-opt's hosted flake row has the same signature at :193 from before this change. The browser view's still already retries this (src/main/browser/view.ts); the deck window did not, and stagedCopy may now take more than one copy per staging. stagedCopy now asks again 16 ms after a refusal, at most four times, then fails the export naming the slide. Any other rejection fails at once.

Tests

  • Unit (src/main/presentations/export.test.ts): a stand-in window whose compositor draws each staging 20 ms late. The three slides come back cover, body, gone; on master they come back cover three times. A window that never draws the staging fails, naming the slide; on master it resolves with the stale picture. Both new cases fail against master's export.ts and pass here. The drawn-offset case now checks the region of the picture, not of the copy.
  • Unit, the refusal: a window whose first copy is refused gives its picture on the second. One that keeps refusing fails after five copies naming the slide. Another rejection fails at once. Both cases fail against the first commit and pass here.
  • e2e: the Deck-actions case now checks that each file shows its own slide, not only that the three differ. On a failure it prints, for each file: its name, the slide it was captured for, its sha256, its size and what it shows (for example slide-02.png, the capture of slide body: sha256 7b2700baeab1…, … bytes, shows cover).

Runs

On the head, 93f01d5:

On the first commit (1023501), unless named otherwise:

  • Failing first: the probe on master's code, 40805188367, 9 of 160 wrong. The unit cases above fail against master's export.ts.
  • The probe on the fix before the review's scrollbar rule (6d9861b, the same capture logic): 40806676854, 160 of 160 right.
  • e2e:presentations on the hosted Mac lane, five runs, each 38 passed and 10 skipped with no flaky: line: 40807586667, 40808055109, 40809237836, 40809682777, 40810027141.
  • Cost: the 100-slide case's pptx/pictures took 13.8, 17.7, 11.0, 18.0 and 13.7 s at loads 12 to 17, against 14.3 s at load 15 for master on a hosted Mac (40743240635). No measurable cost; the 55 s budget is far off.
  • Class 1a (static, unit, probes on the pool): green in 40809243790.
  • Your merge-tree gate of the first commit: 40811348904.

Review

doperpowers reviewer-medium on 816da78..3fa504c. Its one finding, P2 (the scrollbar case above, found with an Electron probe), is fixed in this head and has no test of its own: a hosted Mac's scrollbar setting cannot be forced from the e2e. doperpowers reviewer-low on the second commit (1023501..93f01d5): no findings.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)

… its staging

The Deck-actions case in e2e/presentations-export.spec.ts now and then found two identical PNGs among the three the
all-slides export saves (four sightings in a week). A probe that ran that export 160 times on a hosted Mac (run
40805188367, master's code) caught 9: seven times slide-02 was byte for byte slide-01 (the body's picture showed the
cover) and twice slide-03 was slide-02 (the hidden slide's showed the body), idle and under load alike. Each time the
picture was the slide staged before: the export window copied its surface before the compositor had drawn the new
staging. STAGE's two animation frames show only that the page has handed its staging to its compositor; the copy is
of the frame drawn last.

Each staging now draws a mark of its own (two colours in turn) along a row added below the window's 1920x1080, in the
same task as its last change, and the capture copies the picture's rect down to that row and keeps it only when the
row shows the mark, else copies again after the window's next paint; a window that has not drawn the staging in 10 s
fails the export naming the slide rather than give a wrong picture. The staging also hides the viewport's scrollbars,
which would lift the fixed mark off the last row (the review's finding, with "always" scrollbars). Every picture
taken through the deck window gains this: the all-slides PNGs, PPTX pictures, the PDF's embeds, a design's PNG.

Unit tests: a window whose compositor draws each staging 20 ms late gives cover, body, gone (master: cover three
times), and one that never draws it fails naming the slide (master: resolves with the stale picture). The e2e case
now checks each file shows its own slide, and on failure prints each file's name, the slide it was captured for,
its sha256, size and what it shows.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T03:17:40.144580Z 1023501 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…n, within a bound

Chromium's compositor now and then refuses a capturePage copy (it rejects with UnknownVizError): the merge-tree gate
of #329 met it once at e2e/design-export.spec.ts:267 (run 40811348904, a flaky pass), and CI-opt's hosted flake row
has it at :193 from before the staged copy. The browser view's still already copies again a frame later
(src/main/browser/view.ts); the deck window did not, and stagedCopy can now take more than one copy per staging.

stagedCopy asks again 16 ms after a refusal, at most four times, then fails the export naming the slide; any other
failure of the copy is not retried. Unit tests: a window whose first copy is refused gives its picture on the second;
one that keeps refusing fails after five copies naming the slide; another rejection fails at once.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
@SSFSKIM
SSFSKIM merged commit 74f9a7e into master Oct 29, 2026
SSFSKIM added a commit that referenced this pull request Oct 29, 2026
…ly from a frame drawn after its staging, and asks again when the compositor refuses a copy) and PR #326 (comment-mode picks move until the frame hears them); tracker rows P4 (W) and P4 (presentations, export) closed, the hosted flake row's signature (5) with them

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
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