Skip to content

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

Draft
JamyDev wants to merge 1 commit into
mainfrom
jamy/platform-lifecycle
Draft

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

Conversation

@JamyDev

@JamyDev JamyDev 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

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>
@JamyDev JamyDev changed the title feat(platform): add lifecycle.Component and lifecycle.Group feat(orchestrator): rewrite main.go to use pipeline.Construct Jul 20, 2026
@JamyDev JamyDev changed the title feat(orchestrator): rewrite main.go to use pipeline.Construct feat(platform): add lifecycle.Component and lifecycle.Group Jul 21, 2026
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
JamyDev force-pushed the jamy/platform-lifecycle branch from e52af1b to 6a9c542 Compare July 21, 2026 17:59
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