Skip to content

ci: split visual + preview into independent jobs - #394

Merged
mmcky merged 2 commits into
mainfrom
ci/split-build-visual-preview-jobs
May 27, 2026
Merged

mmcky merged 2 commits into
mainfrom
ci/split-build-visual-preview-jobs

Conversation

@mmcky

@mmcky mmcky commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Decouples the Netlify preview deploy from the visual regression gate, so the preview always deploys regardless of whether visual tests pass.

Why

Spotted while working on #388. The single-job ci.yml ran visual tests, then conditionally deployed Netlify only if everything succeeded:

```
Run Visual Regression Tests (continue-on-error: true)
Upload artifacts
Post PR comment
Fail if Visual Tests Failed ← exits with 1 on failure
Preview Deploy to Netlify ← skipped on failure
```

So for any PR with intentional design changes (the entire point of `/update-snapshots`), the workflow failed before the preview deployed — exactly the case where reviewers need the preview link to decide whether the diff is intentional. Chicken-and-egg.

What changes

Single `tests` job → three jobs (`build`, `visual`, `preview`):

```
build → visual (gate; may fail, posts PR comment)
↘
preview (always runs; deploys Netlify regardless of visual)
```

  • `build` checks out theme + fixtures, installs deps, runs `jb build`, and uploads `fixtures/_build/html` as an `actions/upload-artifact` artifact
  • `visual` and `preview` both `needs: build`, download the artifact, and run in parallel
  • Neither depends on the other — visual failure no longer blocks preview

Trade-offs considered

  • Versus reordering steps in a single job (the minimal fix): rejected because conceptual separation of "test" and "preview" is the actual win here. Future maintainers reading the workflow will see independent jobs with clear responsibilities, rather than steps in a sequence where ordering matters.
  • Versus splitting into separate workflow files: rejected because that would duplicate the build steps (~1 min of fixtures clone + pip install + `jb build`) per CI run.
  • Versus uploading artifact and consuming in two jobs: chosen — single build, two consumers, no duplication.

Branch protection

Verified main is not currently protected with required status checks. The single `tests` job → three jobs (`build` / `visual` / `preview`) renames are safe; no required check needs migration.

Test plan

  • CI runs on this PR; all three jobs visible
  • `build` succeeds and uploads the artifact
  • `visual` succeeds (no design changes here; baselines should match)
  • `preview` succeeds and posts the Netlify URL
  • Open a future PR with intentional visual changes — confirm `visual` fails but `preview` still deploys

Follow-ups

🤖 Generated with Claude Code

The single-job ci.yml ran visual tests before the Netlify preview deploy
and made the deploy conditional on the previous step succeeding. When
visual tests failed (which they will for any PR with intentional design
changes), the preview never deployed — exactly the case where reviewers
need it most to decide whether the diff is intentional and to comment
/update-snapshots.

Restructured into three jobs:

  build  →  visual   (gate; runs tests, may fail)
         ↘
           preview   (always runs; uploads Netlify artifact)

`build` produces fixtures/_build/html once; visual and preview both
download it as an artifact and run in parallel. Visual failure no longer
blocks preview deploy. The visual job's pass/fail status accurately
reflects test results; the preview job's status accurately reflects
deploy success.

Branch protection on main was confirmed not to require specific check
names, so renaming the single `tests` job to three jobs (`build`,
`visual`, `preview`) is safe.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings May 27, 2026 11:04
@github-actions

github-actions Bot commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

@github-actions
github-actions Bot temporarily deployed to pull request May 27, 2026 11:05 Inactive
@codecov

codecov Bot commented May 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@b2cc1b4). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #394   +/-   ##
=======================================
  Coverage        ?   47.75%           
=======================================
  Files           ?        2           
  Lines           ?      423           
  Branches        ?        0           
=======================================
  Hits            ?      202           
  Misses          ?      221           
  Partials        ?        0           
Flag Coverage Δ
pytests 47.75% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restructures the visual-regression CI workflow so that Netlify previews deploy independently of (and in parallel with) visual regression gating, ensuring reviewers still get a preview link even when intentional UI changes cause snapshot failures.

