Skip to content

test(web): pin what every Home row kind saves before the redesign - #1876

Merged
Quick104 merged 5 commits into
feat/collections-revampfrom
test/home-rows-payloads
Oct 4, 2026
Merged

Quick104 merged 5 commits into
feat/collections-revampfrom
test/home-rows-payloads

Conversation

@Quick104

@Quick104 Quick104 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #1137
Validation tasks: none changed. The moved builders are on the #1141 C1 add and edit path, and the tests show they send the same requests as before.

Stacked on #1852, so this targets fix/section-filter-rows.

The planned Home rows redesign replaces the admin Sections page, the recipe gallery and the Settings > Home Screen editor. Those screens build the section_type, config and override fields that get saved, and home layout export and import (#1705) and preset label inference (#1503) depend on those values staying the same. No test records what each row kind saves today, so a redesign PR could change a saved row without anything failing. This PR adds tests that record the current requests and saved overrides for every row kind. It changes no behavior.

Approach

The payload builders move unchanged into web/src/lib/homeRows/payloads.ts, so tests can call them directly: buildAdminSectionPayload, buildProfileSectionSaveEntry, buildProfileGallerySection, the gallery drawer's add payload, and the admin gallery's create and bulk-create requests. The modules that exported them before still re-export them with the same signatures, and every existing test passes without edits. The conversion inside fetchRecipeCatalog is split out as recipeCatalogFromV2 so the tests read the fixture through the app's own code.

recipeCatalog.v2.json is the real GET /api/v2/sections/recipes body. A Go test in internal/apiv2 serves the catalog through the v2 route and fails when it no longer matches the fixture; -update-recipe-catalog-fixture rewrites it. The Go test reads the file from web/ on purpose: one copy serves both trees, so a recipe change can't pass on one side and drift on the other.

payloads.golden.json records the admin create body for every preset on Home and on a library page, and the profile's saved override for every preset. It also records edge configs the redesign will touch: a 1990s era row, a monthly director row, legacy single-theme seasonal rows, and a legacy Trakt trending row. To update it, run pnpm exec vitest run -u src/lib/homeRows/payloads.golden.test.ts and give a one-line reason for each changed entry. Both JSON files are generated by tests and excluded from Prettier.

The other tests cover:

Some of the pinned behavior is wrong today. The tests record it as-is so a later PR has to change it deliberately:

  • Three profile collection-row cases are it.fails. An edit rewrites a personal collection id that isn't in the picker options as library_collection_id, and it drops the row's other config keys while the options load and on a hero toggle. The follow-up fix flips them to it.
  • A no-op admin save of a legacy genre row rewrites its config: filter_type becomes media_scope, library_ids: [] is added, and sort/order become a sort object.
  • Fallback labels are wrong for some rows. 1990s era rows and monthly actor rows read "Director Spotlight", single-theme seasonal rows read "Seasonal Picks", and a Trakt trending row reads "TMDB Trending Today".

Validation

  • Web: make test-web (756 files, 6886 passed, 3 expected failures), tsc -b, pnpm run lint (0 errors, no new warnings), format:check, build and budget:check pass.
  • Go: go build ./..., gofmt, go vet, make lint-changed against fix/section-filter-rows, and make test-go pass.
  • Contracts and hygiene: verify-apiv2-openapi, verify-apiv2-fixtures, verify-apiv2-contract, verify-route-inventory and verify-local-paths pass.
  • Mutation checks: editing one golden value by hand fails the golden test under CI=true. Adding a key to the gallery add payload, or dropping base config on an admin collection edit, fails the payload tests. Changing one preset key fails the Go fixture test; minifying the fixture does not.
  • Not run: the settings-binding, playback-fixture, migration-ledger, scenario-catalog and offline-route verify targets and make test-db-pins, because this diff touches none of their inputs. No manual browser run, because nothing in the UI changes.

Risks

No runtime behavior changes. Later redesign PRs will change the golden file or the fixture when a recipe or a saved shape changes on purpose, and each changed entry needs a reason in that PR. The Go test depends on the fixture's path under web/, so moving that file fails the Go test until the path is updated.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code subagents (implementer, independent reviewer)
  • Model(s): claude-opus-5-5[1m]
  • Involvement: Fully AI-generated, human review pending
  • Adversarial review: An independent reviewer subagent compared every moved builder with its original, reran the focused web tests and the Go test, and mutated the payload builders to confirm the tests catch changes. It approved with three findings, all fixed. The trending_discover form of a legacy Trakt row wasn't pinned; it is now in the golden and label tests. The genre and admin_curated_list edit tests matched config as a subset; they now assert the whole request, and the genre test documents the rewrite. The Go test compared bytes, so reformatting the fixture would have failed it; it now compares values.

🤖 Generated with Claude Code

Note

Add characterization tests pinning Home row payload behavior before the redesign

  • Adds a Go test that keeps the generated recipe catalog fixture in sync with the API response, plus a flag to regenerate it
  • Adds golden payload tests covering gallery, drawer, admin, profile, single-create, bulk-create, and edit paths for every recipe preset, and tests for preset labels and layout export/import round trips
  • Consolidates the duplicated payload builders (profile save, admin save, gallery add) into the shared homeRows module and extracts recipeCatalogFromV2 from fetchRecipeCatalog
  • Risk: these are characterization tests; the pinned behavior in payloads.golden.json and recipeCatalog.v2.json will show diffs for any intentional behavior change, and failing collection-key cases are recorded rather than fixed

Macroscope summarized 0e6630d.

Quick104 and others added 4 commits October 3, 2026 22:56
The Home rows redesign replaces the section editors. These tests record
the bytes each row kind saves today, so later PRs can show they change no
stored data by accident.

The payload builders move into web/src/lib/homeRows/payloads.ts; the old
modules re-export them and every existing test passes unedited. The
recipe catalog fixture is the real GET /api/v2/sections/recipes body, and
a Go test fails when it drifts from the registry. Three collection-key
cases are recorded with it.fails until the fix that follows this PR.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The server treats a trending_discover row with source "trakt" as
Trakt-backed, like a Trakt collection row, and PR D rewrites that
family's variants. Pin its title-only edits and its label, which today
falls back to "TMDB Trending Today".

The genre and admin_curated_list edit tests matched config as a subset,
so extra keys would pass. Assert the whole body, and record that a no-op
save rewrites a legacy genre row's config into today's filter shape.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The Go test compared the web fixture byte for byte, so an editor
formatting the JSON on save would fail it without a catalog change.
Compare decoded values instead, and keep Prettier off both generated
fixtures; the payload golden is still a byte-exact vitest snapshot.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-04T05:16:41.135116Z 0e6630d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 360d0e60-d22d-4480-b01e-e03469ab9bb5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Base automatically changed from fix/section-filter-rows to feat/collections-revamp October 4, 2026 05:06
@Quick104
Quick104 merged commit 7ede12e into feat/collections-revamp Oct 4, 2026
14 checks passed
@Quick104
Quick104 deleted the test/home-rows-payloads branch October 4, 2026 05:39
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