Repository navigation
refactor(members): split MembersPage.tsx into focused owners - #20342
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS One thing to check: the claim that hooks still run in the base order is proven by the author's out-of-tree recipe; the owners test only pins the order the facade calls its owners. What this change shipsInventory (7 items) — 7 justifiedIntent: bring the Crewmates page's source file under the 2,000-line cap (an AGENTS.md invariant) with no change to what the page does. It is an ADDITION of structure only, not a fix.
[FIRST-PRINCIPLES-REVIEWED] 5c4a952 Description read[DESCRIPTION-READ] dc8934b1cbb1e045e3042ed10c7ef4c23f50ee806be2201e03f23ba687781396 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 5c4a952 Description read[DESCRIPTION-READ] 9bdc633943d992aa5b1a9217eda7c8719d0939d3238cab7669277ec7338c3327 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Before merging, open the Crewmates page and check that the roster, thread header, Profile card and side panel look and behave exactly as on main. [UX-REVIEWED] 5c4a952 Description read[DESCRIPTION-READ] c2755360b0836e2a3e46455fb66a8dcce006605b4b7567dfcbdd4f3e55feee6f That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ human override acceptedReviewed Human judgment by @bolichen97 overrides the Opus 5.5 finding for [OPUS-OVERRIDE] 5c4a952 Verdict recorded from an authorized human decision for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
mbriones98
left a comment
There was a problem hiding this comment.
Checks green and PR Readiness passed at 3b72a1f; non-feature change.
3b72a1f to
f7768ac
Compare
|
|
|
|
f7768ac to
1370095
Compare
|
self-added: yes
|
|
|
|
|
/ai-review override fable 1370095: Opus discovery failed closed on two runs (38620315506 attempts 1 and 2; no [OPUS-DISCOVERY] marker, 82-92 captured bytes, no denials), which is an infrastructure fault and not a finding; I verified the head myself — production code is identical to the independently reviewed split (range-diff vs 7e8618f1 changes only MembersPage.owners/unreadColumn tests and the commit message) and GPT, Design, First Principles and UX lanes pass. |
Human judgment recorded@bolichen97 marked the fable AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
d66ab15 to
45027a0
Compare
MembersPage.tsx held one 4,725-line component in a 5,633-line file, far past the 2,000-line cap the repo is adopting. The page now composes owner modules beside it. Each owner is called where its code sat in the page's hook order, so every useState, useRef, effect and library hook registers in the same order as before. - membersPageModel.ts: the page's pure rules and shared constants - useMembersPageRoster.ts, MembersPageRoster.tsx, MembersPageRosterRows.tsx: roster data, view state, the roster column and its rows - useMembersPageCrewEditor.ts, useMembersPageTeams.ts, useMembersPageLayout.ts, useMembersPageDrawers.ts, useMembersPageNavigation.ts: the in-place editor, teams, column placement, the phone drawers and which crewmate is open - MembersPageThread.tsx, MembersPageThreadHeader.tsx, MembersPageProfile.tsx, MembersPageSidePanel.tsx: the thread, its header, the Profile card and the side panel, each with the state it renders Bodies move verbatim. The facade keeps the New crewmate card, the guide hand-offs, the exit guards and the face-flight overlay, and re-exports every name it exported. MembersPage.owners.test.tsx pins those exports, the one-way imports and the owner call order, and MembersPage.unreadColumn.test.tsx covers the header's unread pills so the header file clears the per-file coverage floor on its own. Five source pins follow the code they read: positive halves read the owner that renders the construct, negative halves read every page file through one helper, src/test/membersPageFamily.ts. Moved comments that pointed "above" or "below" at code now in another file name that file, and the feature map and the crew-mode spec name the owners. Part of #20192
45027a0 to
5c4a952
Compare
|
Rebased: main moved in website/src/test/mobilePanels.compositor.test.ts and docs/feature-map/README.md since this head went green (#20388, ChatPage hook logic into page owners; 83e97cd -> 213339f). The compositor pin keeps reading the whole Crewmates page through readMembersPage() on top of #20388's ChatPage owner join, and the moved comment in useMembersPageDrawers.ts now names drawerTravel's new home, pages/chat/page/sessionsDrawer.ts. No hook added or moved. CI re-running. |
Human judgment recorded@bolichen97 marked the fable AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
|
|
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved by a maintainer after reading the review lanes: every lane is clean on this head, and the automated triage held it only on a size, path, category or doc rule.
Problem / Motivation
Goal: Bring the Crewmates page's source file,
website/src/pages/members/MembersPage.tsx, under the repository's 2,000-line cap by moving it into focused owner modules, with no change to what the page does.MembersPage.tsxis 5,633 lines. One component,MembersPage, fills 4,725 of them. It is the third-largest hand-written frontend file. It changed 43 times in the last week, so every feature PR on the Crewmates page edits one giant function, and reviewers and agents read the whole thing to find the part they need.Why it matters
The line-cap campaign (#20192) makes 2,000 lines a hard limit for hand-written files, and this file is nearly three times that. Splitting it by responsibility means the next change to the roster, the thread or the Profile card lands in a file about that thing. That file is at most about 1,050 lines, with room to grow before it nears the cap again.
Not a goal
MembersPage.test.tsx(scope FT06, after this lands) and no change to any assertion.What changed (motivation → approach → change)
Nothing on the Crewmates page changes for a user. Its 5,678-line file becomes a 924-line page plus thirteen owner files, each holding one part of the page, so the next change to the roster, the thread or the Profile card lands in a file about that thing.
The page was one component, and React runs its effects in the order its hooks are declared. A split that regrouped code by topic would reorder those registrations, which is a behaviour change even when every test still passes. So the split works in hook order. Each owner hook is one stretch of the page's hook sequence, and the facade calls it exactly where that stretch sat. Every
useState,useRef, effect and library hook therefore registers in the same order as onmain. A TypeScript-AST recipe generates the split from the base file and fails if that order differs.MembersPage.tsx(924 lines)membersPageModel.tsuseMembersPageRoster.ts,MembersPageRoster.tsx,MembersPageRosterRows.tsxuseMembersPageCrewEditor.ts,useMembersPageTeams.ts,useMembersPageLayout.ts,useMembersPageDrawers.ts,useMembersPageNavigation.tsMembersPageThread.tsx,MembersPageThreadHeader.tsx,MembersPageProfile.tsx,MembersPageSidePanel.tsxA few things stay in the facade because tests or lint read them there: the New crewmate guide wiring, the reveal scopes, the three allowlisted
window.confirmguards andCrewFaceFlight. Owners never import the facade. The newMembersPage.owners.test.tsxpins the exports, the one-way imports and the order in which the facade calls its owners. One new behaviour test,MembersPage.unreadColumn.test.tsx, covers the thread header's two unread-column handlers, which nothing exercised; without it the movedMembersPageThreadHeader.tsxfalls under the 80% per-file coverage floor every new file must clear (79.3%, 92% with it). Five source-pin tests follow the code: each positive check reads the file that renders what it pins, and each negative check reads every page file, so a hand-rolled copy cannot hide in another owner. Moved comments that said "above" or "below" about code now in another file name that file. The feature map and the crew-mode spec name the owners and map the Schedules draft guard.Move audit
The 132 removed lines that do not reappear verbatim are glue, a named comment pointer or a named state type:
vi.mockstill applies)useStatesetter oruseRefobject now arrives through an owner object, so the hooks lint cannot see it is stable and asks for it; its identity never changes, so no memo recomputes and no effect re-runsexportadded{placeRoster(<aside…</aside>)}, the Profile / side panel IIFE and the header IIFE became<MembersPageRosterColumn>,<MembersPageProfileCard>,<MembersPageSidePanel>and<MembersPageThreadHeader>profile,goneandpostCreateErroruseStatecalls name their shapes (ProfileCardOpen,GoneNotice,PostCreateFailureinmembersPageModel.ts), which the owners' option types shareNo hook changed position: the recipe refuses to generate unless the 209 hook-registering statements run in the base's order, and every apply prints
final order identical to BASE, so there is no moved-hook list (L40). For every changed file, git's default diff and--minimaladd the same number of lines (L36).Diff: 803,839 bytes (
git diff BASE...HEAD). The recipe (a TypeScript-AST script, anchors not line numbers) regenerates this commit byte-for-byte from the base.Backwards compatibility
Compatible: every import path, export, default export, test id, i18n key, query key and route stays the same.
App.tsx's lazy route and the capture entries still import./pages/members/MembersPage. Its named exports are the same bindings, now re-exported frommembersPageModel.ts.Removes nothing: no file, export, key or behaviour is removed; code moves to sibling modules the facade composes.
Re-points and citations (path or name only)
website/src/test/listShellParity.test.ts,website/src/test/kiroLightShellHooks.test.ts,website/src/test/searchFilterBar.parity.test.tsx,website/src/test/ResizeHandle.parity.test.tsxMembersPageRoster.tsx(and, for the row recipes,MembersPageRosterRows.tsx), which hold the roster card and rows; negative checks read the facade and every owner throughreadMembersPage()(Master grant)website/src/test/membersPageFamily.ts(new test helper)website/src/test/mobilePanels.compositor.test.tsMembersPage.tsx+useMembersPageDrawers.tstogether (Master grant)website/src/components/listShell.ts,website/src/components/Glass.tsx,website/src/apps/command-bar/matesProvider.ts,website/docs/theming-contract.mdmemberMemoryDisplaylivewebsite/src/pages/members/MembersPage.test.tsx,website/src/pages/members/TeamDialog.test.tsxLAST_MEMBER_KEYand the "+" menudocs/feature-map/README.md.github/file-line-cap-baseline.txtMembersPage.tsxrow: the file is now 909 lines, under the cap (only that row, by hand;scripts/check_file_line_cap.pyreports 0 failures)docs/system-specs/modules/crew-mode.mdCI path references
None: no workflow path filter or explicit file list names
MembersPage.tsx.Tests
src/pages/members/MembersPage.owners.test.tsxpins:@/included, compared as paths);The order pin guards the split, not a design: a later change that regroups state by responsibility (follow-up refactor(members): move the Schedules exit-guard state into its owner hook #20512) reorders registrations deliberately and edits it.
Mutations turn it red: an owner importing the facade (relative, and through
@/), a module outside the page importing an owner, the shared file rule losing a family, and two owner calls swapped.mutations.mdin the campaign reports):listShellParity,kiroLightShellHooks,searchFilterBar.parityandResizeHandle.parity: positive checks read the roster files, negative checks read every page file through the sharedsrc/test/membersPageFamily.ts. Removing the construct from its new home turns each red, and so does planting the forbidden markup in an owner other than the roster, or setting the helper's file rule to match nothing;mobilePanels.compositor's "every gesture consumer declares its claim" check reads the whole page through the same helper, because the drawer gestures moved touseMembersPageDrawers.ts. With the old single-file read, a facade that droppeddata-owns-swipestayed green because the page was skipped.safeArea.guardandenglishIdentityred.src/pages/members/MembersPage.unreadColumn.test.tsx: picking another crewmate's unread pill under the switcher chip opens that crewmate, and "+N" opens the switcher's list instead. Nothing exercised these two handlers before. The moved header file needs them to clear the per-file 80% floor on its own (92% with them, 79.3% without). Passed 5 runs alone and in the 35-file parallel run. Mutating either handler to a no-op turns it red.MembersPage.*.test.tsxfiles,MembersPanelVisibility,GuideLayer,revealScopes,safeArea.guard,uiIndex,autoGuide, the i18n ratchets,chatSlice.ownership,fileNameCasing,MemoI18nSubscriptionRatchet,App.mobileSingleTopbarand others: 35 files, 1,026 tests.check_per_file_coverage.py, floor 80%): all 14 page files pass. Lowest:useMembersPageCrewEditor.ts81.8%,MembersPageProfile.tsx89.7%,MembersPageSidePanel.tsx90.7%,MembersPageThreadHeader.tsx92%.tscandeslint src --max-warnings 0;i18n:check(0 findings on added lines, all key refs resolve);lint:phantom-classesandlint:restyle-ratchet;gen-ui-index --check(fresh) andjscpd;local-gate.py --dry-runselects 821 backend and 383 frontend related files. That is too many to run locally (the floor rule), so the gate floor above ran instead; CI runs the full suites.Manual verification
N/A — unit coverage sufficient: the change moves code verbatim, the page's behaviour is pinned by its existing 355 page tests, and the hook order is pinned by the new owners test.
Screenshots / video
Why no screenshot: code moves verbatim into sibling modules under the same element tree, so nothing rendered changes.
Related Issues
Part of #20192
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.