Repository navigation
refactor: split the security and remote crew panels into owners - #21592
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. [UX-REVIEWED] f2f48a4 Description read[DESCRIPTION-READ] 514a33ca60485e36291cc5e30c2c383de1305ce31b81192f4d8b11e0f62d54cd 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 |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Before merge, check that [DESIGN-REVIEWED] f2f48a4 Description read[DESCRIPTION-READ] b6af9a8965aeb21e65e75cfb602ea592c42ae345d0cbf360f6ec8b11e2099fd6 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check that CI regenerates What this change shipsInventory (9 items) — 9 justifiedIntent: a maintainer wants the two oversized Settings panels under the 2,000-line cap with no behaviour change. This is a REFACTOR (neither a FIX nor an ADDITION).
[FIRST-PRINCIPLES-REVIEWED] f2f48a4 Description read[DESCRIPTION-READ] 27160b28091719b060e3db1a9c8f6d61eec86cae5fda3066637b023e04f91ea6 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers 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: |
|
|
SecurityPanel.tsx (3,503 lines) and RemoteCrewPanel.tsx (2,938) exceed the 2,000-line cap for hand-written files. Whole top-level declarations move verbatim into sibling owners in pages/settings, and each original file stays the facade: same module id, every named export re-exported as the owner's own binding, so SettingsPage, the story, the captures and every vi.mock of a panel keep working unchanged. SecurityPanel.tsx (331 lines) keeps the rail and the Documentation section; each other section gets one owner: Posture, Approvals (auto-approve, flagged-file delivery), DeniedCommands, Tailnet, Trust (third-party apps, registries), Redaction, Layers and Governance. RemoteCrewPanel.tsx (1,562 lines) keeps the panel component whole; remoteCrewPanelModel.ts holds the launch-job predicates and size tiers, RemoteCrewPanelLaunch.tsx the setup-tab cards and sign-in block, RemoteCrewPanelCrewRow.tsx one crew row. The rows and pins keyed on the old paths follow the code: granted PANEL_TAB_MAP rows, the bare-control accounting, the restyle-ratchet entry, the cloud-sizes parity test, the hover-variant DECORATIVE row, the auto-guide stamp regex (joined over the owner family), the line-cap baseline rows, the feature map, the instances spec cites and an owner map in frontend-conventions.md. New owners specs pin the export set and the import edges; a layers spec covers the one owner no existing spec rendered. Part of #20192
0b0039f to
f2f48a4
Compare
|
Rebased onto main bb58b09 (supersedes head 0b0039f): main now carries #21581, which fixes the four checks that were red on the previous head (the katex golden, the codex-acp real-adapter test, the PyJWT |
|
|
chenmingwei23
left a comment
There was a problem hiding this comment.
Approving: readiness: passed, all checks green, mergeable, no changes requested.
Problem / Motivation
Goal:
SecurityPanel.tsxandRemoteCrewPanel.tsxeach drop under the 2,000-line file cap, with unchanged behaviour, by moving their parts into owner modules beside them.The two Settings panels are 3,503 and 2,938 lines, among the largest hand-written files in
website/. The campaign rule in #20192 caps a hand-written file at 2,000 lines, and the Remote Crew panel gets regular feature work (seven commits in the last week).Why it matters
A panel this size is where merge conflicts and missed side effects collect: the Security panel's eleven sections (approval, denied commands, governance, trust grants, redaction, ...) share one 3,500-line file, so a change to one section's card sits in the same diff hunk space as every other. Giving each section one module that new work for it goes to keeps the panels reviewable and keeps the line-cap guard satisfied.
Not a goal
RemoteCrewPanelcomponent itself (it moves nowhere; only its helpers and child components leave the file).What changed (motivation → approach → change)
Each panel stays its own facade: the same module id and every named export, so
SettingsPage.tsx, the story, the captures and everyvi.mock('.../SecurityPanel')work unchanged. Whole top-level declarations move into sibling owners, one per rail group of the Security panel and one per part of the Remote Crew panel; owners never import a facade, and nothing but a panel's own specs imports an owner. A recipe script performs the whole move from BASE by declaration name, never line numbers, so moved bodies are byte-identical; each component moves whole, so every hook registers in BASE order.SecurityPanel.tsxSecurityPanelPosture.tsx(Live security posture, status row/chip) ·SecurityPanelApprovals.tsx(auto-approve duration, flagged-file delivery consent) ·SecurityPanelDeniedCommands.tsx(built-in and custom deny rules) ·SecurityPanelTailnet.tsx(tailnet origin) ·SecurityPanelTrust.tsx(third-party app and registry trust grants) ·SecurityPanelRedaction.tsx(credential-redaction switch, allowed hosts) ·SecurityPanelLayers.tsx(defense-in-depth registry) ·SecurityPanelGovernance.tsx(governance-policy viewer)RemoteCrewPanel.tsxremoteCrewPanelModel.ts(launch-job predicates, size tiers, remembered keys) ·RemoteCrewPanelLaunch.tsx(setup-tab cards, progress card, sign-in block) ·RemoteCrewPanelCrewRow.tsx(one crew row, turn-API URL field)The Security facade keeps the rail (
SECURITY_SECTIONS,SECTION_LABEL_KEY, whichgen-ui-index.mjsreads from this file, the rail summaries) and the Documentation section (docs_lint'sCODE_COUPLED_DOCSnames this file). The rows and pins keyed on the old paths follow the code (grantedPANEL_TAB_MAProws, bare-control accounting, the restyle-ratchet entry, three re-pointed or joined source pins, docs). A new<Panel>.owners.test.tsxper facade pins the export set, its identity with the owners, and the import edges.Backwards compatibility
Compatible: both facades keep their paths and every named export (
SecurityPanel,RedactionSection,RedactionAllowedHostsCard,SECTION_LABEL_KEY,SECTION_GROUP_KEY,FEATURE_LABEL_KEY,FEATURE_DESCRIPTION_KEY,SCOPE_LABEL_KEY,GOV_PLANE_TITLE_KEY,humaniseScopeLeaf,trustFailureMessage,registryTrustFailureMessage;RemoteCrewPanel,TurnUrlField), each the very binding its owner defines;*.owners.test.tsxpins the export set and the identity.Removes nothing: the moved code is reachable through the same import paths, and no export, route, React Query key, test id, i18n key or settings-registry id changes (
settingsRegistry.gen.tsandsettings-registry.generated.jsonregenerate byte-identical).Tests
New
src/pages/settings/SecurityPanel.owners.test.tsx,src/pages/settings/RemoteCrewPanel.owners.test.tsx: the owner set, every sibling the facade imports under its name is in the family, the facade's export set and that each moved export is the owner's own binding, owners never import the facade, nothing outside the panel imports an owner, plus a self-test of the import reader.Re-pointed or joined (assertion text unchanged; each proven by a mutation in the construct's new home, red, then restored)
test/test_cloud_sizes_ui_parity.py:PANELreadsremoteCrewPanelModel.ts, whereSIZE_TIERS/X86_TIERSlive (L30). Light tier vcpu 4 → 5 there turnstest_panel_tier_matches_sizes_py[light]red.src/test/hoverVariantPolicy.test.ts: theDECORATIVErow namespages/settings/SecurityPanelPosture.tsx, StatusRow's new home. Changing the glyph'ssize={11}there turns two cases red.src/test/settingsCoverage.test.ts: theWAIVED_BARE_CONTROLSrows for both panels are split per owner. The counts sum to BASE and the reasons are BASE's, split. One extra<ToggleinSecurityPanelTailnet.tsxturns the accounting red.website/scripts/settingsExtract.tsPANEL_TAB_MAP(granted): 8 rows mapSecurityPanel*.tsx→securityand 2 rows mapRemoteCrewPanel{Launch,CrewRow}.tsx→instances. Dropping the Redaction row turns "every panel file is mapped" and "every manual entry's labelKey appears in a panel file mapped to its tab" red. Dropping the CrewRow row turns the first red.src/uiLocations/autoGuide.test.ts: the negative "no auto-guide stamp in the Security tab's files" regex readsSecurityPanel[A-Za-z]*, the facade plus every owner (L40(8) join). With the Security tab dropped fromTRUST_ROOT_PARENTSand theparent_idsloop removed, so that only the regex can catch it, the joined regex goes red on a stamp inSecurityPanelApprovals.tsx. The BASE exact-name regex passes blind under the same mutation.website/scripts/restyle-baseline.json: the 14shadcn/no-restylesites are all CrewRow menu items, so the entry moves toRemoteCrewPanelCrewRow.tsx. Putting the 14 back onRemoteCrewPanel.tsxturns the ratchet red twice: shrunk, and an unlisted file.The table and logs are in the scope's
mutations.md. Every pin is green again after the mutation is restored.Runs (local,
gate_slot)tsc -p tsconfig.app.json0.eslint src/ --max-warnings 00.jscpd .found 0 clones.run_scoped_tests.py's 377 related files plus every pages/settings, i18n, uiLocations and command-palette spec and the tree-scanning ratchets. The three new specs pass 5 times in shuffled order, once with 3 workers, and 3 times underKIROCREW_ACT_STRICT=1with no act() warning (the layers spec waits for the section heading before it asserts). The act() warnings printed came from unrelated, load-sensitive specs (GuideLayer, ChatSidebar folder settings, KiroSignInNotice, CompactionCard, OnboardingFlow), none of which renders these panels.SecurityPanelDeniedCommands.tsx86.9%,SecurityPanelApprovals.tsx91.4%,SecurityPanelTrust.tsx92.6%,SecurityPanel.tsx93.9%,SecurityPanelTailnet.tsx95.8%,SecurityPanelGovernance.tsx96.2%,remoteCrewPanelModel.ts96.7%,SecurityPanelRedaction.tsx96.9%,RemoteCrewPanel.tsx97.0%,RemoteCrewPanelCrewRow.tsx97.6%,RemoteCrewPanelLaunch.tsx98.2%,SecurityPanelPosture.tsx100%, andSecurityPanelLayers.tsx100% with the new layers spec (30% without it).I18N_BASE_REF=<base> npm run i18n:check: every row PASS, with 0 literals and 0 number+unit literals on added lines. The one dynamic key site (i18nT(tipKey)) moved fromSecurityPanel.tsxtoSecurityPanelGovernance.tsx, and the dynamic total is unchanged.gen-ui-index.mjs --check: up to date. The settings registry regenerates byte-identical (247 entries, 21 dynamic labels skipped,cmpclean on both artifacts). Phantom classes and focus cue: 0.use*sequence is identical at HEAD, 76 calls in 13 SecurityPanel functions and 80 calls in 4 RemoteCrewPanel functions.docs_lint.py: 0.check_file_line_cap.py: 0 failures.semgrep/, over the changed source and test files: 0 findings. Its TS parser partial-parseshoverVariantPolicy.test.ts:141(a labelled tuple type), as it already did at BASE.test_flake_pattern_ratchet.py: 58 passed.scripts/local-gate.py --dry-runselects 894 backend + 377 frontend files, over the ~600 limit, so the floor above ran instead; CI owns the broad matrix.Manual verification
N/A — unit coverage sufficient: the change is a verbatim move proven by the move audit and the hook-order check below, and the panels' own specs (which render every section) run unmodified against the composed facades.
Screenshots / video
Why no screenshot: markup, classes and text move verbatim into owner components, so every Settings ▸ Security and Settings ▸ Remote Crew surface renders byte-identical DOM.
Move audit
website/src/pages/settings/SecurityPanel.tsx: 3503 → 331 lines. 3,068 removed non-blank lines; 3,045 of them are found unchanged in the new files (99.25%). The 23 unmatched are glue: 5 pruned import lines, 16 declarations that gainexport, and the 2 pointer-comment lines below.website/src/pages/settings/RemoteCrewPanel.tsx: 2938 → 1562 lines. 1,362 removed non-blank lines; 1,330 found unchanged (97.65%). The 32 unmatched are 3 pruned import lines and 29 declarations that gainexport.Lines that changed inside moved code:
exporton the declarations another file now imports.PINNED_TOOLTIP_KEY's "for the reason above" namesFEATURE_LABEL_KEY(SecurityPanelLayers.tsx), andDISTRIBUTION_REFRESH_KEY's "TAILNET_STATE_KEYabove" names SecurityPanelTailnet.tsx.KirocrewCfgShapetoGovernancePolicyViewer, and the "Security tab.basePath…" doc stays aboveSecurityPanelin the facade instead of leaving withRedactionSection. The NOTE on why the plugin install command is not hardcoded, which leadsSizeCardat BASE, stays right after the launch constant it follows at BASE (PRICING_CALCULATOR_URL) inremoteCrewPanelModel.ts.Added to the facades: the new docstring of
SecurityPanel.tsx, which names the owners, and one paragraph inRemoteCrewPanel.tsx's docstring.Diff alignment (L36): git's default diff and
--minimalgive an identicalgit diff --numstatfor all 30 changed files (SecurityPanel.tsx+39/−3,211,RemoteCrewPanel.tsx+18/−1,394). The whole diff is 599,617 bytes.CI path references
None: no workflow path filter,
AUTOSDE.yamlglob or sensitive-change glob names these files.Shared rows: both targets' rows leave
.github/file-line-cap-baseline.txt(each now ends under 2,000 lines).website/scripts/restyle-baseline.jsonmoves the Remote Crew panel's 14shadcn/no-restylefindings, all CrewRow menu items, toRemoteCrewPanelCrewRow.tsx(the sum stays 14).Prose citations corrected (L29):
website/src/components/commandPalette/settingsManual.ts(the section owners carry thedata-setting-labelanchors),website/scripts/i18n-plural-codemod.mjs(thenRulessite is inSecurityPanelGovernance.tsx), anddocs/request-for-change/rfc-outbound-instance-transport.mdanddocs/request-for-change/plans/2026-09-23-outbound-instance-transport.md(connectionTypeLabel/connectionTypeHintare inRemoteCrewPanelCrewRow.tsx). Docs (SD27):docs/feature-map/README.md(six rows),docs/system-specs/modules/instances.md(coordsOf(),TurnUrlField) and the new owner map inwebsite/docs/frontend-conventions.md.References not edited (cost):
src/kiro_crew/dashboard/handlers_instances.py:129namescoordsOf()inRemoteCrewPanel.tsx; it now lives inRemoteCrewPanelCrewRow.tsx. That file is another open split's target, so the citation is fixed after that split lands.Related Issues
Part of #20192
Follow-up: #21320 (the deferred
coordsOf()comment citation above)Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)