Skip to content

fix(e2e): seed the current settings version in the theme spec - #277

Open
thetechjon wants to merge 1 commit into
mainfrom
autofix/test-e2e-gate-attachment-drag-on-hydrati
Open

fix(e2e): seed the current settings version in the theme spec#277
thetechjon wants to merge 1 commit into
mainfrom
autofix/test-e2e-gate-attachment-drag-on-hydrati

Conversation

@thetechjon

Copy link
Copy Markdown
Collaborator

Root cause

CI run 30167489426 failed on e2e/editor-selection-themes.spec.tsgetByTestId('folder-tree') not found (not merely slow) after 15s.

It is not a timing flake. seedSettings writes noteser-settings with version: 2, but the store persists at 4. So every run replays the migration ladder, and v2 → v3 with no legacy pinnedPanels hits the fallback at src/stores/settingsStore.ts:1100:

state.sidebarGroups = groups.length > 0
  ? groups
  : [{ id: 'default', tabs: ['calendar'], activeTab: 'calendar', collapsed: false }]

The Files panel — and folder-tree with it — is destroyed the moment persist rehydrates. The uploaded failure screenshot (thanks to the html reporter added in #275) shows exactly that: a sidebar with one Calendar group and no file tree.

Whether the test passed came down to whether Playwright's first poll landed before rehydration, while the DEFAULTS two-group layout was still painted. That explains why it failed on a different theme each time ("sepia" here, "default" in 30158105758), passed locally, and survived the expect-timeout bump.

Confirmed locally with a scratch probe (removed before commit) seeding each version and counting folder-tree after a 3s settle:

version=2 -> 0 elements, groups=[{tabs:["calendar"]}]
version=3 -> 1 element,  groups=[calendar/plugins/search, files/...]
version=4 -> 1 element,  groups=undefined (DEFAULTS)

The fix

  • Export SETTINGS_PERSIST_VERSION from settingsStore.ts and have the spec stamp that instead of a literal, so the next migration bump cannot silently re-break the spec.
  • Revert the 15s expect timeout from test(e2e): stop the folder-tree boot assert flaking CI #275 in both playwright configs. It was based on the wrong diagnosis, it fixed nothing, and its comment now misleads. The html reporter from that PR stays — its screenshot is what identified the calendar-only sidebar.

e2e/general-settings.spec.ts and e2e/nav-and-pin.spec.ts already seed v3 plus an explicit sidebarGroups record, so they were never exposed.

Note on provenance: this is a port of #276, which fixed the same bug on dev (CI green at 584b299). main never received it and still carries both the broken seed and the ineffective timeout, so the same flake is live on main's gate. Refs #276, #275.

Verification

Gate Result
npm run typecheck pass
npm run lint pass
npm test pass — 253 suites, 3235 tests
npm run e2e:ci (full suite, local) 39 passed, 2 failed

The 2 local e2e failures are toHaveScreenshot diffs on the default and solarized-dark themes at ratio 0.03 vs a 0.02 threshold — a font-metric delta between this machine and the Ubuntu runner (the diff image is glyph-width shift on identical text). They fail identically before and after this change and both pass on CI. The folder-tree boot assert now clears on all four themes, and reverting the timeout produced no boot-assert flakes across the full local suite.


Opened by the automated autofix bot. Awaiting human review — not merged by the bot.

The `folder-tree` boot assert in editor-selection-themes.spec.ts is not a
timing flake. The spec seeds `noteser-settings` with `version: 2` while the
store persists at 4, so every run replays the migration ladder, and v2 -> v3
with no legacy `pinnedPanels` falls back to a single calendar-only group
(settingsStore.ts:1100). The Files panel -- and `folder-tree` with it -- is
destroyed the moment persist rehydrates.

Whether the test passes comes down to whether Playwright's first poll lands
before rehydration, while the DEFAULTS two-group layout is still painted.
That is why it fails on a different theme each run, passes locally, and
survived the expect-timeout bump in #275.

Confirmed locally with a scratch probe (removed) seeding each version and
counting `folder-tree` after a 3s settle:

  version=2 -> 0 elements, groups=[{tabs:["calendar"]}]
  version=3 -> 1 element,  groups=[calendar/plugins/search, files/...]
  version=4 -> 1 element,  groups=undefined (DEFAULTS)

Export SETTINGS_PERSIST_VERSION from the store and stamp that, so the next
migration cannot silently re-break the spec. general-settings and
nav-and-pin already seed v3 plus an explicit sidebarGroups record, so they
were never exposed.

Also reverts the 15s expect timeout from #275: it was based on the wrong
diagnosis, it fixed nothing, and its comment now misleads. The html
reporter from that PR stays -- its uploaded screenshot is what identified
the calendar-only sidebar.

Ports #276 (already merged to dev) onto main, which still carries the bug.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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