Skip to content

feat(platform): add pipeline.Construct engine#403

Open
JamyDev wants to merge 2 commits into
jamy/platform-lifecyclefrom
jamy/platform-pipeline
Open

feat(platform): add pipeline.Construct engine#403
JamyDev wants to merge 2 commits into
jamy/platform-lifecyclefrom
jamy/platform-pipeline

Conversation

@JamyDev

@JamyDev JamyDev commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Introduces platform/pipeline with the typed Construct[D] engine
  • Stage[D] struct declares pipeline topology as a typed table (key, name, consumer group, controller constructor, optional DLQ)
  • Engine builds topic registry, creates primary + DLQ consumers, eagerly constructs all controllers, pairs DLQ stages automatically
  • Returns a lifecycle.Component for ordered start/stop
  • Options: TopicNames, Classifiers, PublishOnly, ExtraComponents
  • Pure addition — no existing code changes

Step 2 of the Modular Queue Wiring RFC. Stacked on #402.

Test plan

  • 10 unit tests: single stage, DLQ pairing, multiple stages, empty stages error, controller creation failure, DLQ creation failure, publish-only topics, topic name overrides, resolveTopicName table test, dlqTopicKey, buildTopicConfigs
  • bazel test //platform/pipeline:go_default_test passes
  • make gazelle — BUILD.bazel in sync
  • make fmt — code formatted

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Issues

https://linear.app/uber/issue/CODEM-209/example-figure-out-a-better-structure-for-wiring-up

Stack

@JamyDev
JamyDev force-pushed the jamy/platform-lifecycle branch from e52af1b to 6a9c542 Compare July 21, 2026 17:59
@JamyDev
JamyDev force-pushed the jamy/platform-pipeline branch from b49618c to c37eaea Compare July 21, 2026 17:59
@JamyDev
JamyDev force-pushed the jamy/platform-lifecycle branch from 6a9c542 to 108f096 Compare July 23, 2026 00:28
@JamyDev
JamyDev force-pushed the jamy/platform-pipeline branch from c37eaea to 55b55b4 Compare July 23, 2026 00:28
@JamyDev
JamyDev force-pushed the jamy/platform-lifecycle branch from 108f096 to 4b1e4de Compare July 24, 2026 16:55
@JamyDev
JamyDev force-pushed the jamy/platform-pipeline branch from 55b55b4 to b386d5e Compare July 24, 2026 16:55
@JamyDev
JamyDev marked this pull request as ready for review July 24, 2026 17:31
@JamyDev
JamyDev requested review from a team, behinddwalls and sbalabanov as code owners July 24, 2026 17:31
@JamyDev
JamyDev force-pushed the jamy/platform-pipeline branch from b386d5e to b49618c Compare July 24, 2026 18:09
@JamyDev
JamyDev force-pushed the jamy/platform-lifecycle branch 2 times, most recently from c6f63b9 to 706b856 Compare July 24, 2026 18:57
JamyDev and others added 2 commits July 24, 2026 18:59
## Summary

- Introduces `platform/pipeline` with the typed `Construct[D]` engine
- `Stage[D]` struct declares pipeline topology as a typed table (key, name, consumer group, controller constructor, optional DLQ)
- Engine builds topic registry, creates primary + DLQ consumers, eagerly constructs all controllers, pairs DLQ stages automatically
- Returns a `lifecycle.Component` for ordered start/stop
- Options: `TopicNames`, `Classifiers`, `PublishOnly`, `ExtraComponents`
- Pure addition — no existing code changes

Step 2 of the [Modular Queue Wiring RFC](https://github.com/uber/submitqueue/blob/main/doc/rfc/submitqueue/modular-queue-wiring.md). Stacked on #402.

## Test plan

- [x] 10 unit tests: single stage, DLQ pairing, multiple stages, empty stages error, controller creation failure, DLQ creation failure, publish-only topics, topic name overrides, resolveTopicName table test, dlqTopicKey, buildTopicConfigs
- [x] `bazel test //platform/pipeline:go_default_test` passes
- [x] `make gazelle` — BUILD.bazel in sync
- [x] `make fmt` — code formatted

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pass engine-produced values (TopicRegistry, TopicKey, ConsumerGroup)
to Stage.New and Stage.DLQ via StageContext. Controllers need the
registry for publishing to downstream stages and the topic key/group
for their own identity — these are engine-owned, not host-provided
Deps.

DLQ StageContext automatically derives the DLQ topic key (appending
"_dlq") and consumer group (appending "-dlq") from the primary
stage's values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Name string

// ConsumerGroup is the consumer group suffix for this stage's subscription
// (e.g. "orchestrator-start").

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

i would just say "orchestrator", and mostly one consumer group name for all topics in the service unless we splict the instances by each stage...which is possible but not needed as such, so example could be just orchestrator

return nil, fmt.Errorf("pipeline: stage %s: failed to register controller: %w", s.Key, err)
}

if s.DLQ != nil {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

maybe it's always needed? every queue bydefault gets DLQ out of the box, so not processing it just keeps accumulating messages in there

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