Repository navigation
fix(mailbox): read the secret list again before calling a secret missing (0.5.1) - #5
Merged
Merged
Conversation
…ing (0.5.1) For a few seconds after a deploy Cloudflare sometimes answers `wrangler secret list` with an empty list and exit code 0. The tool read the list once, so it reported existing secrets as missing and, at a terminal, would have prompted for them and overwritten them. A secret now counts as present once any of up to three reads shows it, with two seconds between reads. Co-Authored-By: Claude & Lothrop (cycle.five@proton.me)
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.
Root cause
After each deploy the mailbox tool checks, by name, that the Worker has its required secrets, with one
wrangler secret list. For a few seconds after a deploy Cloudflare sometimes answers that command with an empty list and exit code 0. Reproduced on the live account: eight reads one second apart straight after a deploy returned the two secrets seven times and[]once.With one read, the tool reported existing secrets as missing on three of four Workers during a release. The run exited 1 and the follow-on mailroom deploy was blocked, which is the safe direction. At a terminal it would also have prompted for those secrets, and typing them would have overwritten good values.
Fix
A secret now counts as present once any of up to three reads shows it, two seconds apart; it is reported missing only when all three agree. A Worker that does not exist is still decided by the first answer ("not found" is a different reply from an empty list), so the guards that depend on it are unchanged.
statususes the same rule.Patch release 0.5.1: only
packages/mailboxchanges; the Workers get the new version number.Checked
npm run typecheckclean; tests: broker-core 48, mailbox-tool 131, discord-broker 65, github-broker 55.status; a Worker that does not exist is not read again. Stopping after the first read fails seven tests.🤖 Generated with Claude Code
https://claude.ai/code/session_017zqkE8grD6nh1bNnb2r1X8