Repository navigation
secrets env: retry a failed bws read, and show bws's whole error - #94
Merged
Merged
Conversation
A Bitwarden read failed transiently in about one CI run in four in LytronHQ/nabz-internal; each rerun minutes later passed. The reason was never visible: bws prints "Error:" on its first line and the cause on the next ones, and action_env kept only head -1. - --attempts <n> (default 3) and --retry-wait <seconds> (default 3, doubled before each later try) retry a failed read. - The final error carries bws's whole output on one line, capped. - fake-bws can fail its next N calls with a multi-line error like the real one; tests cover a transient failure recovering, a lasting one stopping after exactly --attempts tries with the reason shown, and bad values for both flags. Mutation-tested: head -1 and a single try both fail the suite. Closes #93
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.
Closes #93.
What changed and why
In LytronHQ/nabz-internal, 3 of about 12 CI runs that read Bitwarden failed on the first attempt with
bws could not read project … : Error:, and each rerun minutes later passed. The reason was hidden:bwsprintsError:on its first line and the cause on the following ones, andaction_envkept onlyhead -1.--attempts <n>(default 3) and--retry-wait <seconds>(default 3, doubled before each later try): a failed read is retried, and each retry is reported on stderr.fake-bwscan fail its next N calls with a multi-line error shaped like the real one (Error:/ blank /0: Received error message from server: [429 …]).How it was verified
bash secrets/tests/secrets_test.sh→PASS. New checks: two transient failures then success succeeds, after exactly 2 failed tries, and the retry is reported. A lasting failure stops after exactly 3 tries (--attemptsdefault) and after 2 with--attempts 2, and the message contains429 Too Many Requestsfrom bws's third line. Bad values for both flags are refused.head -1:FAIL: … expected '429 Too Many Requests'. A single try:FAIL: two transient failures then success should succeed../run-tests→all 10 passed, 3 skipped(the skips are Windows-only and the disposable-machine harden test).Not verified
429in the fake is an assumption about its shape) will show in the first real failure's message.