Connections refactor, phase B (7/10): move active-connection selectors into src/connections/ - #2348
Merged
kmcginnes merged 1 commit intoOct 1, 2026
Conversation
Phase B (7/10) of the connections refactor (aws#2298). Move the active-connection selectors into src/connections/activeConnection.ts: activeConfigSelector and activeConnectionAtom (from core/StateProvider/configuration.ts), and queryEngineSelector and useQueryEngine (from core/connector.ts). Importers switch to @/connections. activeConnection.ts reads the persisted atoms from @/core/StateProvider/storageAtoms directly, not the @/core barrel. This is the first module code the index exports that reads those atoms, so the storageAtoms deep-import comment is updated to state the index now exports the active-connection selectors. configuration.ts keeps the schema/merge selectors; connector.ts keeps explorerAtom and serverLogger. Tests move alongside the selectors. No renames, byte-identical bodies.
mjuarros
marked this pull request as ready for review
October 1, 2026 20:41
kmcginnes
approved these changes
Oct 1, 2026
kmcginnes
pushed a commit
that referenced
this pull request
Oct 2, 2026
…ode into src/connections/ (#2349) Phase B, PR 8 of #2298. Pure refactor, no behavior change. Follows #2348 (PR 7). ## What this does Moves the Exported Connection File code into `src/connections/`, via `git mv` (history preserved, bodies byte-identical, no renames): - `parseConnectionFile` + the `ExportedConnectionFile` type (from `utils/`) - `saveConfigurationToFile` (from `utils/`) - `useImportConnectionFile` (from `modules/AvailableConnections/`) - their tests, plus `connectionFileGoldenFiles.test.ts` and its `__fixtures__/` (the golden test now exercises connections-module code, so it moves with the module) Importers switch to `@/connections`. Inside the module, core is imported by specific path (`@/core/entities`, `@/core/ConfigurationProvider`, `@/core/StateProvider/storageAtoms`, `@/core/StateProvider/appStore`), never the `@/core` barrel. ## Default export `saveConfigurationToFile` keeps its `export default` in the file and is re-exported from the module index as a **named** export (`export { default as saveConfigurationToFile }`) — the same pattern `core/ConfigurationProvider/index.ts` and `utils/index.ts` already use. The two former default-importers switched to the named import. ## Compatibility (per the epic's hard rules) - **Phase A golden fixtures byte-unchanged** — git records all 5 as `R100` pure renames; the byte-exact export golden test passes unchanged in its new home. - Storage keys and persisted/file field names unchanged. - Persisted atoms stay in `storageAtoms.ts`; `useImportConnectionFile` reads them via the specific `storageAtoms` path (no new init cycle). - No symbol renames. ## Verification - `pnpm checks` green (lint, format, types across all 4 workspace projects). - `pnpm test` green — 3150 tests / 241 files. - The golden test was verified to still bite by mutation: altering the exported legacy `url` value turns it red against the un-edited `?raw` fixture bytes. - No init cycle: the `storageAtoms`/`storedConnectionShapes` preload tests pass. Also updates two stale path references the move left behind (`docs/agents/testing.md`, the shared-file-envelope ADR). ## Blocked features None.
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.
Phase B, PR 7 of #2298. Pure refactor, no behavior change. Follows #2344 (PR 6).
What this does
Moves the active-connection selectors into
connections/activeConnection.ts, bodies byte-identical, no renames:activeConfigSelector,activeConnectionAtom(fromcore/StateProvider/configuration.ts)queryEngineSelector,useQueryEngine(fromcore/connector.ts)Importers switch to
@/connections. The@/corebarrel no longer re-exports the moved selectors.configuration.tskeeps the schema/merge selectors (and now importsactiveConfigSelectorfrom@/connectionsformergedConfigurationSelector);connector.tskeepsexplorerAtom,useExplorer, andserverLogger(and importsactiveConnectionAtomfrom@/connections).Init-cycle safety
This is the first module code the
@/connectionsindex exports that reads the persisted atoms.activeConnection.tsimports those atoms from@/core/StateProvider/storageAtomsdirectly — the specific path, not the@/corebarrel — per the module rule. AndstorageAtoms.tscontinues to deep-import the transform from@/connections/legacyConnectionrather than the index, keeping atom readers out of its top-level-await init graph.Because the index now genuinely exports atom-reading selectors, the explanatory comment on that deep import (added in PR 6) is tightened from "atom readers the index may export" to state the fact: the index exports the active-connection selectors, which read these atoms. The preload tests (
storageAtoms.test.ts,storedConnectionShapes.test.ts) pass without hanging, confirming no cycle was introduced.Tests
The
activeConfigSelector/activeConnectionAtomsuites move out ofconfiguration.test.tsand thequeryEngineSelectorsuite out ofconnector.test.ts, intoconnections/activeConnection.test.ts.configuration.test.tskeeps the merge/type-config coverage;connector.test.tskeeps theexplorerAtomsuite.Compatibility (per the epic's hard rules)
storageAtoms.ts.Verification
pnpm checksgreen (lint, format, types across all 4 workspace projects).pnpm testgreen — 3150 tests / 241 files.storageAtomspath, deeplegacyConnectionimport) is what keeps atom readers out of the init graph.queryEngineSelectorgremlin-fallback andactiveConnectionAtomURL-normalization tests were verified by mutation (they go red when the moved logic is broken).Blocked features
None.