Skip to content

refactor: define project discovery models natively - #379

Merged
kvlonge merged 1 commit into
mainfrom
refactor/native-discovery-models
Nov 11, 2026
Merged

kvlonge merged 1 commit into
mainfrom
refactor/native-discovery-models

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Why

Python in SQLTide should be a thin wrapper. Project discovery configuration is built and read by the native core and is not part of the authored API, so its shapes belong there too.

Changes

  • All 49 project, pipeline, target, defaults, naming, retention, Kafka and step configuration shapes are native classes; compiler/discovery/models.py re-exports them.
  • The discovery KafkaSettings is registered natively as DiscoveryKafkaSettings and keeps its public name, module and field-hiding repr, separate from the compile KafkaSettings. The boundary allows that one alias, in that module only, with negative tests for an unlisted alias, the alias in another module and the name under another alias.
  • Shape defaults are cached per module and class name, so same-named shapes in different modules stay separate.
  • Boundary: remaining_lines 1774→1080; no new stays.

Introspection and subclassing of internal shapes

As in the previous shape releases: native shapes have no vars()/__dict__, generic field types, annotations, signatures and docstrings, and Python subclasses are not dataclass subclasses. copy.copy rebuilds frozen container fields, so they are equal but not the same objects.

Verification

make check-ci on the final head; goldens unedited. A new test pins the discovery KafkaSettings repr hiding every field, and passes on 0.65.13. Against 0.65.13: 6×1500 differential cases match, including ProjectSpecError checks, coercion order, defaults, factories, repr, equality, hash and misuse calls; 14 planted mutations are caught; earlier slices' differentials, CLI and dev-server API outputs are identical after masking.

Project, pipeline, target, default, naming and step configuration shapes
are native classes and compiler/discovery/models.py re-exports them. The
discovery KafkaSettings is registered natively as DiscoveryKafkaSettings
and keeps its public name, module and field-hiding repr, separate from
the compile KafkaSettings; the boundary allows that one alias in that
module only. Movable Python drops from 1774 to 1080 lines.
@kvlonge
kvlonge enabled auto-merge (squash) November 11, 2026 05:33
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Deploying sqltide with  Cloudflare Pages  Cloudflare Pages

Latest commit: aa12b2e
Status: ✅  Deploy successful!
Preview URL: https://1f49ce7c.sqltide.pages.dev
Branch Preview URL: https://wip-native-discovery-models-7j7f.sqltide.pages.dev

View logs

@kvlonge
kvlonge merged commit b9aced8 into main Nov 11, 2026
17 checks passed
@kvlonge
kvlonge deleted the refactor/native-discovery-models branch November 11, 2026 06:10
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.

1 participant