Skip to content

refactor: split the five files over 500 lines - #48

Merged
WhiteMuush merged 6 commits into
developfrom
refactor/split-large-files
Oct 13, 2026
Merged

WhiteMuush merged 6 commits into
developfrom
refactor/split-large-files

Conversation

@WhiteMuush

Copy link
Copy Markdown
Owner

Part of #30: the five files over 500 lines raised in the DevSecOps review. The other 25 files over 200 lines follow in the next PRs.

File Before After
src/components/dashboard/DashboardCanvas.tsx 734 200
src/components/settings/ConnectWizard.tsx 586 199
src/components/settings/SsoSettings.tsx 566 153
src/lib/reports/pdf.tsx 542 61
src/app/(auth)/login/page.tsx 540 84

Each leaves the OVER_LIMIT list; every new file is under 200 lines. Comments that moved are rewritten as one sentence.

How each split was checked

The same scripted browser session ran on the old and the new code, with server responses mocked where a step would write data:

  • PDF report: rendered PDF byte-identical except its timestamp and document id.
  • Connect wizard: 8 steps (choose, configure Azure, Google, SCIM, test, done) render the same HTML and pixels.
  • SSO settings: 9 scenarios (load error and retry, connect error, connect, DNS record, verify, edit, save, disconnect) render the same HTML and pixels.
  • Login page: 17 scenarios (SSO error code, escape hatch, password errors, SSO-required, SSO redirect failure, authenticator code, email code, policy refusal, passkey failure) plus a real sign-in.
  • Dashboard canvas: customize, add menu, drag-to-swap, resize, rename, source filter, reset, zoom: the four saved layouts are identical and the screenshots match; the failed-save bar from fix(dashboard): show failed saves with a retry聽#43 still works.

Behaviour changes, all small

  • Login, fixed bug: the authenticator code field used to open pre-filled with the email address, because React reused the email input. Each step is now its own component, so the field starts empty. Going back still keeps the typed email.
  • SSO settings: a non-JSON error response now shows the action's fallback message instead of a JSON parse error.
  • Connect wizard: two placeholders change, because the secret check reads moved lines as new: the Google key example said RSA PRIVATE KEY (service account keys are PRIVATE KEY), the AWS one was a full example key.

Verified

make check green, integration suite 110/110.

pdf.tsx goes from 542 to 61 lines: theme, building blocks, narrative sections and detail tables move to pdf-parts/. The rendered PDF is byte-identical apart from its timestamp and document id.
ConnectWizard goes from 586 to 199 lines: provider list, field definitions and each step move to connect-wizard/. All eight wizard steps render the same HTML and pixels as before. Two placeholders change because the secret check reads moved lines as new: the Google key example said RSA PRIVATE KEY, which service account keys are not, and the AWS one was a full example key.
SsoSettings goes from 566 to 155 lines: types, a useSsoProvider hook, the forms and the provider details move to sso/. The four actions share one request helper, which now shows the fallback message when a response is not JSON instead of a parse error. Nine SSO scenarios render the same HTML and pixels as before.
page.tsx goes from 540 to 84 lines: the flow state moves to useLoginFlow, the SSO lookup to resolve-sso, the forms to login-forms (the email-code and authenticator forms become one CodeForm). Each step is now its own component, so React no longer reuses the email input as the next step's field: the authenticator code field used to open pre-filled with the email address. Going back still keeps the typed email. Seventeen sign-in scenarios checked against the previous page, plus a real sign-in.
DashboardCanvas goes from 734 to 200 lines: presets and saves move to usePresets, drag-to-swap and squeeze-resize to useGridGestures, the toolbar and per-widget controls to their own components, under canvas/. A scripted session (customize, add menu, swap, resize, rename, source filter, reset, zoom) saves the same four layouts and renders the same screenshots as before; the failed-save bar behaves the same.
@WhiteMuush
WhiteMuush merged commit 4850d13 into develop Oct 13, 2026
14 checks passed
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.

1 participant