Skip to content

fix: hygiene extras crashes on Python 3.10 (no tomllib) - #582

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/hygiene-extras-tomllib
Nov 4, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/hygiene-extras-tomllib

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

On the WSL laptop, pyauto-brain hygiene printed a ModuleNotFoundError: No module named 'tomllib' traceback, and hygiene extras never scanned. hygiene.sh ran _hygiene_extras.py with the bare python3, which is 3.10 there, and tomllib needs Python 3.11 or later. Brain CI runs 3.12 and 3.13, so it never saw this.

  • hygiene.sh: picks TOML_PY, the first of python3.13, python3.12 or python3.11 found on PATH, falling back to python3. It uses TOML_PY at all three extras call sites. helper_row takes an optional interpreter argument; every other mode is unchanged.
  • _hygiene_extras.py: tries tomllib, then tomli. With neither available, it reports the scan as skipped instead of crashing:
    • the JSON row uses the existing error status with a null count;
    • --summary prints -1|skipped: …, which renders as "advisory", never "clean".

Closes #581.

Tests

  • tests/test_hygiene_extras_toml_fallback.py blocks tomllib and tomli. It asserts the JSON row has error status and a null count, the summary count is -1, and there is no traceback. It also checks that hygiene.sh routes extras through $TOML_PY. Control check: all 3 tests fail against the old code.
  • pytest tests/test_hygiene_*.py gives 86 passed.
  • Tenant firewall (repos_sync.py --check --only "tenant firewall (organ code)"): OK.
  • Live run on the laptop: pyauto-brain hygiene extras now scans and reports no exposure drift. Under python3.10, the helper prints the skipped row.

🤖 Generated with Claude Code

…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>
@Jammy2211
Jammy2211 merged commit e9192df into main Nov 4, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the feature/hygiene-extras-tomllib branch November 4, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: hygiene extras crashes on Python 3.10 (no tomllib)

1 participant