Skip to content

Remove the schema field from the stored configuration type#1823

Merged
kmcginnes merged 1 commit into
mainfrom
remove-stored-config-schema
Jun 22, 2026
Merged

Remove the schema field from the stored configuration type#1823
kmcginnes merged 1 commit into
mainfrom
remove-stored-config-schema

Conversation

@kmcginnes

@kmcginnes kmcginnes commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

Description

Slice 2 of the configuration-model simplification (Option B). Slice 1 (#1822) has merged, so this now targets main directly.

A Connection's data has three shapes that were being conflated through one RawConfiguration type: the on-disk export file, the in-memory merged shape the UI reads, and the IndexedDB storage shape. This slice separates the storage shape from the in-memory merged shape:

  • RawConfiguration (persisted / configurationAtom / IndexedDB) is now { id, displayLabel?, connection? }no schema. The schema lives only in schemaAtom; nothing read it back off the stored config.
  • New MergedConfiguration = RawConfiguration & { schema } is the output of mergeConfiguration — the schema is required, since the merge always builds it. ConfigurationContextProps extends it.

Dropping the dead schema field from storage and tightening it to required on the merged shape also removes the defensive ?.schema?. chaining that was scattered across every consumer.

How to read

  1. core/ConfigurationProvider/types.ts — the type split (start here).
  2. core/StateProvider/configuration.ts + core/ConfigurationProvider/useConfiguration.tsmergeConfiguration return type and the consumers losing their optional chains.
  3. utils/saveConfigurationToFile.ts — reads schema off the merged shape; vertices/edges defaulting drops out.
  4. Tests — the rest. saveConfigurationToFile.test.ts gains a small makeConfig() factory that removes repeated fixture boilerplate.

Backward compatibility

Removing a field from a persisted type. Legacy IndexedDB blobs and exported files may still embed a schema on the config; three regression pins guard the ends and were each mutation-tested:

  • storage round-trip carries a stray embedded schema through untouched (localDb.test.ts)
  • import never writes the schema back into the config entry (useImportConnectionFile.test.tsx)
  • the merge sources its schema only from the active schema, never from one embedded on the stored config (configuration.test.ts)

Validation

  • pnpm checks clean; pnpm test green (rebased onto current main).
  • All three backward-compat pins mutation-tested (broke source, confirmed each fails, reverted).
  • The required-schema invariant is enforced at compile time — renaming the merge's schema key fails typecheck.

Related Issues

Check List

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I have verified pnpm checks passes with no errors.
  • I have verified pnpm test passes with no failures.
  • I have covered new added functionality with unit tests if necessary.
  • I have updated documentation if necessary.

@kmcginnes kmcginnes force-pushed the explicit-exported-connection-type branch from 12504f8 to b763385 Compare June 17, 2026 23:02
@kmcginnes kmcginnes force-pushed the remove-stored-config-schema branch from 8527f13 to fd7daab Compare June 18, 2026 16:52
Base automatically changed from explicit-exported-connection-type to main June 18, 2026 22:01
@kmcginnes kmcginnes force-pushed the remove-stored-config-schema branch from fd7daab to e03128f Compare June 19, 2026 15:37
@kmcginnes kmcginnes marked this pull request as ready for review June 19, 2026 21:25
Slice 2 of the configuration-model simplification (epic #1839). A
Connection's data has three shapes that were being conflated through one
RawConfiguration type: the on-disk export file, the in-memory merged shape
the UI reads, and the IndexedDB storage shape. This separates the storage
shape from the in-memory merged shape.

RawConfiguration (persisted / configurationAtom / IndexedDB) is now
{ id, displayLabel?, connection? } — no schema. The schema lives only in
schemaAtom; nothing read it back off the stored config. MergedConfiguration
= RawConfiguration & { schema } is the output of mergeConfiguration, with
schema required since the merge always builds it; ConfigurationContextProps
extends it. Tightening schema to required also drops the defensive
?.schema?. chaining across every consumer.

Legacy IndexedDB blobs and exported files may still embed a schema on the
config; three mutation-tested regression pins guard the storage round-trip,
the import split, and the merge ignoring an embedded schema.

Closes #1842
@kmcginnes kmcginnes force-pushed the remove-stored-config-schema branch from e03128f to c77ccfe Compare June 19, 2026 21:31
@kmcginnes kmcginnes merged commit 5372c2e into main Jun 22, 2026
6 checks passed
@kmcginnes kmcginnes deleted the remove-stored-config-schema branch June 22, 2026 16:12
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.

Remove the dead schema field from the stored configuration type

2 participants