Skip to content

ui-react: diagrams-export free-layout raster parity fails intermittently on identical source #2469

Closed

Description

@schlessera

Context

The main push CI for e137057574f1f3525621fce01a312a7d5e80269b (#2463) failed browser (2) with one case. That is run 39553824270, job 119069063876, artifact browser-proof-2 12324684199:

FAIL  diagrams-chromium (chromium)  ../ui-react/tests/browser/diagrams-export.layout.tsx > authored free layout light flattened paint retains exact pixels
AssertionError: FLATTENED_STATIC_RASTER_PARITY: expected false to be true
 ❯ ../ui-react/tests/browser/diagrams-export.layout.tsx:22:353

The shard result was 3798 pass / 1 fail / 6 skip. Fresh execution ran because browser input retention was unavailable ("unvalidated selected Worker capability audit").

The same tree passed. The job's checkout receipt records tree 787fd7ddca3b17680eaa4c7e1397a4768547e15f. #2463's ready-candidate confirmation (run 39511253973) passed browser (2) on merge checkout 230ce0e85aa80657af93f692081851b0e0ba4a9d, which has the same tree 787fd7dd…. #2463 itself changed only tests/frontmatter-parse-gate.test.ts. The preceding main push (e2deae1f3, run 39509050337) passed. So the comparison returned false intermittently on identical source.

The case is the light cell of the authored free-layout loop (packages/ui-react/tests/browser/diagrams-export.layout.tsx:22). It compares toStatic against toFlatSvg paint through diagramRasterComparison (packages/ui-react/tests/browser/diagram-export-command.ts:35-40), which captures before and after on one page via page.setContent. The failing log alone does not say which pixels differed; the retained artifact is analyzed below.

Retained-artifact evidence — 2026-10-21

Downloaded the existing browser-proof-2 artifact (ID 12324684199) from failed run 39553824270, without rerunning CI. Its tmp/proof-checkout.json identifies SHA e137057574f1f3525621fce01a312a7d5e80269b and tree 787fd7ddca3b17680eaa4c7e1397a4768547e15f; the Git commit API independently confirms that the passing merge checkout 230ce0e85aa80657af93f692081851b0e0ba4a9d has that same tree.

The helper already writes both captures under tmp/diagram-export-proof/<engine>/export-free-<theme>-{before,after}.png. Source at inspected main b7f6360a86be68f7da8cefa93c316ecc0bf9bf42 shows diagramRasterComparison (packages/ui-react/tests/browser/diagram-export-command.ts:35-40) returning Buffer.equals on the PNG files, rather than comparing decoded pixels. Decoding this failed artifact with Pillow into RGBA nevertheless confirms a real pixel difference:

  • Chromium light: both images are 716×436; exactly five pixels differ. Half-open difference bounds are (706,74)–(708,166), on the rounded right edge of the outer Ithaca group. Each changed color channel differs by one; alpha remains 255.
  • Before PNG SHA-256: c1faab8d3216c6d1090e6e362b6fc460f9e77a7fdd00268983f8626e6568967c.
  • After PNG SHA-256: 0dec6472ae16ba454caf0129300b881b5321bb56e1f5425aa80948e47c93b7b8.
  • Chromium dark/print and WebKit light/dark/print: all five corresponding pairs decode to identical RGBA pixels at the same dimensions.

For independent verification, decode each PNG with Image.open(path).convert("RGBA"), compare every pixel coordinate and report the nonzero count and half-open bounding rectangle. File-byte inequality alone is insufficient to infer changed pixels. Existing captures resolve the missing pixel-location evidence; they do not identify why paint differs. Font readiness, source markup/geometry, browser rendering/compositing state and any capture-order effect remain hypotheses until measured. No browser reproduction, causal attribution or passing fix is claimed.

Scope

Find out why an exact-pixel raster comparison of the same two documents can differ between runs of identical source, and make the comparison deterministic at that boundary.

Out of scope

  • Loosening the exact-pixel rule, adding tolerance, retrying, or skipping the case.
  • Changes to the flattening (toFlatSvg) or static export, unless the attribution shows that the two documents themselves differ.

Acceptance criteria

  • Reuse the existing two retained captures. On a parity failure, report their hashes/dimensions, decoded differing pixel count/bounds, and font readiness at capture time; retain the compared markup and relevant render/capture state needed to test the localized cause. Distinguish encoded-file inequality from decoded-pixel inequality. Diagnostics alone do not constitute attribution.
  • The cause is identified from such a receipt or from a controlled reproduction, and the fix is shown failing-first against it.
  • If bounded attempts produce neither, the attempts and their conditions are recorded here, the diagnostics from the first criterion are landed so the next natural failure is attributable, and the issue returns to needs: repro for the causal step.
  • The exact-pixel assertion and all other diagrams-export cases are unchanged.

Verification

The attributed failure receipt, or the controlled reproduction, with a restored control, then bun run check:pr --base origin/main and the selected hosted diagrams-chromium proof.

Contract impact

None.

Starting point

The investigation needs no further prerequisite. A natural failure receipt exists: run 39553824270, artifact browser-proof-2 (12324684199), with both captures, their hashes and dimensions, a decoded five-pixel difference localized to (706,74)–(708,166) on the rounded right edge of the outer Ithaca group, and a passing control on the identical tree. Start from those pixels and the retained images. A controlled reproduction and a failing-first fix are completion requirements, not entry conditions. Do not claim the mechanism is known.

2026-10-21 triage: supplied priority p2 for wanted, unscheduled CI verification work, and attached the issue to renderer epic #2079, whose static/flattened diagram export its full deliverable directly verifies.

2026-10-24: removed needs: repro and added agent-ready. The previous prerequisite asked for a causal receipt before starting an investigation whose acceptance criteria already require finding that cause, so the task depended on its own result. Rewrote that paragraph as the starting point and added a bounded fallback criterion. The exact-pixel rule and completion requirements are unchanged.

Activity

  1. added
    type: test
    area: ui-react
    area: ci
    needs: repro
    priority: p2
    on Oct 21, 2026
  2. added
    agent-ready
    and removed
    needs: repro
    on Oct 24, 2026
  3. schlessera commented on Oct 24, 2026

    @schlessera
    OwnerAuthor

    Body history preserved from before the 2026-10-24 relabel:

    Remaining reproduction prerequisite

    needs: repro remains for a causal receipt or controlled reproduction that distinguishes the localized paint/capture mechanism, with a restored control. Start from the five observed edge pixels and the already retained images rather than claiming no failure artifact exists. The original source-identity comparison establishes intermittency, not the responsible mechanism.

    2026-10-21 triage: supplied priority p2 for wanted, unscheduled CI verification work; no release urgency or milestone is inferred. The full deliverable directly verifies #2079’s static/flattened diagram export, so attach it to that existing renderer epic. This does not block unrelated epic children, loosen exact parity, or reopen the adopted visual design. No implementation or CI dispatch was performed.

  4. schlessera commented on Oct 28, 2026

    @schlessera
    OwnerAuthor

    Additional retained-artifact evidence — 2026-10-28

    This is another occurrence of the existing failure signature, with an identical PNG pair to the historical failure documented above. It does not establish the rendering/capture mechanism or resolve this issue.

    Fresh failure and identity

    • Main run 40710717966, browser (2) job 122895639065: authored free layout light flattened paint retains exact pixels, FLATTENED_STATIC_RASTER_PARITY, packages/ui-react/tests/browser/diagrams-export.layout.tsx:22:353. Result: 2674 passed / 1 failed; 72 test files passed / 1 failed. The retained case receipt also identifies this as the sole failed case.
    • Downloaded existing browser-proof-2 artifact 12826981824; metadata says unexpired, expiration 2026-11-04 15:06:30 UTC. Downloaded ZIP SHA-256 equals the API digest: 66ac9ff318a0b53b1bab4e14799711fe896a857134316beb5cb7ba1f4c73c6de.
    • tmp/proof-checkout.json identifies SHA 9dcdc2f3cdc07fd3bbd12d6641ddadd102637048, tree 6777fb8ddd62aa043149290c28773417ebd3b874, parent 627b1c9e6a4dd171a30689c1a7710b7e644eefd7. An independently fetched detached checkout agrees. Checkout receipt SHA-256: 8c6a0c915eed8cba7ba66e25ceaf0024aa32542cea350b8a4e8c79c4f1b0defd; case receipt SHA-256: d663c8ebb4489a957aa9f8c9ddb97967923765dea4a53c8b562c0bc3af00a84a.
    • Passing candidate run 40701263060, browser-proof-2 artifact 12822980740: its checkout receipt identifies tested merge SHA 4adba343128cce539da51abd24e9f06b181bcbc1 and the same tree 6777fb8ddd62aa043149290c28773417ebd3b874. The run's event head is a different identity from its tested merge checkout; the comparison here uses the artifact receipt. All three authored free-layout Chromium cases passed there.
    • The squash changes only packages/ui-server/tests/helpers/native-journal-fixture.ts, packages/ui-server/tests/native-journal-fixture.test.ts, and packages/ui-server/tests/ws-turn-journal.test.ts. This does not attribute the renderer failure to those changes.

    Encoded bytes and decoded pixels

    Decoded the retained tmp/diagram-export-proof/chromium/export-free-light-{before,after}.png with Pillow into RGBA and compared every coordinate. Both are 716×436. The encoded files differ, and the decoded pixels also differ: exactly five pixels, half-open bounds [706,74,708,166], matching the historical outer Ithaca group-edge signature. Each changed color channel has absolute delta 1; all alpha values remain 255.

    Before PNG SHA-256: c1faab8d3216c6d1090e6e362b6fc460f9e77a7fdd00268983f8626e6568967c.

    After PNG SHA-256: 0dec6472ae16ba454caf0129300b881b5321bb56e1f5425aa80948e47c93b7b8.

    Both hashes are exactly those recorded in this issue's historical artifact analysis. Per-coordinate RGBA values (before → after):

    (706, 74) (225,221,213,255) → (224,220,212,255)
    (707, 76) (177,170,160,255) → (177,170,159,255)
    (706,163) (197,192,180,255) → (197,191,180,255)
    (707,163) (178,171,161,255) → (177,171,161,255)
    (706,165) (228,224,217,255) → (227,223,216,255)
    

    Fresh Chromium dark/print pairs have identical file bytes and decoded RGBA. Fresh browser-proof-1 artifact 12826222833, whose receipt identifies the same main SHA/tree, contains WebKit light/dark/print pairs: all three are 716×436 and have identical file bytes and decoded RGBA within each pair. No additional free-layout capture pair exists in browser-proof-3.

    In the passing candidate artifact, Chromium light before and after both hash to 0dec6472…; they decode identically and match the fresh failure's after image. Thus the observed variation is in the static/before capture relative to that control. This is an observation about these retained images, not proof that static markup, geometry, font state or compositing caused it.

    Source inspection and limits

    At exact SHA 9dcdc2f3…, diagramRasterComparison (packages/ui-react/tests/browser/diagram-export-command.ts:35-40) sets the before/after content sequentially on one page, waits for document.fonts.ready, writes both PNGs, and returns Buffer.equals on the encoded PNG buffers. Decoding above independently rules out an encoding-only mismatch for this occurrence. diagramFixture (packages/ui-react/tests/browser/diagram-proof-command.ts:61-64) reads the adopted-homecoming-relay source fixture.

    The artifact retains these screenshots and general checkout/case/resource receipts, but does not retain the actual compared free-layout HTML/SVG strings, per-capture font status, computed styles, geometry or compositing state. Its native-export origin/release SVGs belong to a separate export case and cannot substitute for the missing free-layout markup. Source is available at the immutable checkout; regenerated markup would not be a capture-time receipt. Font readiness, actual markup/geometry, browser state and capture order therefore remain unmeasured causal alternatives. No controlled browser reproduction was performed.

    The main aggregate remains failed because browser (2) failed; the other executing category jobs succeeded, while pack was skipped. This evidence does not make that main run green, and a later passing run would not erase this failure. No source changes, renderer fix, assertion tolerance/retry/skip, CI rerun or journal-guard change was made. Exact parity and the issue's causal/failing-first completion requirements remain unchanged.

  5. self-assigned this
    on Nov 2, 2026
  6. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Claimed (token claim-2469-9c789bb7). Branch fix/2469-diagrams-raster-parity from epic/2079-module-renderers (a62db8f27); the PR targets that epic integration branch. Collision report for the cited files: closure-only overlaps with open drafts (#3054, #3056, #3059, #3069, #3116, #3277, #3279, #3288, #3292, #3293, #3295, #3298, #3301, #3304, #3305, #3306), none touching the cited files.

  7. added this to the 0.45.0 milestone on Nov 2, 2026
  8. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Cause found and fix opened: #3367 (targets epic/2079-module-renderers; this issue closes when the epic batch lands on main).

    Mechanism. Chromium partial raster. A dirty rectangle narrower than a raster tile is re-rastered into the tile it already painted, and curved anti-aliased edges in that rectangle come out one channel step away from a full raster. Only the before capture of a comparison is resized after its content loads. Under CPU contention, it can carry that history.

    Controlled reproduction. Pinned image, Chromium 153.0.8010.12. Paint the free layout at native size, overlay a strip such as [600,0,116,436], remove it, recapture. That deterministically produces c1faab8d3216c6d1090e6e362b6fc460f9e77a7fdd00268983f8626e6568967c, byte-identical to both CI failures' before. Dark gives its own alternate, f044f8b6…, for both static and flattened markup. Strips covering a whole tile column give the canonical hash.

    Starvation control. The command's exact sequence in 4 concurrent containers at --cpus=0.5: default 18/500 alternates; with --disable-partial-raster 0/500. Fonts were loaded at every capture, including every alternate.

    Fix. --disable-partial-raster for diagrams-chromium and the artifact reference browser, the flag editorial captures already use. A new sub-tile repaint guard was shown failing first on its own assertion (PARTIAL_REPAINT_RASTER_PARITY) with the flag removed. Parity failures now write an encoded/decoded/font-state receipt plus the compared markup. Full receipts are in the PR.

  9. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Delivered to the epic integration branch epic/2079-module-renderers as d1e1f3a23 via #3367, after ready-candidate proof passed against the exact epic base. This issue closes when the epic batch lands on main.

  10. removed their assignment
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: ciarea: ui-reactpriority: p2type: test

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions