Front rules and structure: one page file per route, lib/ for shared reads, leaner Room services, tests on the real route tree #408
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
spec
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#418 Bind the design-system input to TanStack Form v2 and move sign-up onto it
amaurycoudr/chess-project
Reference
amaurycoudr/chess-project#408
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem Statement
The front's structure rules cost more than they return, and some of them now fight TanStack's idioms:
.view.tsx(hooks, queries, mutations) and a.ui.tsx(layout). All 13.ui.tsxfiles are imported only by their own view: no story and no test renders one alone. The split exists for a lint boundary. ADR 0011's own "revisit when" has fired: the Room view passes 24 props to its UI.services/. So search validators live in views, and wrapper views exist only so a route can import a not-found screen.lib/, which the rules call domain-free.room/services/holds 11 files, one per mutation, four of them under 20 lines, against root rules 18 and 19.routes/, so a test can pass while the real route differs.auth/andgames/exist.Source: the front audit,
docs/research/front-audit.md, sections 2.3 and 3, and the owner's decisions in section 5 (view/UI merge accepted; cross-vertical reads stay inlib/by rule).Solution
lib/may hold reads several verticals share, and a TanStack Formformorfieldobject may be passed to a component.components/.room/services/shrinks to the files that each hold one concept.Nothing a Player sees changes.
User Stories
lib/may hold reads several verticals share, so that the Account and My-games queries are where the rules expect them.<…Ui/>in every view, so that a page can render its own markup.components/to keep their lint boundary, so that stories still render them without providers.formorfieldobject, so that the Form spec can bind design-system inputs once.room/services/grouped by concept (the Room query, the Room's mutations, the Move, entering a Room, refusals), so that one concept is one file.setQueryDatastays narrow (ADR 0019).Seams
front/view-is-compositionis deleted with its test cases; the restricted-import globs accept the new page files and route imports, and still reject a sibling vertical and a presentational component importing Query.No e2e seam: no Player-perceivable change.
Implementation Decisions
CLAUDE.md, "No rule edits in feature work"). In the front'sCODING_STANDARDS.md:.ui.tsxandcomponents/import no Query…" keepscomponents/only, and allows@/lib/form;*.vieworservices/" becomes "a route imports a vertical's page files,services/and exported constants";.view.tsxrenders exactly one<…Ui/>" is deleted, withfront/view-is-composition;formorfield; rule 5 adds form state in TanStack Form; rule 8 says tests go through the page on the app's route tree;lib/anddesign-system/still import no vertical, and the wording sayslib/may hold reads several verticals share.lib/wording; the ADR index row follows.<name>.page.tsx(name to confirm in the rules change) per route, holding the hooks, the mutations and the layout. Not-found screens are exported beside their page.Testing Decisions
front-rules.test.tsfor S1; the existing view tests for S2;app/router.harness.tsx(already mounts the real router) for S3.components/file importing Query fails; a route importing a sibling's internal file fails.Out of Scope
account/vertical (declined by the owner).Further Notes
docs/research/front-audit.mdon branchclaude/nestjs-best-practices-audit-716d79.CLAUDE.mdrequires.mentioned in issue #410
marked this issue as related to #410
changed the description
mentioned in issue #414
marked this issue as related to #414
mentioned in issue #415
marked this issue as related to #415
mentioned in issue #416
marked this issue as related to #416
mentioned in issue #417
marked this issue as related to #417
mentioned in issue #418
marked this issue as related to #418
mentioned in merge request !533
mentioned in commit
0818df5e7amentioned in merge request !534
mentioned in commit
7e2d65c99fmentioned in commit
31b760f46bmentioned in commit
9de3d0d7a6mentioned in commit
a37c5c0f71mentioned in commit
30b3ae6008mentioned in commit
8ec9c87d13mentioned in commit
f9f53ad52e