Changes:

  • Split the prior single CI job into three jobs: build (produces fixtures HTML), visual (runs Playwright visual regression and gates), and preview (deploys Netlify from the build artifact).
  • Publish fixtures/_build/html as an artifact from build, then consume it from both visual and preview via artifact download.
  • Document the CI behavior change in the Unreleased CHANGELOG.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/ci.yml Splits CI into build/visual/preview jobs and wires them via an uploaded fixtures artifact to decouple preview deploy from visual gating.
CHANGELOG.md Notes the CI workflow split and the behavior change that preview deploy is no longer blocked by visual failures.

Comment thread .github/workflows/ci.yml Resolved
Comment thread .github/workflows/ci.yml Resolved
@github-actions

github-actions Bot commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Visual Regression Test Results

passed  103 passed
skipped  3 skipped

Details

stats  106 tests across 1 suite
duration  3 minutes, 48 seconds
commit  26111e0

Skipped tests

desktop-chrome › theme.spec.ts › Visual Regression Tests › prob-matrix - full page screenshot
mobile-chrome › theme.spec.ts › Visual Regression Tests › prob-matrix - full page screenshot
mobile-chrome › theme.spec.ts › Theme Features › f-string interpolation styling

- Add explicit top-level permissions block (contents:read, actions:read,
  pull-requests:write). Previously the workflow relied on the repo/org
  default GITHUB_TOKEN permissions; if those flip to read-only, the
  PR-comment steps (daun/playwright-report-summary, nwtgck/actions-netlify)
  silently break. Making it explicit is least-privilege and future-proof.

- Add fork guard on the preview job. PRs from fork repos don't get
  NETLIFY_AUTH_TOKEN / NETLIFY_SITE_ID secrets, so the Netlify deploy
  would fail and block external contributors' CI. Skip the deploy when
  the PR head isn't in the canonical repo. Matches the existing codecov
  guard pattern in tests.yml:51.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@mmcky
mmcky merged commit 9b7c8d7 into main May 27, 2026
11 checks passed
@mmcky
mmcky deleted the ci/split-build-visual-preview-jobs branch May 27, 2026 11:18
mmcky added a commit that referenced this pull request May 27, 2026
…ation)

The permissions block landed in #394 was too narrow: it granted only
contents:read and pull-requests:write, but nwtgck/actions-netlify posts:
  - Commit comment       — needs contents:write
  - GitHub deployment    — needs deployments:write
  - Commit status        — needs statuses:write

All three failed 403 on the first run of #388 against the new 3-job CI.
The deploy itself succeeded (Netlify side), but reviewers had no link
visible from the PR — exactly the problem the CI split was supposed to
solve. Broadening permissions to cover all three.

The PR-comment posting (daun/playwright-report-summary) still uses the
pull-requests:write permission and was unaffected.

This commit lives on #388 because it's the PR currently surfacing the
bug; once merged, future PRs benefit. Belongs in the CI infrastructure
conceptually — counts as completing the work started in #394.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
mmcky added a commit that referenced this pull request Jun 4, 2026
…#388)

