Skip to content

feat(platform): add lifecycle.Component and lifecycle.Group - #402

Merged
JamyDev merged 1 commit into
mainfrom
jamy/platform-lifecycle
Jul 30, 2026
Merged

feat(platform): add lifecycle.Component and lifecycle.Group#402
JamyDev merged 1 commit into
mainfrom
jamy/platform-lifecycle

Conversation

@JamyDev

@JamyDevJamyDev commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Introduces platform/lifecycle package with Component interface (Start/Stop) and Group type
  • Group starts members in order with rollback on partial failure, stops in reverse order joining all errors
  • Nil members are silently skipped; nested Groups compose naturally
  • Pure addition — no existing code changes

Step 1 of the Modular Queue Wiring RFC.

Test plan

  • 9 unit tests covering: happy path start/stop, rollback on failure, first-member failure, joined stop errors during rollback, stop error collection, nil member filtering, empty group, nested groups, nested group rollback
  • bazel test //platform/lifecycle:go_default_test passes
  • make gazelle — BUILD.bazel is in sync
  • make fmt — code formatted

Stack

Test Plan

Net new, Unit Tests added

Issues

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

JamyDev added a commit that referenced this pull request Jul 20, 2026
## 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>
@JamyDevJamyDev changed the title feat(platform): add lifecycle.Component and lifecycle.Groupfeat(orchestrator): rewrite main.go to use pipeline.ConstructJul 20, 2026
@JamyDevJamyDev changed the title feat(orchestrator): rewrite main.go to use pipeline.Constructfeat(platform): add lifecycle.Component and lifecycle.GroupJul 21, 2026
@JamyDev
JamyDevforce-pushed the jamy/platform-lifecycle branch 3 times, most recently from 108f096 to 4b1e4deCompareJuly 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 ownersJuly 24, 2026 17:31
@JamyDev
JamyDevforce-pushed the jamy/platform-lifecycle branch 2 times, most recently from c6f63b9 to 706b856CompareJuly 24, 2026 18:57
JamyDev added a commit that referenced this pull request Jul 24, 2026
## 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>
Comment threadplatform/lifecycle/lifecycle.go
Introduce `platform/lifecycle` with two exports:
- `Component` interface: `Start(ctx) error`, `Stop(ctx) error` —
the one lifecycle abstraction every runnable subsystem implements.
- `Group`: runs an ordered list of Components as one Component.
Start proceeds in order with rollback on partial failure (no
half-started state). Stop proceeds in reverse order, joining all
errors so none is swallowed.
Pure addition — no existing code changes.
Ref: doc/rfc/submitqueue/modular-queue-wiring.md (Step 1)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@JamyDev
JamyDevforce-pushed the jamy/platform-lifecycle branch from 706b856 to 68b051fCompareJuly 30, 2026 05:44
JamyDev added a commit that referenced this pull request Jul 30, 2026
## 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>
@JamyDev
JamyDev added this pull request to the merge queueJul 30, 2026
Merged via the queue into main with commit 541da65Jul 30, 2026
15 checks passed
JamyDev added a commit that referenced this pull request Jul 30, 2026
## 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>
@JamyDev
JamyDev deleted the jamy/platform-lifecycle branch July 30, 2026 06:06
Sign up for freeto 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

@JamyDev@behinddwalls