Skip to content

feat(example): per-queue extension wiring; retire buildrunner/noop#193

Merged
behinddwalls merged 1 commit into
mainfrom
preetam/mock-ext
Jun 5, 2026
Merged

feat(example): per-queue extension wiring; retire buildrunner/noop#193
behinddwalls merged 1 commit into
mainfrom
preetam/mock-ext

Conversation

@behinddwalls
Copy link
Copy Markdown
Collaborator

@behinddwalls behinddwalls commented Jun 4, 2026

Summary

Why?

Demonstrate SubmitQueue's core premise — per-queue pluggable extensions —
in the example orchestrator, rather than wiring one implementation for
every queue, and make the fakes drivable end-to-end. Also document where
factory implementations and queue routing belong.

Stacked on the fakes PR, which adds the extension/*/fake packages this PR
wires in.

What?

  • Queue-major registry in example main.go: queueExtensions (one queue's
    full impl set) + queueRegistry (queue -> profile, with a default). Six
    thin Factory adapters resolve impls by Config.QueueName — all routing
    lives here in the wiring layer.
  • Per-queue profiles: test-queue (heuristic over lines changed),
    e2e-test-queue (composite scorer, no-conflict), plus a new
    e2e-conflict-error-queue that always fails conflict analysis. Edge
    integrations + build runner share a baseline; scorer/analyzer are wrapped
    by the decorator fakes (score-error marker / failing predicate).
  • Retire buildrunner/noop (subsumed by buildrunner/fake); switch the build
    controller unit test to buildfake.
  • queues.yaml: register e2e-conflict-error-queue.
  • CLAUDE.md: extensions hold contracts + impls only — factory
    implementations and routing live in the wiring layer; plus a TODO to
    evaluate promoting the registry into submitqueue/core later.

Test Plan

  • make test — 44/44 unit tests
  • make e2e-test — 1/1
  • make integration-test — 7/7
  • make check-gazelle / make check-tidy — clean
  • ✅ Live stack (make local-submitqueue-start): Ping OK; gateway rejects
    unknown queues; validated end-to-end — scorer passthrough (test-queue),
    scorer error (?sq-fake=score-error -> "fake: marked score error"), and
    conflict error (e2e-conflict-error-queue -> "fake: injected analyze
    error").

Issues

Stack

  1. feat(extensions): fake implementations with error injection #197
  2. @ feat(example): per-queue extension wiring; retire buildrunner/noop #193
  3. refactor(conflict): take a batch of changes as analyzer input #202

Comment thread submitqueue/extension/buildrunner/fake/fake.go
Comment thread submitqueue/extension/buildrunner/fake/fake.go
@behinddwalls behinddwalls force-pushed the preetam/mock-ext branch 2 times, most recently from 7c72f1e to 603dcc4 Compare June 4, 2026 20:16
@behinddwalls behinddwalls changed the base branch from main to scorer June 4, 2026 20:17
@behinddwalls behinddwalls changed the base branch from scorer to main June 4, 2026 20:32
@behinddwalls behinddwalls changed the base branch from main to preetam/mock-ext-fakes June 4, 2026 20:32
@behinddwalls behinddwalls changed the title feat: per-queue extension fakes with error injection in example feat(example): per-queue extension wiring; retire buildrunner/noop Jun 4, 2026
@behinddwalls behinddwalls marked this pull request as ready for review June 4, 2026 21:38
@behinddwalls behinddwalls requested review from a team and sbalabanov as code owners June 4, 2026 21:38
@behinddwalls behinddwalls force-pushed the preetam/mock-ext-fakes branch from 3471964 to d292387 Compare June 4, 2026 22:37
@behinddwalls behinddwalls changed the base branch from preetam/mock-ext-fakes to main June 5, 2026 02:20
@behinddwalls behinddwalls changed the base branch from main to preetam/mock-ext-fakes June 5, 2026 02:22
@behinddwalls behinddwalls force-pushed the preetam/mock-ext-fakes branch 2 times, most recently from 348a546 to dd07845 Compare June 5, 2026 03:35
@behinddwalls behinddwalls force-pushed the preetam/mock-ext-fakes branch from dd07845 to 7b45cdb Compare June 5, 2026 03:45
@behinddwalls behinddwalls force-pushed the preetam/mock-ext-fakes branch from 7b45cdb to b2171aa Compare June 5, 2026 04:44
@behinddwalls behinddwalls force-pushed the preetam/mock-ext-fakes branch from b2171aa to 00c50e7 Compare June 5, 2026 05:30
@behinddwalls behinddwalls force-pushed the preetam/mock-ext-fakes branch from 00c50e7 to a4c97e3 Compare June 5, 2026 05:41
behinddwalls added a commit that referenced this pull request Jun 5, 2026
## Summary
### Why?

The scorer took entity.Change (just URIs), so it could not score on real
change size — the example heuristic counted URIs as a placeholder. With
typed change details now persisted on change records, the scorer can
score a
batch on its actual lines/files changed.

### What?

- Add entity.BatchChanges — the normalized, batch-level view of all
changes
  in a batch (BatchID, Queue, []ChangeInfo) with aggregation helpers.
- Scorer.Score now takes entity.BatchChanges; the heuristic ValueFunc
and the
  composite scorer operate over it.
- The score controller resolves each request's change records, flattens
their
  details into BatchChanges, and scores the batch once — replacing the
  per-request multiplicative product over len(URIs).
- Example wiring buckets by total lines changed.

Consumes the typed details persisted by the change-details change.

## Test Plan
- ✅ `make build`, `make test`, `make lint`, `make
check-mocks/gazelle/tidy`
- ✅ `make integration-test`, `make e2e-test` (start -> validate enrich
->
  score normalizes the batch and scores on real change size)

## Issues


## Stack
1. #195
1. @ #196
1. #197
1. #193
1. #202
@behinddwalls behinddwalls force-pushed the preetam/mock-ext-fakes branch from a4c97e3 to 1cb6b1f Compare June 5, 2026 05:56
@behinddwalls behinddwalls force-pushed the preetam/mock-ext-fakes branch from 1cb6b1f to 36a6b69 Compare June 5, 2026 05:58
Comment thread CLAUDE.md
Comment thread example/submitqueue/orchestrator/server/main.go
@behinddwalls behinddwalls force-pushed the preetam/mock-ext-fakes branch from 26cf2d3 to f7b3eba Compare June 5, 2026 20:10
behinddwalls added a commit that referenced this pull request Jun 5, 2026
## Summary
### Why?

Extensions over external systems (changeprovider, buildrunner, pusher,
mergechecker) had no runnable stub to exercise their success — and
especially failure — paths without standing up the real backend
(GitHub/CI/git). scorer and conflict had deterministic stubs (heuristic,
composite, all, none) but no way to inject errors. These fakes let tests
drive both happy and error paths end-to-end from a land request.

### What?

- buildrunner/fake, changeprovider/fake, pusher/fake, mergechecker/fake:
best-case by default; inject failures via an `sq-fake=<token>` marker in
  a change URI (e.g. build-fail, conflict, unmergeable, provider-error).
- scorer/fake, conflict/fake: decorators that wrap an existing impl (the
  "pick") and overlay error injection — scorer via the URI marker
(score-error) over entity.BatchChanges, analyzer via a predicate, since
  Analyze sees batches, not change URIs.
- Each fake exposes only New(...) (decorator constructors for scorer/
conflict). No factory implementations live in extension/* — those belong
  in the wiring layer.
- pusher/README.md documents the fake.

These packages are test/example stubs, never production. They are wired
into the example orchestrator in a follow-up PR.

## Test Plan
- ✅ `make test` — fake package tests
- ✅ `bazel build //...`

## Issues


## Stack
1. @ #197
1. #193
1. #202
Base automatically changed from preetam/mock-ext-fakes to main June 5, 2026 20:16
Demonstrate SubmitQueue's core premise — per-queue pluggable extensions —
in the example orchestrator, rather than wiring one implementation for
every queue, and make the fakes drivable end-to-end. Also document where
factory implementations and queue routing belong.

Stacked on the fakes PR, which adds the extension/*/fake packages this PR
wires in.

