refactor: decompose ConnectionManager (#115)#129
Merged
Conversation
…tion modules (#115) Split the 1464-line ConnectionManager.tsx into focused modules: - lib/connectionForm.ts — makeEmptyForm + pure getConnectionFormValidity - components/ConnectionFormFields.tsx — FieldLabel/FieldInput/SelectInput/FormRow/ElephantIcon - components/ConnectionDialogs.tsx — UnsavedChangesDialog/ConfirmDialog - components/ConnectionForm.tsx — the ConnectionForm component (+ TestResult) ConnectionManager.tsx (514 lines) now owns only the manager shell. Inline field-presence validation is lifted into getConnectionFormValidity and unit-tested. Tests split to match the new modules. No behavior change; 456 unit + 91 e2e pass. Note: FieldLabel and _SectionLabel were already dead code before this change and are preserved untouched (per repo convention). Part of M2 code-review finding.
…tion (#115) - Split ConnectionForm General tab into ConnectionGeneralTab (604→420 lines) - Extract DatasourceListItem from ConnectionManager (514→453 lines); both now <500 - Dedupe dialog scaffolding via a shared ModalShell; rename ConfirmDialog to DeleteConfirmDialog to end the name collision with the unused Dialog.tsx - Collapse the duplicated form/cleanValues initializer into one initialForm - Remove pre-existing dead code (FieldLabel, _SectionLabel) - Drop the unrelated package.json.md5 churn No behavior change; 456 unit + 91 e2e pass, tsc + biome clean.
5 tasks
nkcoder
added a commit
that referenced
this pull request
Jul 4, 2026
…131) * test: cover Find, ConnectionGeneralTab, and session-hook error paths Fills gaps surfaced while regression-testing the #127–#130 refactor: - e2e/query-editor-find.spec.ts: in-editor Find (Cmd+F) had no e2e coverage after the #128 QueryEditor/FindBar split — open/focus/close, match count, next/prev navigation, clear-resets. - ConnectionGeneralTab.test.tsx: the #129-extracted tab had no test (40% func) — field edits, port numeric coercion, password mask/reveal, isEdit placeholder, derived URL. - useDatasourceSession: GetCompletions failure during connect/refresh; disconnect no-op when nothing is connected. - useQueryHistory: null history result coerces to []. * test: raise hooks branch coverage + set two-tier coverage thresholds Adds the missing hooks-branch tests and turns the flat #51 threshold into a two-tier gate: - useSidebarTree.test.ts (new): the hook had no direct test — covers the live-load error branches (columns/sub-folder load failures), the toggleColumnsFolder guard + toggle, and each sub-folder loader. - useQueryExecution: non-result-set (DDL) rows-affected path; error leaves a pinned tab intact; double-pin preserves the first; close a non-active tab. - useDatasourceSession: successful refresh clears a same-ds warning; a refresh for one ds leaves another ds's warning intact. hooks branch coverage 78.6% -> 82.7%; overall 89.8% -> 90.6% stmt. vitest.config.ts: global ratchet floor (90/82/90/91) as a regression gate, plus higher per-dir floors for pure logic (lib/ 97/90/100/99, hooks/ 95/82/95/97). Verified the glob thresholds are enforced.
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.
What
Second slice of #115 (M2 — oversized components). Decomposes
ConnectionManager.tsx(1464 → 514 lines) into focused, independently-testable modules. No behavior change.New modules
lib/connectionForm.ts(34) —makeEmptyForm+ the puregetConnectionFormValidityhelper (field-presence validation for save/test), lifted out of the inlinecanSave/canTestbooleans.components/ConnectionFormFields.tsx(159) — shared presentational primitives:FieldLabel,FieldInput,SelectInput,FormRow,ElephantIcon.components/ConnectionDialogs.tsx(185) —UnsavedChangesDialog+ConfirmDialog.components/ConnectionForm.tsx(604) — theConnectionFormcomponent and itsTestResulttype.ConnectionManager.tsxnow owns only the manager shell (datasource list, CRUD handlers, form/dialog orchestration).Tests split to match the modules
lib/connectionForm.test.ts—makeEmptyForm+ 7 newgetConnectionFormValiditytestscomponents/ConnectionFormFields.test.tsx—FieldInput/SelectInputcomponents/ConnectionForm.test.tsx— theConnectionFormtests (no GoApp mock needed —onTestis a prop)ConnectionManager.test.tsx— keeps the manager + double-click testsAcceptance criteria
T.*) and patterns preservedtsc, biome cleanNotes
FieldLabel(exported) and_SectionLabel(internal) were already dead code before this change — no call sites anywhere. Preserved untouched per the repo's "don't delete pre-existing dead code" convention; flagging here in case you'd like a follow-up to remove them.