Phase 3c: producer SDK (internal/client)#8
Merged
Merged
Conversation
Owner
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Third Phase 3 sub-project: a small, self-contained Go HTTP SDK for the Relay API so producers can drive the queue without touching Redis.
cmd/demois refactored to consume it — proving the SDK end-to-end and establishing the real producer topology (producer → HTTP API → broker). No new Go dependency (stdlib only); the atomic claim and at-least-once delivery are untouched.internal/client(new, stdlib only)New(baseURL, ...Option)withWithHTTPClient/WithTimeout(default ~10s).Enqueue(ctx, queue, payload, ...EnqueueOption)—WithDelay/WithPriority/WithIdempotencyKey;409 → ErrDuplicate. Priority is a*intsoWithPriority(0)sendspriority:0while an unset priority is omitted (mirrors the API).Stats,ListDLQ,Requeue(404 → ErrNotFound),Queues.ErrDuplicate/ErrNotFound;*APIError{Status, Message}from the{"error":…}envelope for other non-2xx. A shareddohelper handles marshalling, status mapping, and%wwrapping.broker/job/Redis import — a producer importing the SDK doesn't drag in the queue internals.cmd/demo(refactor)Now a pure SDK consumer:
-server http://localhost:8080replaces-redis; itclient.New(...)+Enqueues, treatingErrDuplicateas benign. (It now needscmd/serverrunning.)Design & plan
docs/superpowers/specs/2026-06-09-relay-phase3c-producer-sdk-design.mddocs/superpowers/plans/2026-06-09-relay-phase3c-producer-sdk.mdTest plan
go build ./...,go vet ./...,gofmt -l internal/ cmd/cleango test -race ./...— all packages pass against a real Redis (client tests on DB 11; broker 15 / worker 14 / metrics 13 / api 12 / client 11 — parallel-safe)httptestunit tests: request method/path/body, response decode, and error mapping (409→ErrDuplicate, 404→ErrNotFound, 500→APIError); priority-0-sent vs unset-omittedclient → api.New(real broker) → Redisproves the client DTOs match the live server JSON (no field drift)internal/clientconfirmed stdlib-only (go list -depsshows no broker/job/go-redis);go.modunchangedcmd/demosmoke-tested end-to-end against a running server