Skip to content

test(members): split MembersPage.test.tsx by topic - #21553

Merged
bolichen97 merged 1 commit into
mainfrom
refactor/linecap-ft06-memberspage
Oct 17, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
refactor/linecap-ft06-memberspage

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Bring website/src/pages/members/MembersPage.test.tsx (6,611 lines) under the 2,000-line cap by moving its tests unchanged into topic files beside it.

The Crewmates page's main test file mixes the roster, the side panel, teams, the New crewmate card, create links, landing rules and the phone layout in one file. A reader cannot tell where a new case belongs, and every Crewmates PR edits a 6,600-line file.

Why it matters

The campaign rule in #20192 is that no hand-written file exceeds 2,000 lines. This is the largest frontend test file on the line-cap baseline, and it is one of the most edited (31 commits in seven days). While it stays this size, the next Crewmates fix lands in a file nobody can scan, and the guard has to keep carrying it.

Not a goal

What changed (motivation → approach → change)

The original covered a dozen behaviours with only its describe blocks as seams. The split follows those describes; the three that were over a thousand lines on their own (side panel …, New crewmate dialog, default member, memory and URL) are cut into topic spans, and each span keeps the describe's title so every test keeps its full name.

File Lines Tests What it holds
MembersPage.test.tsx 866 27 the roster, its cached read, opening a thread
MembersPage.sidePanel.test.tsx 1114 37 the roster's Starred count, the switcher it folds into, the Dashboard and Files tabs, Profile docking and flights, withheld views, the "+" menu
MembersPage.teams.test.tsx 1074 30 teams and the team view, the empty-roster hero and page-header doors, the roster rows
MembersPage.openThread.test.tsx 917 26 viewed-thread registration, unread drain, the identity pill, slug collisions, the opening welcome and greeting
MembersPage.newCrewmate.test.tsx 1130 28 a create in progress: leave guard, create path, locked controls, nested workspace form, dropped connection, a create the user leaves
MembersPage.newCrewmateOutcomes.test.tsx 1185 42 what a create leaves behind and checks: caches, the + hold, name refusals, a failed roster re-read, Built from and Advanced
MembersPage.createLinks.test.tsx 756 18 create links that open the New crewmate card, and a create the user leaves running for another chat
MembersPage.landing.test.tsx 1195 42 which crewmate a visit opens on a wide window
MembersPage.narrow.test.tsx 873 24 below md: the roster drawer, Back, the shell bar, the phone layout
src/test/MembersPageTestUtils.tsx 308 — the fixtures two or more files read: row, renderPage and its probes, the "+" menu drivers, the bounded-create clock, resetApiMocks

Every test file carries the original's vi.mock block and top-level beforeEach / afterEach(realCreateClock) word for word. A helper read by one file stays in that file. A script in the campaign's control directory performs the split from any base: it finds each describe and test by title, never by line number, and exits if one is missing.

Placement calls:

  • (a) The original keeps one contiguous prefix of its text, so git's default diff and --minimal add the same 27 lines to it.
  • (b) The only two tests that emit act() warnings at BASE ("a create in flight asks with its own words …", "a chat open that fails right after the create frees the + …") both sit in newCrewmate, and the act-warning baseline entry moves with them (472 entries before and after). The original emits none in three HEAD runs.
  • (c) The helper module lives in src/test/: under pages/members/ its name would match the page's owner rule (membersPageFamily), the feature-map gate and the ui-index walk.

Outside the split itself: the original's row leaves .github/file-line-cap-baseline.txt; the act-warning entry moves as in (b); the comment in test/test_members_roster_recency.py names the file that now holds what it cites (src/test/CrewEditorDialog.test.tsx, the other file whose comment named the original, is deleted on main by #19257); and MembersPage.schedules.test.tsx drops a sentence whose reason no longer holds (the below md describe restores matchMedia after each case), an accuracy fix to a comment that named the original.

CI path references: none. No workflow, AUTOSDE glob or path list names the original.

