Repository navigation
refactor: split 13 more files under 200 lines - #49
Closed
WhiteMuush wants to merge 14 commits into
Closed
WhiteMuush wants to merge 14 commits into
WhiteMuush wants to merge 14 commits into
Conversation
check-licenses.mjs goes from 201 to 179 lines: its 21-line header and two-line comments become single sentences, the reasoning now lives in the wiki Development page.
bootstrap.ts goes from 211 to 155 lines without a code change: each comment block becomes one sentence, and the full reasoning (restart idempotency, audit truth, token never logged, never throwing, replica races) moves to the wiki Authentication page.
round-trip.itest.ts goes from 227 to 177 lines, comments only; the four tests still pass.
The detail route goes from 209 to 17 lines: employee, breach and alert builders move to src/lib/entity-detail, with the MFA label and remediation group shared. The kind lookup uses Object.hasOwn so inherited names such as constructor still get a 400. All 60 entities of the demo data, the 400, 404 and 401 cases return byte-identical responses.
263 lines become bootstrap.itest.ts (94, the start-up entry point), bootstrap-admin.itest.ts (141, state and first-admin creation) and bootstrap.fixtures.ts (the rolled-back empty database). Same 16 tests, all passing.
242 lines become invitation.itest.ts (issuing, 96), invitation-consume.itest.ts (redeeming, 114) and invitation.fixtures.ts, which gives each suite its own company so they can run in parallel. Same 14 tests, all passing.
400 lines become invitation-routes.itest.ts (invite route, rate ceiling, rotation gate, 147), invitation-rotation.itest.ts (forced rotation, acceptance, password change, 181) and a fixture giving each suite its own companies and mocks. Same 21 tests, all passing.
311 lines become user-create.itest.ts (156), user-create-escalation.itest.ts (50) and a fixture with a post() helper replacing the repeated six-line request literal. Comments become one sentence each. Same 8 tests, all passing.
runner.ts goes from 394 to 123 lines: severity and confidence move to severity.ts, finding persistence and corroboration to findings.ts, the retried lookup and check recording to lookup.ts. Its tests split the same way (severity, findings, checks), same 20 tests. No logic change.
Moving the builders into src/lib brought them under the coverage floor untested, and the new integration fixtures were counted as uncovered app code. The builders now have unit tests, fixtures are excluded like test files, and the floor rises to 57% of statements.
708 lines become five suites (model and helpers, permission gate, provider routes, domain verification, resolve and mandatory policy) and sso.fixtures.ts. Each suite now cleans only its own providers instead of every itest- one, so parallel suites cannot delete each other's rows. Comments become one sentence each. Same 21 tests; the full integration run passes twice in a row (110 tests).
dashboard.ts goes from 408 to 192 lines: the source-filterable series move to dashboard-series.ts with their tests, the other widget breakdowns to dashboard-breakdowns.ts, and an unused re-export of the risk helpers goes. getDashboardData and the three series for every provider return identical JSON on the demo data.
page.tsx goes from 345 to 85 lines: the default and library widget lists move to their own factories and preset loading to src/lib/dashboard-presets.ts. The server-rendered HTML is identical and the RSC payload differs only by bundle file names.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #30, second batch: 13 more files under 200 lines. Stacked on #48, merge that one first.
scripts/check-licenses.mjssrc/lib/auth/bootstrap.tssrc/lib/sso/round-trip.itest.tsapi/dashboard/detail/[kind]/[id]src/lib/auth/bootstrap.itest.tssrc/lib/auth/invitation.itest.tssrc/lib/auth/invitation-routes.itest.tssrc/lib/sso/user-create.itest.tssrc/lib/sso/sso.itest.tssrc/lib/scan/runner.tssrc/lib/scan/runner.test.tssrc/lib/dashboard.tssrc/app/(dashboard)/dashboard/page.tsxWorth reviewing
itest-provider in oneafterAll; split, that would have let one suite wipe another's rows mid-run, so each now cleans only its own. The full integration run passes twice in a row (110 tests, 27 files).Object.hasOwn, so inherited names likeconstructorstill get a 400.src/libbrought them under the floor; they now have unit tests (detail builders, preset loader). Test fixtures are excluded from coverage like test files. The floor rises to 57% statements, 52% branches, 51% functions, 58% lines.Verified
make checkgreen, integration suite 110/110.