test(session): accept digit-only hex rule ids - #202
Merged
Merged
Conversation
Python str.islower() is false for all-digit strings, so a token_hex(6) id such as 225823821909 failed the Windows blocking suite. AI-Generated: true Generated-At: 2026-09-15T19:01:12Z
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
Windows blocking pytest failed on master because
secrets.token_hex(6)can emit a 12-character all-digit hex id.str.islower()is false for strings with no cased characters, soassert watch.rule_id.islower()rejected a valid id such as225823821909. The assertion now matches the existing lowercase-hex check, and a regression insert pins that all-digit id.Related issue
Related: master CI
Run blocking pytest suite (windows-latest)on35be83b28(https://github.com/Xero-Team/AstrBot/actions/runs/34996351692/job/104485180566)Surfaces
tests/unit/db/test_session_bridge_store.pyImplementation notes
Keep allocated rule ids as lowercase hex from
token_hex(6). Do not force a letter into the id; the product contract already allows all-digit hex. Align the store test withtests/unit/test_session_bridge.py, which already usesrule_id == rule_id.lower().Validation
make checkand the full blocking suite were not run. This change is test-only.Compatibility and risk
None for product behavior. Residual risk is another Windows-only flake elsewhere; this PR only covers the failed
rule_id.islower()assertion.Checklist
chore,build,ops, ortest(notci).pyproject.toml,requirements.txt, anduv.locktogether.Agent note
Goal: restore the Windows blocking suite after master commit
35be83b28failedtest_insert_session_bridge_rule_writes_s1_defaults. Path touched:tests/unit/db/test_session_bridge_store.py. Checks run locally: Ruff format/check on that file, focused pytest (7 passed). I did not pushmaster; this PR is the CI trigger. Merge still needs a human maintainer review plus a separate AI-assisted review.