Repository navigation
fix: hygiene extras crashes on Python 3.10 (no tomllib) - #582
Merged
Merged
Conversation
…t one (#581) hygiene.sh ran _hygiene_extras.py with the bare python3, which is 3.10 on the WSL laptop, so the extras mode died with ModuleNotFoundError: tomllib and the default scan printed a traceback. Run it on the newest of python3.13/3.12/3.11, fall back to tomli, and with neither report the scan as skipped (advisory / error row) instead of crashing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
On the WSL laptop,
pyauto-brain hygieneprinted aModuleNotFoundError: No module named 'tomllib'traceback, andhygiene extrasnever scanned.hygiene.shran_hygiene_extras.pywith the barepython3, which is 3.10 there, andtomllibneeds Python 3.11 or later. Brain CI runs 3.12 and 3.13, so it never saw this.hygiene.sh: picksTOML_PY, the first ofpython3.13,python3.12orpython3.11found onPATH, falling back topython3. It usesTOML_PYat all three extras call sites.helper_rowtakes an optional interpreter argument; every other mode is unchanged._hygiene_extras.py: triestomllib, thentomli. With neither available, it reports the scan as skipped instead of crashing:errorstatus with a null count;--summaryprints-1|skipped: …, which renders as "advisory", never "clean".Closes #581.
Tests
tests/test_hygiene_extras_toml_fallback.pyblockstomllibandtomli. It asserts the JSON row haserrorstatus and a null count, the summary count is-1, and there is no traceback. It also checks thathygiene.shroutes extras through$TOML_PY. Control check: all 3 tests fail against the old code.pytest tests/test_hygiene_*.pygives 86 passed.repos_sync.py --check --only "tenant firewall (organ code)"): OK.pyauto-brain hygiene extrasnow scans and reports no exposure drift. Underpython3.10, the helper prints the skipped row.🤖 Generated with Claude Code