Skip to content

refactor!: make component types reflect their capabilities - #722

Open
disrupted wants to merge 8 commits into
chore/python314-baselinefrom
refactor/component-hierarchy
Open

disrupted wants to merge 8 commits into
chore/python314-baselinefrom
refactor/component-hierarchy

Conversation

@disrupted

@disrupted disrupted commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

This makes the component hierarchy match what each component actually supports. Components carry their own values type, and topic input and output support is defined explicitly instead of being inherited by everything.

The change removes incompatible field overrides and adds tests to protect defaults precedence and component discovery. Existing generated pipelines stay unchanged.

Breaking changes:

  • Helm and Kubernetes apps no longer accept topic sections by default.
  • Unsupported input or output sections now fail validation.
  • Kafka connectors now inherit Kafka app defaults.
  • Custom components need to adopt the new topic capabilities and values typing.

…ilities

Topic support (`from`/`to`) is now provided by the capability classes
`ConsumesTopics` and `ProducesTopics` instead of `PipelineComponent`.
Components without a capability reject the respective section.

BREAKING CHANGES:
- `helm-app` and `kubernetes-app` (and custom subclasses) no longer accept
  `from`/`to`.
- `producer-app`/`kafka-source-connector` reject `from`, `consumer-app`
  rejects `to` (now an error even when supplied via defaults of a shared
  parent key).
- Kafka connectors are now `KafkaApp`s: `kafka-app` defaults apply to them.
- `PipelineComponent.supports_from_section()` removed; use
  `isinstance(c, ConsumesTopics)`.
- Topic hook methods moved from `PipelineComponent` to
  `ConsumesTopics`/`ProducesTopics`.
@disrupted
disrupted requested a review from tobbber as a code owner October 28, 2026 08:46
@disrupted
disrupted added this pull request to stack #725 October 28, 2026 08:46
@disrupted disrupted changed the title refactor/component hierarchy refactor!: make component types reflect their capabilities Oct 28, 2026
@tobbber
tobbber requested a balanced review from Copilot October 28, 2026 10:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The generated schemas accept version: null, but the runtime validator rejects it, allowing pipelines to pass schema validation and still fail to load.

1 open issue
What changed in this PR

This refactors KPOps components so their types express supported topic capabilities and values models, while preserving generated pipeline output.

Changes:

  • Introduces explicit topic input/output capabilities and rejects unsupported sections.
  • Adds generic values typing and updates component discovery and defaults ancestry.
  • Updates Helm repository handling, generated schemas, documentation generation, and regression tests.
File Description
tests/​components/​test_kafka_source_connector.py Tests source input rejection and capability membership.
tests/​components/​test_kafka_sink_connector.py Checks sink input capability.
tests/​components/​test_helm_app.py Removes an unnecessary repository field override.
tests/​components/​test_component_hierarchy.py Tests ancestry, discovery, values typing, and section rejection.
tests/​components/​streams_bootstrap/​test_streams_bootstrap.py Tests default and custom Helm repositories.
tests/​components/​streams_bootstrap/​test_streams_app.py Tests rejection of a null chart version.
tests/​components/​streams_bootstrap/​test_producer_app.py Updates producer capability assertions.
tests/​components/​streams_bootstrap/​test_consumer_app.py Checks that consumers have no output field.
kpops/​pipeline.py Makes topic wiring capability-aware.
kpops/​core/​registry.py Excludes capabilities and parameterized generics from discovery.
kpops/​components/​streams_bootstrap/​streams/​streams_app.py Declares capabilities and specializes app and cleaner values.
kpops/​components/​streams_bootstrap/​streams/​model.py Specializes values with streams configuration.
kpops/​components/​streams_bootstrap/​producer/​producer_app.py Declares output capability and typed cleaner values.
kpops/​components/​streams_bootstrap/​producer/​model.py Specializes values with producer configuration.
kpops/​components/​streams_bootstrap/​model.py Makes the Kafka configuration type generic.
kpops/​components/​streams_bootstrap/​consumer/​model.py Introduces a generic consumer values base.
kpops/​components/​streams_bootstrap/​consumer/​consumer_app.py Declares input capability and typed cleaner values.
kpops/​components/​streams_bootstrap/​consumer_producer/​model.py Specializes the shared consumer values base.
kpops/​components/​streams_bootstrap/​consumer_producer/​consumer_producer_app.py Declares both topic capabilities and typed values.
kpops/​components/​streams_bootstrap/​base.py Adds generic values, repository fallback, and version validation.
kpops/​components/​base_components/​pipeline_component.py Rejects unsupported sections and preserves serialization order.
kpops/​components/​base_components/​kubernetes_app.py Makes Kubernetes values typing generic.
kpops/​components/​base_components/​kafka_connector.py Adopts topic capabilities and shared Kafka deployment behavior.
kpops/​components/​base_components/​kafka_app.py Defines topic consumption and production capabilities.
kpops/​components/​base_components/​helm_app.py Adds generic values and effective repository access.
kpops/​components/​base_components/​cleaner.py Makes cleaner values typing generic.
kpops/​components/​base_components/​base_defaults_component.py Filters capabilities and generic specializations from ancestry.
kpops/​components/​base_components/​__init__.py Exports the new topic capabilities.
hooks/​gen_docs/​gen_docs_components.py Resolves generic origins for inheritance documentation.
docs/​docs/​schema/​pipeline.json Updates pipeline component fields and nullable types.
docs/​docs/​schema/​defaults.json Updates defaults definitions for the revised hierarchy.

Review effort: Balanced


The attributes correspond to keys and values that are used as values for the streams-bootstrap Helm chart.

:param kafka: consumer-app kafka section

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should only be in ConsumerAppValues right?
also maybe remove the :param: lines in ConsumerAppValues for attributes defined in BaseConsumerAppValues

@tobbber tobbber left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good overall!

This branch has not been deployed

No deployments
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.

3 participants