Move audit

website/src/pages/members/MembersPage.test.tsx: 6611 -> 866 lines; moved 99.25% (line-multiset)
   unmatched removed lines: 41 (the pruned import lines and the declared edits below)

Unit proof: 243 BASE units (each test, nested describe, helper, mock-block statement and hook); 234 occur byte-identical in the family (tests and helpers exactly once, the mock block and hooks once per test file), and 9 carry only the declared edits:

Unit Edit Why
5 tests and one describe-level const settle in New crewmate dialog an own-line // flake-ok: and // nosemgrep: semgrep.kirocrew.test-promise-sleep -- … pair above each of the six moved promise-sleeps the sleeps are new findings at a new path; same pair as #20466
"the pill's second line says what the crewmate is doing …" a same-line // flake-ok: on its five Date.now() stamps flake ratchet J3: the original was exempt file-wide by its setSystemTime, openThread has none
fakeCreateClock (helper module) a same-line // flake-ok: on its vi.useFakeTimers flake ratchet J6: every file that calls it runs realCreateClock after each case
"the roster unread dot reads the status token …" (ChatSidebar.tsx:2197, :6550) -> (chat-sidebar/SessionRow.tsx) the sidebar's dot lives in SessionRow.tsx; ChatSidebar.tsx is 939 lines
"the auto-open from a bare desktop URL replaces …" "the below-md block" -> "MembersPage.narrow.test.tsx's below-md block" that describe now lives in narrow

Everything else that differs is glue: each file's pruned imports, the helper-module import, the helper module's imports and export prefixes, and a three-to-five-line intro comment per file. Comments copied with the mock block and the afterEach (for example "the status-strip and bounded-create cases") keep naming cases that live in some of the files only; they are verbatim.

Backwards compatibility

Compatible: test-only change. No test file imports another, and every test keeps its name, body and pass condition.

Removes nothing: no test, assertion or export is removed. The original keeps its path, and the same 274 tests run.

Tests

The collected test list is identical: 274 tests (262 it / it.each statements) under the same full names, in one file at BASE and in nine files at HEAD (27 + 37 + 30 + 26 + 28 + 42 + 18 + 42 + 24).

  • Differential harness. An instrumented copy of each file records, for every test, each api.* mock's calls and settled results, the file's module spies and every act() warning. Against the unsplit file at this PR's base: every HEAD test's traffic matches a BASE run (274 of 274; earlier bases: four BASE runs against five HEAD runs, all matched). The BASE runs are not identical to each other at the tail (late refetches, a duplicate re-POST), so the match allows a timing-dependent tail and collapses consecutive duplicates.
  • act() warnings. Only the two tests named in (b), in newCrewmate (listed). The nine files pass under KIROCREW_ACT_STRICT=1.
  • Tree scanners. The 132 vitest files that walk src/ or read files by path, plus setup.refactor.determinism.test.ts and the two comment-edited test files: 3,039 tests, all green (run before the last rebase, which only ports upstream test hunks).
  • Repeats. The nine files (the last rebase ports one mock-block line into all of them): five runs under KIROCREW_ACT_STRICT=1, 274 of 274 each; the nine files plus the act-baseline self-test and the comment-edited schedules file, strict: 332 of 332.
  • Flake ratchet and line cap. test_flake_pattern_ratchet.py, test_file_line_cap.py and test_members_roster_recency.py: 205 passed. scripts/check_file_line_cap.py: 0 failures.
  • Semgrep 1.78.0 with CI's packs plus semgrep/ and --baseline-commit: 0 findings; with --disable-nosem, exactly the six marked sleeps. Every file reports the same partial parse at the ChatPane stub's import('react') type that the original reports at BASE.
  • npx eslint src/ --max-warnings 0, npm run typecheck, the i18n and phantom-class checks, the brand, comment-history, focus-cue and feature-map gates and docs_lint.py: all pass.
  • scripts/local-gate.py --dry-run selects 879 backend and 378 frontend files, almost all from the cross-surface set, so it was not run whole; the floor above stands in for it.

