Repository navigation
test(web): pin what every Home row kind saves before the redesign - #1876
Conversation
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]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
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,configand 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 insidefetchRecipeCatalogis split out asrecipeCatalogFromV2so the tests read the fixture through the app's own code.recipeCatalog.v2.jsonis the realGET /api/v2/sections/recipesbody. A Go test ininternal/apiv2serves the catalog through the v2 route and fails when it no longer matches the fixture;-update-recipe-catalog-fixturerewrites it. The Go test reads the file fromweb/on purpose: one copy serves both trees, so a recipe change can't pass on one side and drift on the other.payloads.golden.jsonrecords 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, runpnpm exec vitest run -u src/lib/homeRows/payloads.golden.test.tsand give a one-line reason for each changed entry. Both JSON files are generated by tests and excluded from Prettier.The other tests cover:
admin_curated_listkeeps its items, andaward_winnerskeepsaward_type.user_collection_idandlibrary_collection_idrows, and the exact overrides for hide, rename, move, add, remove a server row, and delete an own row.custom_disabled.filterRecipeCatalogdrops exactlycustom_filterandadmin_curated_listfor a restricted profile.Some of the pinned behavior is wrong today. The tests record it as-is so a later PR has to change it deliberately:
it.fails. An edit rewrites a personal collection id that isn't in the picker options aslibrary_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 toit.filter_typebecomesmedia_scope,library_ids: []is added, andsort/orderbecome a sort object.Validation
make test-web(756 files, 6886 passed, 3 expected failures),tsc -b,pnpm run lint(0 errors, no new warnings),format:check,buildandbudget:checkpass.go build ./...,gofmt,go vet,make lint-changedagainstfix/section-filter-rows, andmake test-gopass.verify-apiv2-openapi,verify-apiv2-fixtures,verify-apiv2-contract,verify-route-inventoryandverify-local-pathspass.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.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
AI Disclosure
trending_discoverform of a legacy Trakt row wasn't pinned; it is now in the golden and label tests. The genre andadmin_curated_listedit 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
homeRowsmodule and extractsrecipeCatalogFromV2fromfetchRecipeCatalogMacroscope summarized 0e6630d.