Files
PaperClipAI/tests/storybook-visual
DottaandPaperclip 35c4526887 fix(ui): clean up routines controls and folder loading (#22009)
## Thinking Path

> - Paperclip helps people manage AI agents and their work.
> - Routines define work that repeats and provide controls to find and
organize it.
> - The routine list appeared before its folder data. The folder rail
then moved the list.
> - The page also repeated its folder summary and showed an extra
selection control.
> - This change loads the folder view with the list and reduces the
controls.
> - The result is a stable page with consistent folder rows and clear
icon controls.

## Linked Issues or Issue Description

**What existing behavior does this improve?**

The Routines list page and its folder navigation.

**Current behavior**

The page shows a Select button, a repeated “All routines” summary, and
text buttons for Sort and Group. A delayed folder response moves the
visible list and can show “Unknown folder.” Folder names and counts use
different columns.

**Proposed behavior**

Remove Select and the repeated summary. Show Sort and Group as named
icon buttons. Wait for the initial folder read before showing a
folder-based list. Align folder icons, names, and counts. Show folder
read errors with a retry control. Keep routines readable after an error
or a 15-second request deadline.

**Reason and benefit**

Operators can scan the list without a layout shift or repeated page
labels. Sorting, grouping, search, folder navigation, and per-row filing
remain available.

**Breaking changes**

The routine list no longer has bulk selection. Each row retains its Move
to menu. No API or database contract changes.

The roadmap has no overlapping page cleanup. The open routines PR search
found backend, archive, and scheduling changes, with no matching list
cleanup.

## What Changed

- Remove the selection control, its unused bulk mode, and the repeated
folder summary.
- Use icon buttons with accessible names for Sort and Group. Keep them
beside search on small screens.
- Load folder data before the initial folder list appears. Keep cached
rows visible during a folder refresh. Show folder read errors.
- Use the same icon, name, count, and action columns for All routines,
folders, and Unfiled.
- Add regressions for delayed folder data, failed reads, retry recovery
and stalled requests.
- Keep cached folder names and rows visible after refresh failures.
Suppress empty-folder prompts when the first read fails.
- Update the Storybook test to use the new accessible button names.
- Use the shared fail-fast retry helper with an explicit reason. The
query-error policy check passes.
- Remove the unused folder-row grid token.

## Verification

- Revision: `27d70d1a37bda20496793bbff0fc6adf3a037e80`. Local Linux
checkout, Node 25.9.0, Chromium 151.
- Red/green: delayed folders, failed folder reads, stalled requests and
saved folder filters each failed before their fixes. All now pass.
Failed background reads preserve the routine link and folder navigation.
A failed first read shows all routines; Retry restores the saved folder
or Unfiled filter.
- `pnpm --dir ui exec vitest run src/pages/Routines.test.tsx
src/components/folders/FolderControls.test.tsx src/api/client.test.ts`:
51 tests pass.
- Chromium checks pass for delayed first reveal, folder filters, Sort,
Group, search, mobile folder selection, failed folder reads, the
15-second deadline, and retry recovery. No page errors occurred.
- Storybook: the routine toolbar interaction test passes with the new
button names. Seven interaction and geometry tests pass. The multi-story
navigation test could not finish in the local dev server. Chromium
reported insufficient resources. The first attempts also needed a
browser install and the supported preview hostname. These attempts are
not a full suite pass.
- The visual baseline manifest has zero snapshots and no archive URL.
There is no published baseline to refresh. Screenshots were captured for
review; no baseline archive was created.
- `pnpm --dir ui exec tsc --noEmit`: passes after stopping the local
preview servers. An earlier overlapping attempt hit the workspace memory
limit and is not a pass.
- `node scripts/check-query-error-rendering.mjs --enforce --summary`:
passes with zero findings.
- `git diff --check`: passes. The ignored Storybook catalog was
generated.
- The original `pnpm verify` run selected 578 files and was stopped
after source edits. It is not a pass. Focused checks above cover the
final source. Required CI is running for the new revision.
- Current-head Greptile and Paperclip reviews both give 5/5. All review
threads are resolved. Build, policy and typecheck have passed. Remaining
server suites are running. Squash auto-merge is enabled and waits for
required checks.
- Setup note: full preflight could not build Rust binaries because Cargo
is absent.
- Screenshots use the local source UI with sample API and WebSocket
responses. They do not show a staging deployment or prove backend
behavior.

## Risks

Low risk. The initial folder view now waits for two reads. A folder read
has a 15-second deadline and an explicit retry. A failed read with no
cached data shows the routines without folder groups. Other group modes
do not wait for folder data. Cached background reads keep the visible
rows. Shared folder row alignment also applies to the legacy routines
page.

## Model Used

OpenAI Codex, GPT-6. The runtime did not expose a more specific model
revision. Used reasoning, shell execution, and browser automation. No
sub-agents were used.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-11-17 14:45:30 +00:00
..

Storybook Visual Baselines

The visual suite compares built Storybook stories against PNG snapshots stored outside git. The checked-in manifest at baseline-manifest.json pins the immutable archive URL, SHA-256, byte size, snapshot count, and capture environment.

Commands

pnpm storybook-visual:baseline download
pnpm storybook-visual:baseline verify
pnpm test:storybook-visual
pnpm test:storybook-visual:update

download fetches the archive, verifies its SHA-256 and byte size, unpacks it to tests/storybook-visual/.snapshots/, and checks the PNG count. The same snapshot directory can be overridden with STORYBOOK_VISUAL_SNAPSHOT_DIR.

Known Limitation: Linux Baselines

Storybook visual baselines are platform-locked. The checked-in manifest records the capture environment as ubuntu-24.04, and Playwright compares screenshots with maxDiffPixels: 0. Pixel-exact results are only meaningful when local runs use the same Linux/Ubuntu capture platform as the baseline.

macOS, Windows, and other non-matching local environments can produce false-positive diffs from font rasterization and subpixel rendering differences. Use the Storybook Visual GitHub Actions workflow on ubuntu-latest as the source of truth for cross-platform review, or run the suite locally in a matching Linux environment before accepting or updating baselines.

CI and Review Artifacts

Storybook visual tests are opt-in while the suite stabilizes. Add the storybook-visual label to a pull request, or run the Storybook Visual workflow manually, to download the pinned baseline, build Storybook, and run the Playwright visual suite on GitHub Actions.

The workflow uploads tests/storybook-visual/playwright-report/ and tests/storybook-visual/test-results/ as a storybook-visual-report-* artifact on every run. When screenshots differ, Playwright writes the actual, expected, and diff PNGs into test-results, so reviewers can inspect the failure without rerunning the suite locally.

Normal PR visual runs use repository read-only permissions and never upload or modify baseline objects. To review intentional visual changes before updating baseline-manifest.json, run the workflow manually with update_snapshots enabled. That produces a storybook-visual-baseline-review-* artifact containing the packed candidate snapshot archive for review. Publishing that bundle to the baseline bucket still requires the explicit maintainer upload command below.

Updating Baselines

  1. Run pnpm test:storybook-visual:update after reviewing intentional visual diffs.
  2. Run pnpm storybook-visual:baseline pack to create tests/storybook-visual/baseline-review/snapshots.tgz.
  3. Upload the archive from a trusted maintainer environment with STORYBOOK_VISUAL_S3_URI=s3://bucket/baselines/storybook-visual/<sha>/snapshots.tgz pnpm storybook-visual:baseline upload.
  4. Copy the printed snapshotCount and archive fields into baseline-manifest.json.

Generated snapshots, review bundles, Playwright reports, and downloaded caches are ignored by git.