Skip to content

fix(app): investigate reproducible loading indicator phase test failure #90

Closed

Description

@trmosala

Problem and impact

The existing browser unit test for synchronized CookieMonster loading indicators fails its phase comparison after late copies mount. A fresh hosted runner initially failed earlier because Chromium was missing; installing Chromium reveals this separate reproducible assertion failure. This blocks V2 unit verification. Investigate whether the shared-image animation behavior or the screenshot fixture is responsible before changing product behavior.

Priority: medium CI correctness investigation. No memory leak or data loss is claimed.

Reproduction

From packages/app, with the locked dependencies and Playwright Chromium installed:

bun test --conditions=browser --isolate --preload ./happydom.ts ./test-browser/cm-loading.test.ts

Reviewed CI follow-up 65618da109, descended from V2 base dafdcd4171466050c984d524ca0d1a09d31f100e. This work does not alter the loading component, assets, fixture, or test.

Actual: cm-loading.test.ts:117 fails after the 220 ms wait. The pixel comparison returns at least one difference greater than one between same-session indicators. Eight expectations execute before the failure.

Independently reproduced twice on local Linux against real headless Chromium: once during bounded type-checking, then again after the type-check finished. Both fail at the same line. The second run takes 3.53 seconds, with no concurrent coordinator type-check/build. This is a test-result observation, not proof that users see animation drift.

The hosted unit log proves the separate missing-browser prerequisite. The synchronization assertion above is independently reproduced locally; it was not reached in that hosted run.

Acceptance criteria

  • Identify whether duplicate same-session indicators drift or the pixel comparison samples inconsistent state.
  • Preserve synchronized late mounts, theme updates, session changes, and reduced-motion behavior.
  • The real-browser test passes with the existing semantic coverage. Do not skip it or simply increase the pixel tolerance or timeout.
  • Verify the browser unit suite on hosted Linux and Windows with Chromium installed.

Verification plan

Keep the current test as a regression. Capture the differing variants/phase or screenshot sampling state to establish the cause, then rerun the focused test and browser unit suite. The installed CM has not been restarted or modified.

Related: #87. Separate from history paging #89.

Activity

  1. trmosala commented on Oct 20, 2026

    @trmosala
    OwnerAuthor

    Additional bounded local diagnostic using the same production fixture and original assertion, without editing committed source:

    • Headless Chromium reports version 147.0.7727.15.
    • Variant order: bounce, chomp-rebuild, pixel-rebuild, assemble, flip-3d, spin.
    • Maximum channel differences for recent versus project: [0, 0, 0, 2, 0, 0]; tabs versus project: [0, 0, 0, 2, 0, 0].
    • This sample fails the existing tolerance of one. The temporary diagnostic test was removed afterward.

    The mismatch is small and confined to assemble in this sample. This does not establish phase drift; investigate raster rounding/cropping as well as animation synchronization before changing production code or the test tolerance. The original test still fails unmodified.

  2. trmosala commented on Oct 20, 2026

    @trmosala
    OwnerAuthor

    Fresh hosted evidence on the same CI head: the Linux browser-unit loading test passed in 4.148 seconds after Chromium installation. The unit job then failed a separate PowerShell shell-tool case at its existing 5-second test timeout.

    Thus #90 is currently a local/Linux-environment reproducibility and fixture-portability investigation, not a consistently failing hosted-Linux animation regression. This strengthens the need to distinguish raster/sampling differences from actual phase drift. Hosted Windows verification is still running.

  3. trmosala commented on Oct 20, 2026

    @trmosala
    OwnerAuthor

    Hosted Windows now reproduces a different assertion in this same test: on head98b57d5349, unit job118528028541 fails line74 because the two flip-3d screenshots240ms apart are byte-identical. Thus #90 is now a verified Windows CI blocker, beyond the local assemble phase comparison. The earlier TypeScript launcher exit66 did not recur in this serial run.

    A controlled local probe reproduced the Windows assertion without changing production code: launch the locked Chromium with --force-prefers-reduced-motion while leaving Playwright default page emulation in place. The page reports prefers-reduced-motion:false and the loading-motion image has display:inline, but the two flip-3d screenshots remain identical and the test fails at the motion assertion. The temporary probe was removed.

    The external SVG asset contains its own @media(prefers-reduced-motion:reduce) rule. The result is consistent with a browser/system reduced-motion setting affecting that SVG image independently of page media emulation. This is a hypothesis supported by a controlled reproduction, not proof of the Windows runner's actual preference; capture that preference/environment before choosing the fix. Preserve testing both motion and reduced-motion behavior, with no skipped assertions or arbitrary timeout/tolerance increase.

  4. trmosala commented on Oct 20, 2026

    @trmosala
    OwnerAuthor

    Controlled follow-up distinguishes the browser-level preference switches:

    • --force-prefers-reduced-motion reproduces Windows line74 locally: PNGs remain identical, despite page matchMedia reporting reduce:false.
    • Adding a value to that same switch, --force-prefers-reduced-motion=no-preference, still freezes motion. Do not use it as a normal-motion override.
    • The dedicated switch --force-prefers-no-reduced-motion passes the motion assertion locally. The same unchanged test then reaches and fails the already-reproduced line117 phase comparison.

    The locked Chromium147 headless binary contains the dedicated normal-motion switch. Chromium's preference implementation checks the presence of the reduced-motion switch first and then its distinct no-reduced-motion counterpart, explaining why a value on the first switch did not turn it off.

    Both probe tests were temporary and removed; production application behavior and repository tests are unchanged. This provides a candidate way to make the fixture's initial motion environment explicit, subject to hosted Windows verification. It does not fix or waive the separate local assemble phase/raster comparison. Preserve explicit reduced-motion fallback checks later in the fixture.

  5. trmosala commented on Oct 20, 2026

    @trmosala
    OwnerAuthor

    A further controlled Linux reproduction separates geometry from the pixel comparison failure. The diagnostic copy keeps every original assertion and forces normal browser motion with the distinct --force-prefers-no-reduced-motion switch. The first motion assertion passes. The initial single-screenshot phase comparison has zero differences; after 220 ms the unchanged phase assertion fails with a maximum channel difference of 2 for only the tabs copy of assemble. Other comparisons remain zero.

    At both samples, devicePixelRatio is 1 and all 18 SVG bounds have integer x, y, width and height. Their computed colors are identical. Fractional SVG/crop bounds therefore do not explain this reproduction. This does not prove animation-phase drift or identify the remaining raster/filter cause. No production file, timeout or image tolerance was changed. The temporary diagnostic file was removed after the run.

    The earlier hosted Windows failure is separately reproduced again in SDK PR #92 Windows job: it stops at the unchanged motion assertion on line 74. The local two-channel-level comparison failure remains a distinct investigation.

  6. trmosala commented on Oct 21, 2026

    @trmosala
    OwnerAuthor

    Merged into CM-Split-v2 as 290d7d6353c0c7a4a356af780b5687f2dcfe5cfc through PR #96. Its tree exactly matches reviewed source 68ab9205709350385471eb2d383b3cff3c18e678.

    Implemented in PR #96, reviewed source 68ab9205709350385471eb2d383b3cff3c18e678.

    The real-browser fixture now samples a consistent shared-image animation phase and explicitly sets the native SVG reduced-motion preference. Late mounts, theme updates, session changes and reduced-motion checks remain; neither pixel tolerance nor timeout was increased.

    Final verification is deferred at the user's explicit request to finish and close the implementation issues before one final test pass. This closure records implementation completion, not a claim that the final combined/platform checks have passed. Any failure in that pass will be recorded against the relevant issue.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions