Repository navigation
feat(server)!: select divergence storage with one URL flag - #75
Conversation
Choosing a backend took two flags, and the Redis URL flag meant nothing unless the other one said redis. A single storage URL names the backend by its scheme and carries its settings, so adding a backend no longer needs a new flag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
df3ed56 to
41f7008
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 41f7008a36
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ) | ||
| // constructors maps each URL scheme to its backend. Backends write it only from | ||
| // init, so reading it needs no lock. | ||
| var constructors = map[string]Constructor{} //nolint:gochecknoglobals // Backends register themselves. |
There was a problem hiding this comment.
Keep the backend registry out of package-global state
The new constructors map introduces mutable global state in a domain package, and the backend init() functions populate it implicitly on import. This violates the root AGENTS.md architecture requirements that prohibit global state outside main entry points and place initialization/bootstrap in Main; suppressing gochecknoglobals does not satisfy those requirements. Construct and register the backends explicitly during bootstrap and pass the registry to storage, or use stateless dispatch for the built-in schemes.
AGENTS.md reference: AGENTS.md:L5-L10
Useful? React with 👍 / 👎.
The SPECTRE server could store divergences only in a single Redis server. This adds support for a Redis Cluster. - `--storage` selects cluster mode with the `redis-cluster://` and `rediss-cluster://` schemes. Further seed nodes go in `addr` query parameters, such as `redis-cluster://localhost:7000?addr=localhost:7001`. go-redis parses single-node and cluster URLs with the same `redis` and `rediss` schemes, so a separate scheme is needed to choose between them. - A cluster client cannot talk to a standalone Redis server, so plain `redis://` URLs keep using the single-node client. - The store holds a go-redis `UniversalClient`, which both clients satisfy. Every command touches the one divergences key, which lives in a single slot, so `WATCH` transactions work unchanged in a cluster. - A cluster URL with a database path is rejected, because go-redis would otherwise ignore the path and silently use database 0. The tests run the shared store tests and `Open` against a cluster client. They use miniredis, which acts as a one-node cluster owning every slot. As a result, redirects between nodes are not exercised. This is stacked on #75. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Picking a divergence backend took two flags,
--storageand--redis-url, and the Redis URL meant nothing unless the other flag saidredis. Every new backend would have needed another flag of its own.spectre servenow takes a single--storageURL whose scheme picks the backend:memory://(the default) orredis:///rediss://. Each backend registers a constructor for its schemes in a small registry in the storage package, and an unknown scheme is rejected when the command line is parsed.This is a breaking change:
--redis-urlis gone, so--storage=redis --redis-url=redis://host:6379/0becomes--storage=redis://host:6379/0.🤖 Generated with Claude Code