Repository navigation
test(gem4gov-cli): accept an all-digit suffix in the generate_id test - #362
Merged
aghassemlouei merged 1 commit intoOct 26, 2026
Merged
Conversation
generate_id picks six characters from lowercase letters and digits, but the test asserted suffix.islower(), which Python returns False for when the suffix has no letters. About one run in 2,200 drew six digits and failed CI on an unrelated pull request. - Check the suffix characters against the generate_id alphabet. - Add a deterministic test that forces an all-digit suffix.
9 of 19 tasks
aghassemlouei
left a comment
Member
There was a problem hiding this comment.
Verified tests/test_data_stores.py via bash tools/run_tests.sh and bash tools/lint.sh:
- Replacing
suffix.isalnum()andsuffix.islower()withself.assertLessEqual(set(suffix), set(string.ascii_lowercase + string.digits))removes the1 / 2,176flake whensecrets.choiceproduces an all-digit 6-character suffix. test_generate_id_allows_an_all_digit_suffixdeterministically covers the all-digit suffix path.
aghassemlouei
enabled auto-merge (squash)
October 26, 2026 21:13
aghassemlouei
approved these changes
Oct 26, 2026
Merged
This was referenced Oct 26, 2026
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.
Description
Stop the
test_generate_id_formattest in thetests/test_data_stores.pyfile from failing at random on unrelated pull requests.The
generate_idfunction in theblueprints/gemini-enterprise/gem4gov-cli/data_stores.pyfile picks six characters from lowercase letters and digits. The test assertedsuffix.islower(), but Python'sstr.islower()method returnsFalsefor a string without letters, such as"482193".generate_iduses.test_generate_id_allows_an_all_digit_suffixtest forces an all-digit suffix through a patchedsecrets.choicefunction, so the case runs on every build.No GitHub issue exists for this change.
Type of Change
Deployment & Compliance Impact
Checklist
Code Quality & Reusability
modules/orfast/stages-aw/can be leveraged for this change.docs/naming-convention.md.Documentation
README.mdof the modified module or blueprint.Security
Testing
Testing Performed
test_generate_id_formatwithAssertionError: False is not trueat thesuffix.islower()assertion.secrets.choicepatched to return a digit,generate_idreturnsds-777777, and the old assertion rejects that value.uv run --locked pytestin the repository root passes 109 tests, including the new test.ruff format --checkandruff checkpass for the test file.