Commit f8c5d7b
authored
feat(frost/signing): RFC-21 Phase 5.3 -- readiness-gate env-var guard (#3979)
## Summary
**Closes Phase 5 of RFC-21.** Adds the explicit-operator-opt-in
gate that protects production builds with the
\`frost_roast_retry\` tag from entering the orchestration path
without an explicit operator decision.
Production builds with the build tag enabled now refuse to wire
orchestration unless the operator sets
\`KEEP_CORE_FROST_ROAST_RETRY_ENABLED=true\`. The pattern matches
the existing
\`KEEP_CORE_FROST_TBTC_SIGNER_ACCEPT_SCAFFOLD_KEY_GROUP\` env var
from PR #3960: a build tag enables the code path, an env var
enables the wiring, both must agree for the feature to be live.
Stacked on #3978 (Phase 5.2).
## What lands
### New file: \`pkg/frost/signing/roast_retry_readiness.go\` (untagged)
| Surface | Notes |
|---|---|
| \`RoastRetryReadinessOptInEnvVar\` constant |
\`KEEP_CORE_FROST_ROAST_RETRY_ENABLED\` |
| \`ErrRoastRetryReadinessOptOut\` sentinel | for \`errors.Is\`
detection |
| \`EnsureRoastRetryReadinessOptIn() error\` | returns nil if env var is
\`"true"\` (case-insensitive, whitespace-trimmed); error otherwise |
| \`RoastRetryReadinessOptInEnabled() bool\` | boolean helper |
| Per-call (not cached) | operators can flip without restart |
### \`roast_retry_orchestration.go\` extended
\`BeginOrchestrationForSession\` now calls
\`EnsureRoastRetryReadinessOptIn\` **before** consulting the
registry. The env var is the load-bearing gate; missing opt-in
short-circuits orchestration even when the registry has a real
coordinator.
## Why per-call rather than init-time
The scaffold-opt-in env var from PR #3960 is also evaluated per
call. Operators can flip it during a debugging session without
restart. Same reasoning here -- the readiness env var is a kill
switch, not a build constant.
## Test coverage
| File | Cases |
|---|---|
| \`roast_retry_readiness_test.go\` (untagged, 7 cases) | accepts
\`"true"\`; case-insensitive; whitespace-trimmed; rejects unset (with
sentinel + env-var-name in error); rejects other values; bool helper
mirrors error; **env var name matches RFC-21 spec (locks the name)** |
| \`roast_retry_orchestration_frost_roast_retry_test.go\` (extended) |
New \`TestBeginOrchestrationForSession_ErrorsWhenReadinessOptInUnset\`
-- asserts a registered coordinator alone is not enough; missing env var
still short-circuits orchestration |
## Verification
| Command | Result |
|---|---|
| \`go build ./...\` | clean |
| \`go test ./pkg/frost/signing/...\` | pass (default build) |
| \`go test -tags 'frost_roast_retry' ./pkg/frost/signing/...\` | pass |
| \`go test -race -tags 'frost_native frost_tbtc_signer
frost_roast_retry' ./pkg/frost/...\` | pass (5 packages) |
| \`staticcheck -checks '-SA1019' ./pkg/frost/...\` | silent |
| \`go vet ./pkg/frost/...\` | clean |
| \`gofmt -l ./pkg/frost/signing/\` | silent |
## Phase 5 complete
| PR | Scope | State |
|---|---|---|
| 5.1 (#3977) | Retry adapter scaffolding | open |
| 5.2 (#3978) | Orchestration helpers + TTL sweep | open |
| **5.3 (this)** | **Readiness-gate env-var guard** | **open** |
Phase 6 will wire the production call sites and migrate the three
FROST/tbtc-signer receive loops onto the adapter in a single
coordinated change.
## Test plan
- [ ] CI green.
- [ ] Reviewer confirms the case-insensitive / whitespace-trimmed
parsing is acceptable. (Alternatives: strict \`"true"\` only.)
- [ ] Reviewer confirms the per-call evaluation is acceptable.
(Alternatives: read once at init.)4 files changed
Lines changed: 182 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
31 | 37 | | |
32 | 38 | | |
33 | 39 | | |
| |||
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| 81 | + | |
| 82 | + | |
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
| |||
85 | 89 | | |
86 | 90 | | |
87 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
88 | 119 | | |
| 120 | + | |
89 | 121 | | |
90 | 122 | | |
91 | 123 | | |
| |||
108 | 140 | | |
109 | 141 | | |
110 | 142 | | |
| 143 | + | |
111 | 144 | | |
112 | 145 | | |
113 | 146 | | |
| |||
213 | 246 | | |
214 | 247 | | |
215 | 248 | | |
| 249 | + | |
216 | 250 | | |
217 | 251 | | |
218 | 252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
0 commit comments