Skip to content

refactor!: definitions are built once, in Component.definition - #339

Merged
aaaaahaaaaa merged 1 commit into
mainfrom
refactor/destination-definition
Sep 14, 2026
Merged

refactor!: definitions are built once, in Component.definition#339
aaaaahaaaaa merged 1 commit into
mainfrom
refactor/destination-definition

Conversation

@aaaaahaaaaa

@aaaaahaaaaa aaaaahaaaaa commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Destination review item 8, taken to its root.

Destination.definition() duplicated Component.definition() to return DestinationDefinition, an empty subclass. Looking wider, the same ten-field ComponentDefinition(...) call was copied into five overrides, each drifting a little: Source and Asset left out state_schema, and only Source and Destination validated FetchField providers.

Now:

  • Component.definition() is the one place a class is described. It validates every FetchField provider against the class's relations, for every kind.
  • A kind whose definition carries more builds its own model from the base one: SourceDefinition(**dict(super().definition()), assets=...). Source nests its assets, Asset adds asset_schema and partitioning (its path through Asset.classpath), Resource only changes the type. Connection and OAuthConnection keep enriching super().definition() as before.
  • DestinationDefinition and Destination.definition() are deleted: a destination describes nothing beyond the base, and its definition is a plain ComponentDefinition. The app already typed it as an alias of ComponentDefinition.

No second entry point: definition() is the only way a class is described.

Verification

  • uv run --frozen ruff check, uv run --frozen ty check: all checks passed.
  • uv run --frozen pytest -q: 2804 passed. New tests: a fetch-field provider naming an undeclared relation now fails on an asset too; a destination's definition is the plain model and the removed export is gone.

Follow-up

  • The pandas-gbq warning on every BigQuery load is the last open item from this series.

By Digitl

@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@aaaaahaaaaa aaaaahaaaaa changed the title refactor!: definitions are built once, by ComponentDefinition.from_component refactor!: definitions are built once, in Component.definition Sep 10, 2026
The ten-field `ComponentDefinition(...)` constructor call was copied into five
`definition()` overrides (Component, Resource, Source, Asset, Destination),
each drifting a little: Source and Asset left out `state_schema`, only Source
and Destination validated `FetchField` providers. `DestinationDefinition` was
an empty subclass whose sole purpose was to be returned by one of those copies.

`Component.definition()` is now the one place a class is described, and it
validates fetch-field providers for every kind. A kind that carries more
builds its own model from the base one,
`SourceDefinition(**dict(super().definition()), assets=...)`: Source nests
its assets, Asset adds the output schema and partitioning (its path through
`Asset.classpath`), Resource only changes the type. `DestinationDefinition`
and `Destination.definition()` are deleted: a destination describes nothing
beyond the base.

By Digitl
@aaaaahaaaaa
aaaaahaaaaa force-pushed the refactor/destination-definition branch from 2b9cf0b to 5f345c6 Compare September 10, 2026 14:56
@aaaaahaaaaa
aaaaahaaaaa merged commit 885cd4a into main Sep 14, 2026
11 checks passed
@aaaaahaaaaa
aaaaahaaaaa deleted the refactor/destination-definition branch September 14, 2026 09:22
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