Skip to content

Connections refactor, phase B (8/10): move exported connection file code into src/connections/ - #2349

Merged
kmcginnes merged 1 commit into
aws:mainfrom
mjuarros:connections-phase-b-exported-file
Oct 2, 2026
Merged

kmcginnes merged 1 commit into
aws:mainfrom
mjuarros:connections-phase-b-exported-file

Conversation

@mjuarros

@mjuarros mjuarros commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

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.

Phase B (8/10) of the connections refactor (aws#2298). Move the exported
connection file code into src/connections/: parseConnectionFile (and the
ExportedConnectionFile type), saveConfigurationToFile, and useImportConnectionFile
(from modules/AvailableConnections/), with their tests, the byte-exact golden
test, and its __fixtures__.

Importers switch to @/connections. saveConfigurationToFile keeps its default
export and is re-exported from the module index as a named export. Inside the
module, core is imported by specific path (entities, ConfigurationProvider,
StateProvider/storageAtoms), never the @/core barrel. No renames, byte-identical
bodies; the golden fixtures are unchanged.

Also update two stale path references the move left behind: docs/agents/testing.md
and the shared-file-envelope ADR.
@mjuarros
mjuarros marked this pull request as ready for review October 1, 2026 22:53
@kmcginnes
kmcginnes merged commit eddb06d into aws:main Oct 2, 2026
4 checks passed
kmcginnes pushed a commit that referenced this pull request Oct 2, 2026
…ecycle hooks into src/connections/ (#2350)

Phase B, PR 9 of #2298. Pure refactor, no behavior change. Follows #2349
(PR 8).

## What this does

Moves the remaining connection code into `src/connections/`, via `git
mv` (history preserved, bodies byte-identical, no renames):

- `defaultConnection.ts` (from `core/`)
- `useActivateConnection` (from `core/StateProvider/`)
- `useDeleteConfig` / `useDeleteActiveConfiguration` (from `src/hooks/`)

plus their tests. Importers switch to `@/connections`. Inside the
module, the lifecycle hooks read and write the persisted atoms via the
specific `@/core/StateProvider/storageAtoms` path, never the `@/core`
barrel.

## Default export

`useActivateConnection` keeps its `export default` in the file and is
re-exported from the module index as a **named** export (`export {
default as useActivateConnection }`) — the same pattern used for
`saveConfigurationToFile` in PR 8. Its two default-importers switched to
the named import.

## Compatibility (per the epic's hard rules)

- Persisted atoms stay in `storageAtoms.ts`; the hooks read/write the
same atoms, no init cycle (verified: the
`storageAtoms`/`storedConnectionShapes` preload tests pass).
- `defaultConnection`'s server fetch + Zod validation
(`DefaultConnectionDataSchema`) is byte-identical — not weakened.
- No symbol renames; storage keys and field names unchanged.

## Verification

- `pnpm checks` green (lint, format, types across all 4 workspace
projects).
- `pnpm test` green — 3150 tests / 241 files.
- The `useDeleteConfig` (deletes from all four atom maps) and
`mapToConnection` behaviors were verified by mutation — both go red when
the moved logic is broken, against independent literals.
- `AppStatusLoader.test.tsx` spies on `fetchDefaultConnection` via the
concrete module (`@/connections/defaultConnection`), and interception
through the barrel-imported production call was confirmed by mutation.

## Blocked features

None.
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.

2 participants