Skip to content

feat(queueconfig): add YAML-backed Store and wire gateway Land validation#160

Merged
behinddwalls merged 4 commits into
mainfrom
wua/yaml-queueconfig-and-gateway-validation
May 28, 2026
Merged

feat(queueconfig): add YAML-backed Store and wire gateway Land validation#160
behinddwalls merged 4 commits into
mainfrom
wua/yaml-queueconfig-and-gateway-validation

Conversation

@albertywu
Copy link
Copy Markdown
Contributor

@albertywu albertywu commented May 28, 2026

Summary

Adds the first implementation of queueconfig.Store, backed by a YAML file read once at startup. Wires it into the gateway LandController so unknown queue names are rejected at the API edge with a typed UnrecognizedQueueError that carries the queue name.

Also updated the example/server app to use an example queues.yaml config file, and verified that things work end-to-end (see Test Plan down below).

Test Plan

make test
✅ Ran make local-gateway-start and verified:

  1. can land to a configured queue
> grpcurl -plaintext -d '{"queue":"test-queue","change":{"uris":["github://uber/submitqueue/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"]}}' \
    localhost:59232 uber.submitqueue.gateway.SubmitQueueGateway/Land
{
  "sqid": "test-queue/1"
}
  1. can land again to same configured queue, and see the sqid increment
> grpcurl -plaintext -d '{"queue":"test-queue","change":{"uris":["github://uber/submitqueue/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"]}}' \
    localhost:59232 uber.submitqueue.gateway.SubmitQueueGateway/Land
{
  "sqid": "test-queue/2"
}
  1. when invalid queue name is provided, server responds back with invalid request
> grpcurl -plaintext -d '{"queue":"","change":{"uris":["github://uber/submitqueue/pull/123/c3a4d5e6f7890123456789abcdef0123456789ab"]}}' \
    localhost:59232 uber.submitqueue.gateway.SubmitQueueGateway/Land
ERROR:
  Code: Unknown
  Message: LandController requires the request to have a queue name specified: invalid request

Issues

…tion

Adds the first implementation of queueconfig.Store, backed by a YAML
file read once at startup. Wires it into the gateway LandController so
unknown queue names are rejected at the API edge with a typed
UnrecognizedQueueError that carries the queue name — set up for a
future gRPC interceptor to map it into pb.UnrecognizedQueueError.

- extension/queueconfig/yaml: new Store with NewStore(path), validates
  non-empty + unique names; returns queueconfig.ErrNotFound for misses
- extension/queueconfig/mock: generated mock (new //go:generate
  directive + queueconfig path added to the Makefile mocks target)
- gateway/controller/land.go: validates queue via the store and returns
  *UnrecognizedQueueError wrapped with errs.NewUserError when missing
- example/server/gateway: requires QUEUE_CONFIG_PATH env var; sample
  queues.yaml covers test-queue + e2e-test-queue and is baked into the
  Dockerfile + wired into both compose files

The entity/queue_config.go docstring tweak is from \`make fmt\` and is
included to keep the formatter idempotent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 28, 2026 03:55
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Introduces an initial queueconfig.Store implementation backed by a YAML file loaded at startup, and wires it into the gateway land flow so requests for unknown queues are rejected at the API edge.

Changes:

  • Add extension/queueconfig/yaml Store (YAML snapshot in memory) plus tests and Bazel wiring.
  • Validate LandRequest.Queue against queueconfig.Store in LandController, returning a typed UnrecognizedQueueError wrapped as a user error on misses.
  • Update the example gateway server + container setup to require and provide QUEUE_CONFIG_PATH and a sample queues.yaml.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
MODULE.bazel Adds Bazel module repo for gopkg.in/yaml.v3.
Makefile Includes ./extension/queueconfig/... in mock generation target.
go.mod Promotes gopkg.in/yaml.v3 to a direct dependency.
gateway/controller/land.go Adds queue validation via queueconfig.Store and introduces UnrecognizedQueueError.
gateway/controller/land_test.go Updates constructor usage and adds tests for queue validation behavior.
gateway/controller/BUILD.bazel Adds queueconfig deps for controller lib/tests.
extension/queueconfig/yaml/yaml.go Implements YAML-backed queueconfig store loaded once at startup.
extension/queueconfig/yaml/yaml_test.go Tests YAML store parsing/validation, Get/List behavior, and copy semantics.
extension/queueconfig/yaml/BUILD.bazel Bazel targets for YAML store and tests.
extension/queueconfig/queueconfig.go Adds //go:generate directive for mock generation.
extension/queueconfig/mock/queueconfig_mock.go Adds generated GoMock for queueconfig.Store.
extension/queueconfig/mock/BUILD.bazel Bazel target for the generated mock package.
example/server/gateway/queues.yaml Provides sample queue configuration YAML for the example gateway.
example/server/gateway/main.go Loads queue configs from QUEUE_CONFIG_PATH and injects into LandController.
example/server/gateway/Dockerfile Bakes the sample queues.yaml into the image.
example/server/gateway/docker-compose.yml Sets QUEUE_CONFIG_PATH env var for the example gateway container.
example/server/gateway/BUILD.bazel Adds Bazel dep on the YAML queueconfig store.
example/server/docker-compose.yml Sets QUEUE_CONFIG_PATH env var for the example stack.
entity/queue_config.go Minor docstring wording adjustment for BuildRunner.
Files not reviewed (1)
  • extension/queueconfig/mock/queueconfig_mock.go: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread extension/queueconfig/yaml/yaml.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 28, 2026 04:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • extension/queueconfig/mock/queueconfig_mock.go: Language not supported

Comment thread gateway/controller/land.go Outdated
@albertywu albertywu marked this pull request as ready for review May 28, 2026 16:47
Copilot AI review requested due to automatic review settings May 28, 2026 16:47
@albertywu albertywu requested review from a team, behinddwalls and sbalabanov as code owners May 28, 2026 16:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • extension/queueconfig/mock/queueconfig_mock.go: Language not supported

Comment thread extension/queueconfig/yaml/yaml.go
@behinddwalls behinddwalls enabled auto-merge May 28, 2026 18:12
@behinddwalls behinddwalls added this pull request to the merge queue May 28, 2026
Merged via the queue into main with commit c53d203 May 28, 2026
13 checks passed
@github-actions github-actions Bot deleted the wua/yaml-queueconfig-and-gateway-validation branch May 28, 2026 20:00
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