Repository navigation
fix(server): make CLI slice flags override environment - #2626
paul-nicolas wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Shipfox review
No issues found across 6 files. This pull request looks good to go.
The change wraps slice flag values on the production service.Execute command so a first CLI occurrence can replace environment-bound values, then switches main to use that command. The replacement detection is text-based and fails for string-slice environment values containing whitespace.
Reviewed 082cc6c89a009044d878e52b80fb6a0edd3add52...d24fef4f1339c3afa0773be393fa8da314662e03.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Strix Security Review✅ No open security findings. PR summary: Wraps slice flags on the ledger server root command so an explicit CLI value (such as --auth-issuers or the Raft transport queue flags) replaces an environment-provided slice instead of being appended to it, adds a subprocess regression test, and documents the precedence rule. Review summaryReviewed the new Ruled out (4)
Review 1 on this PR · Reviewed by Strix |
NumaryBot
left a comment
There was a problem hiding this comment.
The required automated review completed with no remaining findings.
gfyrag
left a comment
There was a problem hiding this comment.
@paul-nicolas, please move this slice flag precedence fix into go-libs' service.Execute environment binder. The shared binder calls FlagSet.Set before Cobra parses CLI arguments, so pflag appends CLI slice values to values already supplied by the environment. The wrapper in cmd/server/server.go handles only Ledger's stringSlice and intSlice flags and duplicates the binder's environment-name and normalization rules. Please fix the precedence at the source in go-libs, cover environment-only, first CLI override, and repeated CLI occurrences there, then update Ledger to that release and remove the local wrapper. This will make the same precedence rule apply consistently to other services and slice types.
flemzord
left a comment
There was a problem hiding this comment.
Reviewed d24fef4f1339c3afa0773be393fa8da314662e03 against the pinned go-libs/v5 v5.10.0 binder. The wrapper matches its environment-name and string-slice normalization rules, and nix develop --command go test -race ./cmd/server -run '^TestSliceFlagPrecedenceThroughServiceExecute$' -count=1 passed on this head.
Approval remains withheld while the existing maintainer request to implement precedence in the shared service.Execute binder is outstanding. No additional confirmed correctness finding or duplicate inline comment.
What changed
service.Execute.Why
An explicit
--auth-issuerscurrently retains issuers supplied only byAUTH_ISSUERS; valid three-entry CLI Raft queues are appended to three-entry environment queues and rejected at startup. Ticket.Product / operational motivation
Need: operators can narrow trusted issuers and override Raft queue configuration explicitly. Current limitation: early environment binding makes pflag append the first CLI slice. Requirement: explicit CLI slice values take precedence over environment values, while repeated CLI occurrences append. Evidence: the ticket,
docs/ops/deployment.md, and the subprocess regression. Durable repository evidence:docs/ops/deployment.mdand the configuration startup audit contract.Technical decision
Decision: wrap slice flag values only on the production
service.Executecommand, replacing an environment-sourced first value when Cobra sets the first CLI occurrence. Why proportionate: it preserves the pinned go-libs binder and pflag behavior, including repeated CLI values. Alternatives: changing go-libs would require a separate dependency release; leaving current behavior violates the documented precedence and can trust unwanted issuers.Risk
LOW — startup configuration only; no persisted state, Raft apply, or API wire change.
Validation
bash scripts/agent-checknix develop --command bash scripts/agent-just pre-commitgo test -race ./cmd/serverfor the subprocess regression and adjacent environment testsgo test ./internal/bootstrapissuer testsArchitecture / behavior impact
Server startup configuration precedence is now consistent for scalar and slice flags. No persisted-state, FSM, Raft protocol, or API wire change.
Review focus
Check
NewServiceRootCommandand the first CLI occurrence behavior against the pinned go-libs binder and pflag slice semantics.Known concerns
None.