Skip to content

chore(chromatic): fit the snapshot surface inside the free plan - #8208

Merged
kyle-ssg merged 9 commits into
mainfrom
chore/chromatic-token-coverage-and-layout-skip
Aug 4, 2026
Merged

chore(chromatic): fit the snapshot surface inside the free plan#8208
kyle-ssg merged 9 commits into
mainfrom
chore/chromatic-token-coverage-and-layout-skip

Conversation

@talissoncosta

@talissoncosta talissoncosta commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to #6606

We're on Chromatic's free plan and run out of snapshots mid-period, which is why builds sat yellow and the repo got unlinked. 217 stories are capturable, so any build that can't use TurboSnap costs 434 snapshots. 8 July alone burned 2,766.

Snapshots are now off by default in preview.js and opted into on 13 story files: the components still styling dark mode with hand-written .dark blocks rather than tokens, where the two themes can quietly drift apart. 41 exports, so a build without TurboSnap costs 82 instead of 434.

Used disableSnapshot rather than onlyStoryFiles because the action rejects that alongside onlyChanged, and dropping TurboSnap instead is worse: with no baseline inheritance, every build pays for the whole set.

Also narrows the pull_request trigger from frontend/** to the same paths as push, so e2e specs and service changes stop starting builds.

How did you test this code?

Audited the result by script: 13 opted-in files, 41 capturable exports. Typecheck caught a duplicate chromatic key I'd added to Modal.stories.tsx, now folded into the existing one. eslint clean.

Not verified yet. The account is out of snapshots until 17 August and the build here says so, so nothing was captured. On the first build after that which reports TurboSnap disabled, the count should be ~82. If it's 434, the parameter isn't inheriting from preview.js.

talissoncosta and others added 3 commits August 3, 2026 11:24
The token stories were the only design system layer with no visual
coverage at all, so a changed value in tokens.json was caught only
indirectly, via whichever component story happened to consume it.

Enables snapshots for the five stories that render specimens: semantic
colours, the primitive palette, radius, elevation and motion. Left off:
TokenReference (a text table of variable names, no visual signal, exists
for MCP) and CategoricalPalette (hardcoded tag and project hexes, not
tokens).

Motion is safe to capture; its only animation is a CSS transition on
click, unlike Loader's SVG animateTransform which Chromatic cannot pause.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Row, Column and Flex render a single div with flexbox classes. They carry
no colour, radius or shadow, so no design token can change how they look
and their light and dark captures are identical. With both modes enabled
that is 18 snapshots per full build for a diff that cannot occur.

BareButton was considered and kept: it does reference tokens, via a
focus-visible ring using --color-border-action and --radius-sm.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The pull_request trigger matched frontend/**, so a change to an e2e spec,
an RTK service or an API type started a Chromatic build that TurboSnap
then found nothing to capture in. Aligns it with the narrower push path
list, and adds package.json to both, since a dependency bump can change
rendering and is also where TurboSnap bails to a full build.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@talissoncosta
talissoncosta requested review from a team as code owners August 3, 2026 14:24
@talissoncosta
talissoncosta requested review from kyle-ssg and removed request for a team August 3, 2026 14:24
@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview Aug 3, 2026 8:55pm
flagsmith-frontend-staging Ready Ready Preview Aug 3, 2026 8:55pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Aug 3, 2026 8:55pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The frontend Chromatic workflow now uses narrower path filters and includes frontend/package.json. Storybook disables Chromatic snapshots by default. Token and component stories explicitly enable snapshots or remove prior exclusions while retaining existing layout and delay settings.

Estimated code review effort: 2 (Simple) | ~10 minutes


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the front-end Issue related to the React Front End Dashboard label Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-8208 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-8208 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-8208 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-8208 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-8208 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-8208 Finished ✅ Results

@github-actions github-actions Bot added the chore label Aug 3, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e1c85d69-bd3c-4203-9138-54302a691ac4

📥 Commits

Reviewing files that changed from the base of the PR and between dc7f354 and 0559612.

📒 Files selected for processing (9)
  • .github/workflows/frontend-chromatic.yml
  • frontend/documentation/ColourPalette.stories.tsx
  • frontend/documentation/ElevationTokens.stories.tsx
  • frontend/documentation/MotionTokens.stories.tsx
  • frontend/documentation/RadiusTokens.stories.tsx
  • frontend/documentation/SemanticTokens.stories.tsx
  • frontend/documentation/components/Column.stories.tsx
  • frontend/documentation/components/Flex.stories.tsx
  • frontend/documentation/components/Row.stories.tsx

Comment thread .github/workflows/frontend-chromatic.yml Outdated
Comment thread .github/workflows/frontend-chromatic.yml Outdated
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-16 — run #18969 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 2 seconds
commit  0d1653f
info  🔄 Run: #18969 (attempt 1)

🗂️ Previous results
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18969 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  53.3 seconds
commit  0d1653f
info  🔄 Run: #18969 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #18969 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  45.5 seconds
commit  0d1653f
info  🔄 Run: #18969 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #18969 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  38 seconds
commit  0d1653f
info  🔄 Run: #18969 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18968 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  1 minute, 10 seconds
commit  87129be
info  🔄 Run: #18968 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #18968 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  32.4 seconds
commit  87129be
info  🔄 Run: #18968 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #18968 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  44.4 seconds
commit  87129be
info  🔄 Run: #18968 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #18968 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  40 seconds
commit  87129be
info  🔄 Run: #18968 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-arm-16 — run #18967 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 2 seconds
commit  2bc0904
info  🔄 Run: #18967 (attempt 1)

✅ private-cloud · depot-ubuntu-latest-16 — run #18967 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  32.1 seconds
commit  2bc0904
info  🔄 Run: #18967 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #18967 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  45 seconds
commit  2bc0904
info  🔄 Run: #18967 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #18967 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  37.8 seconds
commit  2bc0904
info  🔄 Run: #18967 (attempt 1)

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.71%. Comparing base (fc33002) to head (0d1653f).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8208   +/-   ##
=======================================
  Coverage   98.71%   98.71%           
=======================================
  Files        1531     1531           
  Lines       61263    61263           
=======================================
  Hits        60475    60475           
  Misses        788      788           

☔ View full report in Codecov by Harness.
📢 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.

We are on the free 5,000-snapshot plan and demand is roughly 20,000 a
month, so snapshots stop being captured part-way through every billing
period. The full surface is 217 capturable stories, which makes any build
that cannot use TurboSnap cost 434 snapshots; 8 July alone burned 2,766.

Scopes captures to 17 story files via onlyStoryFiles: the five token
specimen stories, plus the twelve components whose dark appearance comes
from a hand-written `.dark` override rather than from a token, which are
the only ones where a snapshot can catch drift. That is 45 story exports,
or roughly 3,710 snapshots a month at the current build volume.

onlyStoryFiles rather than onlyStoryNames because several story titles
contain spaces and the action does not document how it splits list inputs.

Unverified: the quota is exhausted until 17 August, so this cannot be
tested against a real build until then. Check the first build's snapshot
count before assuming the allowlist took effect.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added chore and removed chore labels Aug 3, 2026
@talissoncosta talissoncosta changed the title chore: snapshot design token stories, skip layout-only primitives chore(chromatic): fit the snapshot surface inside the free plan Aug 3, 2026
Four of the five token documentation stories earn nothing:

- MotionTokens: a static image cannot show duration or easing.
- RadiusTokens, ElevationTokens: specimen sheets for tokens that Button,
  Card, Panel, Chip, Input and Modal already exercise, all of which are
  in the allowlist.
- ColourPalette: renders _primitives.scss, the hand-maintained duplicate,
  not tokens.json.

All four print token values as text, which the git diff of tokens.ts and
_tokens.scss already shows whenever tokens.json changes. That is the same
reason TokenReference is excluded.

SemanticTokens stays. It renders live swatches read from the stylesheet,
so it is the only place tokens no component exercises are visible: the
nine code-* colours, surface-info, text-tertiary.

Scope is now 13 story files, 41 exports, ~3,460 snapshots a month.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fcbcbced-ba48-486d-8604-cb78b7aa2f66

📥 Commits

Reviewing files that changed from the base of the PR and between 0559612 and 5a86451.

📒 Files selected for processing (1)
  • .github/workflows/frontend-chromatic.yml

Comment thread .github/workflows/frontend-chromatic.yml Outdated
@github-actions github-actions Bot added chore and removed chore labels Aug 3, 2026
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/frontend-chromatic.yml (1)

106-119: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Include BareButton in the allowlist.

frontend/documentation/components/BareButton.stories.tsx exists, but onlyStoryFiles only lists Button.stories.tsx, so the workflow will not run BareButton stories. Add documentation/components/BareButton.stores.tsx and keep the allowed story count in scope.

♻️ Duplicate comments (1)
.github/workflows/frontend-chromatic.yml (1)

20-31: ⚠️ Potential issue | 🟠 Major

Include frontend/package-lock.json in both trigger lists.

The changed path lists add frontend/package.json, but not frontend/package-lock.json. The workflow uses the lockfile for the npm cache at Line 64 and for npm ci at Line 67. A lockfile-only dependency update will skip this workflow, so Chromatic will not validate the resulting Storybook dependency graph. GitHub path filters match changed file paths, and npm ci requires the committed lockfile. (docs.github.com)

Add frontend/package-lock.json to both push.paths and pull_request.paths.

#!/usr/bin/env bash
set -euo pipefail

python3 - <<'PY'
from pathlib import Path
import re

lines = Path(".github/workflows/frontend-chromatic.yml").read_text().splitlines()
required = "frontend/package-lock.json"
found = {}

for event in ("push", "pull_request"):
    start = next(i for i, line in enumerate(lines) if line == f"  {event}:")
    end = next(
        (i for i in range(start + 1, len(lines))
         if re.match(r"^  \S", lines[i])),
        len(lines),
    )
    block = lines[start:end]
    paths_start = next(i for i, line in enumerate(block) if line.strip() == "paths:")
    paths_end = next(
        (i for i in range(paths_start + 1, len(block))
         if re.match(r"^    \S", block[i])),
        len(block),
    )
    found[event] = {
        line.strip()[2:].strip("'\"")
        for line in block[paths_start + 1:paths_end]
        if line.strip().startswith("- ")
    }

missing = [event for event in ("push", "pull_request") if required not in found[event]]
if missing:
    raise SystemExit(f"Missing {required} from: {', '.join(missing)}")
PY

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 64afb4f4-eab9-4aba-843b-5cab2884e640

📥 Commits

Reviewing files that changed from the base of the PR and between 5a86451 and 324df23.

📒 Files selected for processing (1)
  • .github/workflows/frontend-chromatic.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
.github/workflows/frontend-chromatic.yml (1)

14-24: ⚠️ Potential issue | 🟠 Major

Include frontend/package-lock.json in both trigger path lists.

The changed lists add frontend/package.json, but not frontend/package-lock.json. A lockfile-only dependency update will not trigger this workflow. The job uses the lockfile for the npm cache at Line [58] and runs npm ci at Line [61]. Add the lockfile to both push.paths and pull_request.paths; npm ci requires an existing lockfile and rejects mismatches with package.json. (docs.npmjs.com)


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 28118bc6-65a8-4222-b6df-e2b39db5001f

📥 Commits

Reviewing files that changed from the base of the PR and between 324df23 and 962a7c1.

📒 Files selected for processing (4)
  • .github/workflows/frontend-chromatic.yml
  • frontend/documentation/components/Column.stories.tsx
  • frontend/documentation/components/Flex.stories.tsx
  • frontend/documentation/components/Row.stories.tsx

The action rejects the combination outright:

  ✖ You can only use one of --only-changed, --only-story-files

And dropping onlyChanged instead is worse: without TurboSnap there is no
baseline inheritance, so all 261 builds a month pay the full allowlist
rather than only the ones that bail.

disableSnapshot is a Storybook parameter rather than a CLI flag, so it
composes with onlyChanged. Off by default in preview.js, opted into on the
13 story files worth capturing. TurboSnap keeps clean builds cheap, and a
build that cannot use it captures 82 snapshots instead of 434.

Also reverts the Row/Column/Flex opt-outs, now redundant under a
default-off policy, and folds disableSnapshot into Modal's existing
chromatic parameter rather than adding a duplicate key.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c761ff7d-b31c-40d0-9543-3188c1e4da6e

📥 Commits

Reviewing files that changed from the base of the PR and between 962a7c1 and 2bc0904.

📒 Files selected for processing (15)
  • .github/workflows/frontend-chromatic.yml
  • frontend/.storybook/preview.js
  • frontend/documentation/SemanticTokens.stories.tsx
  • frontend/documentation/components/Button.stories.tsx
  • frontend/documentation/components/Card.stories.tsx
  • frontend/documentation/components/Chip.stories.tsx
  • frontend/documentation/components/ErrorMessage.stories.tsx
  • frontend/documentation/components/Icons.stories.tsx
  • frontend/documentation/components/Input.stories.tsx
  • frontend/documentation/components/Modal.stories.tsx
  • frontend/documentation/components/MultiSelect.stories.tsx
  • frontend/documentation/components/Panel.stories.tsx
  • frontend/documentation/components/Switch.stories.tsx
  • frontend/documentation/components/Tabs.stories.tsx
  • frontend/documentation/components/Tooltip.stories.tsx
💤 Files with no reviewable changes (1)
  • .github/workflows/frontend-chromatic.yml

Comment thread frontend/.storybook/preview.js Outdated
Both from CodeRabbit on #8208.

GitHub Actions has supported YAML anchors since September 2025, so the
duplicated path lists collapse into one, and the comment claiming otherwise
was wrong.

package-lock.json joins package.json: the job runs `npm ci`, which installs
from the lockfile, so a transitive bump can change rendering without
package.json moving. Missing it also left main's baseline stale after a
dependency update, which is what makes TurboSnap bail.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added chore and removed chore labels Aug 3, 2026
The comment named only the `.dark` override criterion, but SemanticTokens
opts in and has no `.dark` override at all. From CodeRabbit on #8208.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@kyle-ssg
kyle-ssg merged commit 2d956ce into main Aug 4, 2026
38 checks passed
@kyle-ssg
kyle-ssg deleted the chore/chromatic-token-coverage-and-layout-skip branch August 4, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants