refactor: consistent config flags for transport implementations - #378
Conversation
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors backend/transport configuration around a single --transport selection plus a single JSON transport config provided via --transport-config or --transport-config-file, while preserving legacy per-backend flags via a compatibility shim.
Changes:
- Introduces transport-scoped CLI flags and config resolution (
--transport,--transport-config,--transport-config-file) and updates runner flow selection to load typed transport configs. - Adds a backwards-compat translation layer that keeps legacy flags working while emitting deprecation warnings.
- Updates Redis/PubSub flow constructors and tests to accept parsed transport config structs instead of per-backend flag option structs, and documents the new config surface.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/integration/redisimpl_test.go | Updates integration tests to construct flows via new typed Redis transport config structs. |
| README.md | Documents the new transport config JSON surface and marks legacy flags as deprecated. |
| pkg/server/runner.go | Switches flow selection to --transport + transport config loaders; adds deprecated-flag warnings. |
| pkg/server/options.go | Adds TransportOptions, new flags, and resolver helpers for new-vs-legacy precedence. |
| pkg/server/config.go | Adds helper to load transport config bytes from inline JSON or file. |
| pkg/server/compat.go | Implements legacy-flag deprecation warnings and translation into transport config JSON. |
| pkg/server/compat_test.go | Adds tests for translation, precedence, gated-alias normalization, and deprecation warnings. |
| pkg/redis/sortedset_impl.go | Refactors sorted-set flow constructor to accept SortedSetConfig and per-queue config entries. |
| pkg/redis/sortedset_impl_test.go | Ports sorted-set tests to the new config-driven constructors and validation paths. |
| pkg/redis/redisimpl.go | Refactors Redis pub/sub flow constructor to accept PubSubConfig and queue config entries. |
| pkg/redis/redisimpl_test.go | Ports Redis pub/sub tests to the new config-driven constructors. |
| pkg/redis/options.go | Adds JSON transport config structs/loaders/defaults/validation for Redis transports; retains legacy flag structs. |
| pkg/pubsub/pubsubimpl.go | Refactors Pub/Sub flow constructor to accept parsed pubsub.Config and workerPools/gateFactory args. |
| pkg/pubsub/pubsubimpl_test.go | Ports Pub/Sub tests to the new config-driven constructor. |
| pkg/pubsub/options.go | Adds JSON transport config struct/loader/defaults/validation for gcp-pubsub transport. |
Comments suppressed due to low confidence (1)
pkg/redis/options.go:131
- SortedSetConfig.Validate currently doesn't enforce
urland allows negative/zeropoll_interval_msandbatch_sizeif explicitly provided. These values feed directly into durations and loop bounds in the sorted-set flow and can result in stalled polling or other unintended behavior. Tighten validation to reject missing URL and non-positive poll interval / batch size.
func (c *SortedSetConfig) Validate() error {
if len(c.Queues) == 0 {
return fmt.Errorf("at least one queue must be configured")
}
seenID := make(map[string]bool, len(c.Queues))
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
|
Nice refactor — the compat shim is thorough, tests carried over 1:1 rather than dropped, and adding Two things I'd want addressed before merge, both on the legacy path: 1. synthesized JSON: {"url":"redis://from-flag:6379", ...} The chart is unaffected today (it injects 2. Legacy Missing release-note fragment. The body has a non- Chart follow-up (not blocking). Nits:
|
IIRC the time frame usually is +2 releases 🤔 |
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
yes let's create an issue for that EDIT: PR #388 |
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
fac5bad to
72a6dea
Compare
What does this PR do?
Reorganizes backend/transport configuration around a single transport abstraction: each backend is now selected with
--transportand configured from one JSON document supplied via--transport-config(inline) or--transport-config-file(file). This replaces the previous sprawl of per-backend CLI flags (--redis.*,--redis.ss.*,--pubsub.*,--message-queue-impl).Key changes:
--transport—redis-pubsub|redis-sortedset|gcp-pubsub(defaultredis-pubsub).--transport-config/--transport-config-file— inline or file JSON, mutually exclusive, one required when using the new path.redis.LoadPubSubConfig,redis.LoadSortedSetConfig,pubsub.LoadConfig(each withApplyDefaults/Validate/env overrides), and expose new constructor signatures:NewRedisMQFlow(cfg, workerPools)NewRedisSortedSetFlow(cfg, workerPools, gateFactory)NewGCPPubSubMQFlow(cfg, workerPools, gateFactory)runner.go'sloadFlowselects by transport type and passes config bytes.pkg/server/compat.go)logrdeprecation warning names the replacement when one is used.synthesizeTransportConfig), including single-queue fallback and--redis-tracing→enable_tracing.gcp-pubsub-gatedimplementation is accepted via--message-queue-impland normalized togcp-pubsubwith per-topicgate_type.--request-merge-policy-config-file(matching--transport-config-file); the older--request-merge-policy-configis kept as a deprecated alias. Precedence resolved byOptions.mergePolicyConfigFile().README.md: new Transport Configuration section with per-backend JSON schemas; per-backend flag sections marked deprecated with alias→field mappings; merge-policy and redis-tracing references updated.Preserved from main (not regressed): module path
github.com/llm-d/llm-d-async; Valkey support; EPP budget cascade / gate factory; plugin-based merge policy; redis tracing; backlog polling; and all newer sorted-set/pubsub runtime behavior (cancellation, retry-reservation release #311, gate-closed accounting #368,GateOwnerstamping #369, structured results, pubsub health probing). Only the config/constructor surface was swapped; runtime logic is main's.Why is this change needed?
The per-backend flag surface had grown large and duplicative, with many mutually-exclusive flags per backend. A single JSON config per transport is easier to document, template in Helm, and extend, and it unifies single-queue and multi-queue configuration. All previous flags are retained and still work, so existing deployments keep functioning while migrating.
How was this tested?
Details:
make buildandmake testpass across all modules (root,api/,pipeline/,producer/);go fmt/go vetclean.pkg/server/compat_test.gocovering config synthesis, new-vs-legacy precedence, gated-alias normalization, deprecation warnings, and the merge-policy resolver.go vet -tags integration ./test/integration/compiles.--helpshows both surfaces; validation paths verified for new-path (--transport-configrequired), legacy-path (--pubsub.project-idrequired), and invalid--transport.Checklist
git commit -s) per DCOmake test)make lint)Related Issues
Follow up to #283, #287, #295
Related #284
Release note