fix(statewrite): raise the state-write retry ceiling with jittered backoff and convergence markers - #538
Merged
Conversation
…ckoff and convergence markers Bring the Contents-API write path and the emitted shell write loop to parity with the git push-retry hardened earlier. CommitWithRetry goes from five attempts to ten with exponential jittered backoff (base 250ms, doubling, capped at eight seconds) and emits a per-attempt convergence marker plus success and exhaustion lines. The emitted shell state-write loop raises its bound to ten, replaces the fixed random sleep with the same exponential jittered backoff, and echoes the same marker. All three write paths now log one greppable marker so a concurrency proof can assert on convergence and non-exhaustion. State semantics are unchanged; the emitted-output goldens and cascade's own regenerated workflow move only for the retry, backoff, and marker lines. The backoff helper is duplicated in the low-level statewrite package rather than importing the git package to avoid a dependency cycle. Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
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.
What
Brings the Contents-API write path and the emitted shell write loop to parity with the git push-retry hardened in #537, so all three state-write paths retry robustly and emit one greppable convergence marker.
internal/statewrite/apiwrite.goCommitWithRetry: 5 to 10 attempts; fixedN*500msbackoff replaced with exponential jittered backoff (base 250ms, doubling, capped 8s); emitscascade-state-write: attempt=N/10per attempt, plus success and exhaustion lines.internal/generate/state_write.go(emitted shell, both branches): loop bound 5 to 10; fixed random sleep replaced with the same exponential jittered backoff in bash; same marker echoed.State semantics are unchanged. The emitted-output goldens (byte-identical baseline) and cascade's own regenerated
orchestrate.yamlmove only for the retry, backoff, and marker lines (verified by filtered diff). The backoff helper is duplicated in the low-levelstatewritepackage rather than importinginternal/gitto avoid a dependency cycle.Verification
New tests (red-before/green-after):
CommitWithRetrynow attempts up to ten and emits the markers; the emitted shell contains the raised bound and marker. e2e scenarios 08 and 09 strengthened to assert the bound and marker.go build, fullgo test ./...,go test ./... -race,golangci-lintall clean.