* fix: make RHS "On this page" TOC scrollable on overflow (#387)

Long lectures with deep section structure could clip the right-hand
sticky TOC at the viewport bottom with no scrollbar, leaving sections
unreachable from the panel.

Add a fade-out mask to hint at clipped content, and enable overflow-y:
auto with a discreet scrollbar on hover/focus so users can reach the
hidden entries.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix: soften LHS sidebar boundary with white background (#387)

The grey (#efefef) LHS sidebar sat hard against the white main content,
making the layout feel crowded. Switch to a white background and keep
the 1px right border so the boundary remains visible but softer.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* fix: tint LHS sidebar with translucent header colour (#387)

Pure white made the sidebar bleed into the main content with only the
1px border holding the boundary. Use the toolbar's #efefef at 40%
opacity so the sidebar reads as part of the chrome (top bar + sidebar)
while staying lighter than the toolbar itself.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* docs: clarify RHS TOC fade-mask comment (#387, #388 review)

The previous comment claimed the fade was "invisible when nothing
overflows" — that's misleading. Because the mask is on a max-height
container (not a fixed-height one), the bottom 2rem fade also softens
the final visible entry when content fits within the viewport.

Rewrite the comment to describe the actual unconditional behaviour
and the trade-off accepted by going pure-CSS. Hover/focus still
removes the mask for full visibility.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* refactor: move LHS sidebar from position:fixed to position:sticky (#387)

Root-cause fix for the LHS sidebar / content overlap that translucency
exposed on Safari. The previous design used position:fixed for the
sidebar but didn't reserve margin-left on the content column, so at
viewport widths < ~1500px (most laptops) the centered 900px content
column slid underneath the sidebar. Two workarounds masked this:

  - opaque #efefef bg hid the content under the sidebar
  - box-shadow: ... 9999px rgba(255,255,255,0.8) painted a giant white
    halo at <=1340px

The translucency attempt in this PR's earlier commits removed mitigation
source:

  - .qe-sidebar at viewport >= 1200px: position:sticky, top:0, height:100vh
    — sidebar is a real flex column of .qe-main, takes its width, content
    claims the rest via flex-grow:1. No overlap. Sticky keeps it visible
    on scroll.
  - .qe-sidebar at viewport <= 1199px: reverts to position:fixed with
    opaque white background — current drawer behaviour preserved for
    narrow viewports where there isn't room for an in-flow column.
  - .qe-sidebar.inactive at >= 1200px: width collapses inline to 0 so
    content reclaims the row.
  - .qe-sidebar.inactive at <= 1199px: existing translate3d off-screen
    slide preserved.
  - Box-shadow 9999px workaround removed (no longer needed; nothing to
    mask).
  - Background-color: transparent at base — wide widths don't need any
    bg since sidebar sits next to content, not over it. Drawer width
    sets opaque white explicitly.

Verified locally at 1920 / 1440 / 1280 / 1024 / 1023 / 768:
  - 1280-1920: in-flow sidebar at full configured width, zero overlap
    with content
  - 1024-1023: drawer mode kicks in correctly (sidebar fixed, opaque
    white when open, off-screen when inactive)
  - elementsFromPoint probe at narrow widths confirms sidebar is
    on top at x < sidebar_width and content is on top beyond

All visual regression baselines will change (sidebar position shift on
every page); needs /update-snapshots after CI runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* UPDATE: Regenerate all visual snapshots (14 files)

* ci: trigger run on latest branch state (post snapshot regeneration)

GITHUB_TOKEN commits (the snapshot-update bot) don't trigger downstream
workflows. This empty commit forces CI to re-run on the post-baseline
state so the visual job can confirm the new layout matches the freshly
regenerated baselines.

* Anchor LHS sidebar to viewport top, restore toggle-to-sidebar relationship

After the in-flow refactor, the LHS sidebar started ~9rem below the
viewport top (combined padding from .qe-main and the legacy padding-top
on .qe-sidebar), leaving a visible gap between the toolbar's toggle
button at top-left and the sidebar's "Contents" header. The toggle no
longer felt anchored to anything visible.

Three coordinated changes restore the relationship:

  - .qe-toolbar: position:sticky -> position:fixed
    Fixed elements don't take layout space, so .qe-main starts at
    viewport top instead of being pushed down by the toolbar.
  - .qe-main: drop padding-top:4rem
    Toolbar clearance no longer needed here (it's on .qe-page now).
  - .qe-page: add padding-top:4rem
    Content (and the position:absolute RHS TOC, which is positioned
    relative to .qe-page's padding box) gets pushed below the toolbar,
    landing at the same visual y-offset as before.

Result: .qe-sidebar (position:sticky; top:0) extends visually to the
viewport top, behind the toolbar. Sidebar's existing padding-top:5rem
clears the toolbar internally so nav content reads cleanly below it.
The X toggle button now visually anchors to the sidebar's top-left
corner — slide-open animation reads as "drawer comes from the button".

Also fixes a regression introduced in the earlier in-flow refactor:
the drawer-width @media block was setting z-index:10 on .qe-sidebar,
which put it above the toolbar (z-index:2). At narrow widths with the
drawer open, the toggle button at top-left was hidden under the drawer,
leaving no way to close. Reverted to z-index:1 (matching the original
sidebar value) so toolbar stays on top and the toggle stays clickable.

Verified at 768 / 1024 / 1280 / 1440:
  - All widths: sidebar.top == 0 == toolbar.top (visually anchored)
  - Wide widths: in-flow, content sits to the right (no overlap)
  - Narrow widths: drawer over content; toolbar visible above drawer

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* ci: broaden permissions for Netlify action (fixes preview-URL notification)

The permissions block landed in #394 was too narrow: it granted only
contents:read and pull-requests:write, but nwtgck/actions-netlify posts:
  - Commit comment       — needs contents:write
  - GitHub deployment    — needs deployments:write
  - Commit status        — needs statuses:write

All three failed 403 on the first run of #388 against the new 3-job CI.
The deploy itself succeeded (Netlify side), but reviewers had no link
visible from the PR — exactly the problem the CI split was supposed to
solve. Broadening permissions to cover all three.

The PR-comment posting (daun/playwright-report-summary) still uses the
pull-requests:write permission and was unaffected.

This commit lives on #388 because it's the PR currently surfacing the
bug; once merged, future PRs benefit. Belongs in the CI infrastructure
conceptually — counts as completing the work started in #394.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* Revert to position:fixed sidebar with push-content for medium widths

The in-flow refactor (sidebar as flex column) eliminated the overlap bug
but produced a "packed" aesthetic at wide widths that lost the chrome-vs-
content distinction the old layout had. Reverting to position:fixed
sidebar restores the OLD look (left rail with content centered in
viewport, natural gap between them) while solving overlap via a different
mechanism.

Three-mode layout:

  - >=1500px:  sidebar fixed at left, content centered in viewport. Natural
               horizontal gap, no push needed. Classic three-column look.
  - 1024-1499: sidebar fixed at left, content pushed right via
               padding-left on .qe-main (250-300px + 2rem gutter). No
               overlap; content sits cleanly past the sidebar.
  - <1024:     drawer mode. Sidebar off-screen by default (.inactive),
               overlays content when user toggles.

Implementation:
  - .qe-sidebar: revert to position:fixed at all widths, restore opaque
    #efefef bg. Simpler than the in-flow/drawer split.
  - .qe-main: :has(.qe-sidebar:not(.inactive)) media queries push content
    right only when sidebar is actually visible AND the viewport would
    otherwise overlap. When user toggles sidebar off, content reclaims the
    width.
  - .qe-page: add min-width:0 so flex shrinking can override max-width:900
    when the container is narrower (without this, content overflows into
    the sidebar area at the narrow end of the push zone).

Removed workarounds:
  - box-shadow: ... 9999px (white halo at <=1340px) — was masking overlap;
    no longer needed.
  - In-flow @media blocks on .qe-sidebar — replaced by simpler position:
    fixed at all widths.

Kept from earlier commits in this PR:
  - RHS TOC fade-mask + overflow-y:auto on hover (unchanged, works
    regardless of sidebar approach).
  - Toolbar position:fixed (lets sidebar extend to viewport top, anchoring
    it to the toolbar's toggle button corner).
  - Drawer z-index:1 (below toolbar z-index:2, so toggle stays clickable).

Verified at 1920 / 1500 / 1440 / 1280 / 1100 / 1024 / 768:
  - >=1500: zero overlap, content centered in viewport ✓
  - 1024-1499: zero overlap, content pushed right cleanly ✓
  - <1024: drawer overlays content when open (expected) ✓

CHANGELOG updated to reflect the actual final design (not the in-flow
story that was tried and discarded mid-PR).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* Lighten LHS sidebar bg with rgba(239,239,239,0.4) at rail widths

Replaces opaque #efefef with a translucent tint at rail widths (>=1024px)
so the sidebar reads as a softer chrome surface rather than a hard gray
block. Drawer widths (<1024) keep the opaque bg because the sidebar
overlays content there and translucency would expose text bleed-through.

The 0.4 tint was tried earlier in this PR and rejected because the
overlap bug made content text visible through the sidebar at common
laptop widths. With the push-content design now in place (no overlap at
any rail-mode viewport), the same value reads cleanly.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

* UPDATE: Regenerate all visual snapshots (56 files)

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.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.

2 participants