Manual verification

N/A — unit coverage sufficient: the change only moves vitest cases, and the identical test list plus the differential harness prove it.

Related Issues

Part of #20192
Follow-up: #20383 (pre-existing shapes moved verbatim; de-flake there)

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners October 17, 2026 08:17
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision 5dbc54a78824e74a172efa42882c885d0d51f0c3 ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Advisory — does not block merge.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 17, 2026
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 5dbc54a78824e74a172efa42882c885d0d51f0c3 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: PASS

Nothing to check.

[UX-REVIEWED] 5dbc54a

Description read

[DESCRIPTION-READ] 4526a0264b9f034d4fc5bab47c2713717d7c9bdd3152500dcccc31d706752077

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 5dbc54a78824e74a172efa42882c885d0d51f0c3 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

Suggestions

  • The verbatim vi.mock('../../api/client', …) block now exists in nine more files, one of 160 added vi.mock lines. In a follow-up PR, consider moving that factory into src/test/MembersPageTestUtils.tsx so a new endpoint stub is added in one place.

[DESIGN-REVIEWED] 5dbc54a

Description read

[DESCRIPTION-READ] 0fec17928f06a3e920909f756a871bcae5486668fa3388ea3d0afa16041210f1

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 5dbc54a78824e74a172efa42882c885d0d51f0c3 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 5dbc54a

Verdict parsed from the review's SHA-scoped output markers for commit 5dbc54a78824e74a172efa42882c885d0d51f0c3.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 5dbc54a78824e74a172efa42882c885d0d51f0c3: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 5dbc54a78824e74a172efa42882c885d0d51f0c3 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 5dbc54a

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 5dbc54a78824e74a172efa42882c885d0d51f0c3: <one-sentence reason>

@bolichen97
bolichen97 enabled auto-merge (squash) October 17, 2026 08:35
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 17, 2026
MembersPage.test.tsx had grown to 6,611 lines, over the 2,000-line cap.
Its describes now live in eight sibling files beside it, one topic each
(sidePanel, teams, openThread, newCrewmate, newCrewmateOutcomes,
createLinks, landing, narrow); the original keeps the roster, its cached
read and opening a thread. Module-level fixtures move to
src/test/MembersPageTestUtils.tsx. Every file carries the original's
vi.mock factories and top-level hooks word for word, so each moved test
runs against exactly the stubs and resets it was written with. Test
bodies move byte-for-byte; the same 274 tests run, under the same full
names.

Moved lines that the added-line gates re-judge carry their markers: the
six promise-sleeps in the New crewmate part get an own-line flake-ok and
nosemgrep pair, the five Date.now() stamps in openThread and the helper's
useFakeTimers get a same-line flake-ok, and two moved comments now name
the file that holds what they cite (chat-sidebar/SessionRow.tsx, and the
below-md block in MembersPage.narrow.test.tsx).

The act() warning baseline entry moves with the two New crewmate cases
that emit it, and the line-cap baseline row is deleted. The comment in
test/test_members_roster_recency.py that named MembersPage.test.tsx now
names the file that holds what it cites; MembersPage.schedules.test.tsx
loses a sentence giving a reason that no longer holds (the below md
describe restores matchMedia after each case).

Part of #20192
@bolichen97
bolichen97 force-pushed the refactor/linecap-ft06-memberspage branch from b73f0ee to 5dbc54a Compare October 17, 2026 15:17
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 17, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tier 1 auto-approve: test (14 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: splits MembersPage.test.tsx into topic files with a shared test-utils module; only test files, the line-cap baseline and the act-warning test baseline change.

@bolichen97
bolichen97 merged commit 07f7001 into main Oct 17, 2026
104 checks passed
@bolichen97
bolichen97 deleted the refactor/linecap-ft06-memberspage branch October 17, 2026 17:03
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 17, 2026
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.

2 participants