- Queue-major registry in example main.go: queueExtensions (one queue's
  full impl set) + queueRegistry (queue -> profile, with a default). Six
  thin Factory adapters resolve impls by Config.QueueName — all routing
  lives here in the wiring layer.
- Per-queue profiles: test-queue (heuristic over lines changed),
  e2e-test-queue (composite scorer, no-conflict), plus a new
  e2e-conflict-error-queue that always fails conflict analysis. Edge
  integrations + build runner share a baseline; scorer/analyzer are wrapped
  by the decorator fakes (score-error marker / failing predicate).
- Retire buildrunner/noop (subsumed by buildrunner/fake); switch the build
  controller unit test to buildfake.
- queues.yaml: register e2e-conflict-error-queue.
- CLAUDE.md: extensions hold contracts + impls only — factory
  implementations and routing live in the wiring layer; plus a TODO to
  evaluate promoting the registry into submitqueue/core later.

- ✅ `make test` — 44/44 unit tests
- ✅ `make e2e-test` — 1/1
- ✅ `make integration-test` — 7/7
- ✅ `make check-gazelle` / `make check-tidy` — clean
- ✅ Live stack (`make local-submitqueue-start`): Ping OK; gateway rejects
  unknown queues; validated end-to-end — scorer passthrough (test-queue),
  scorer error (`?sq-fake=score-error` -> "fake: marked score error"), and
  conflict error (e2e-conflict-error-queue -> "fake: injected analyze
  error").
@behinddwalls behinddwalls added this pull request to the merge queue Jun 5, 2026
Merged via the queue into main with commit 480d635 Jun 5, 2026
15 checks passed
@behinddwalls behinddwalls deleted the preetam/mock-ext branch June 5, 2026 20:39
@behinddwalls behinddwalls deployed to stack-rebase June 5, 2026 20:39 — with GitHub Actions Active
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