test(desktop): make passphrase word-count test deterministic - #6358
Open
SomSamantray wants to merge 3 commits into
Open
test(desktop): make passphrase word-count test deterministic#6358SomSamantray wants to merge 3 commits into
SomSamantray wants to merge 3 commits into
Conversation
The EFF short wordlist 2.0 contains the hyphenated word `yo-yo`. The `generated_passphrase_respects_word_count_and_separator` test joined three words with `-` and asserted that splitting on `-` yields exactly three parts; drawing `yo-yo` produced four parts and failed ~1 in 186 runs. Replace the naive split with a word-aware helper that reconstructs hyphenated wordlist words, and add a deterministic fixture (`yo-yo-aardvark-fanfare`) that exercises the hyphenated case on every run, independent of the OS entropy draw. Co-authored-by: CommandCodeBot <noreply@commandcode.ai> Signed-off-by: Som Samantray <som.samantray@gmail.com>
Extract the shared wordlist-set builder, use a peekable split iterator instead of an index over a materialized fragment Vec (removing a latent out-of-bounds panic path), drop WHAT-narration comments, and rename the hyphenated-word test to match the helper it exercises. Co-authored-by: CommandCodeBot <noreply@commandcode.ai> Signed-off-by: Som Samantray <som.samantray@gmail.com>
SomSamantray
force-pushed
the
fix/flaky-passphrase-test
branch
from
August 20, 2026 02:22
50d1833 to
2578cb6
Compare
SomSamantray
added a commit
to SomSamantray/buzz
that referenced
this pull request
Aug 20, 2026
Records the plan for adding Signed-off-by trailers to the two commits on PR block#6358 so the DCO Check passes. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Records the plan for adding Signed-off-by trailers to the two commits on PR block#6358 so the DCO Check passes. Co-authored-by: CommandCodeBot <noreply@commandcode.ai> Signed-off-by: Som Samantray <som.samantray@gmail.com>
SomSamantray
force-pushed
the
fix/flaky-passphrase-test
branch
from
August 20, 2026 02:25
89689fa to
a641111
Compare
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.
Summary
The
generated_passphrase_respects_word_count_and_separatortest was flaky: the EFF short wordlist 2.0 contains the hyphenated wordyo-yo, so a--joined passphrase that draws it split into four parts instead of three and failed the assertion roughly 1 in 186 runs.The test now splits passphrases with a word-aware helper that reconstructs hyphenated wordlist words, and a new deterministic fixture (
yo-yo-aardvark-fanfare) exercises theyo-yocase on every run, independent of the OS entropy draw. No production code changes.Related issue
Fixes #6249
Testing
cargo test --manifest-path desktop/src-tauri/Cargo.toml key_backup— all 31 tests pass.cargo clippy --lib --tests— no warnings on the changed code.