Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ptr727/ProjectTemplate
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.0.583
Choose a base ref
...
head repository: ptr727/ProjectTemplate
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2.0.584
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Sep 7, 2026

  1. Hold build_dist's Lazily Imported Audit Module Rather Than Reaching f…

    …or It Per Line (#1430)
    
    Closes #1424.
    
    `scripts/build_dist.py`'s `_fence_step` calls into `spec/audit.py` once
    per line, and it scanned
    `sys.path` and re-entered `import audit` on every one of them. The
    accessor splits out as a cached
    zero-argument `_audit_module()`, the shape `scripts/carry.py` took for
    the same defect on #1423.
    
    ## Measured
    
    Over the 24 authored skills, 4644 lines across the 40 Markdown files
    they comprise, warm in one
    process, best of five:
    
    | | one pass |
    | --- | --- |
    | re-resolved per line | 17.5 ms |
    | module held | 0.9 ms |
    | calling `audit` directly | 0.7 ms |
    
    One `--check` run makes **18708** of these calls, four times that
    corpus, because it scans the
    authored tree and both generated trees. It runs on every pull request.
    
    ## The part that was nearly a regression
    
    The first draft used `functools.cache`. That is 3.9+, and
    `scripts/skills_install.py` imports this
    module **at module scope**, while `host-setup/linux/install-skills.sh`,
    `host-setup/windows/install-skills.ps1` and `scripts/skills_install.sh`
    each commit to **Python
    3.7+**, because that path runs before the fleet's own toolchain exists
    to install a newer
    interpreter. `spec/host-tools.json`'s `python3` entry records that floor
    and why it sits below the
    fleet's own.
    
    So the draft would have broken `install-skills` at import on a 3.7 or
    3.8 host, on the one path
    whose whole purpose is surviving an old one, and the laziness this
    function already had was there
    for exactly that reason.
    
    Verified by running it rather than by reading a version table, on a real
    CPython 3.8.20:
    
    ```
    this branch      import build_dist: OK    import skills_install: OK    audit imported? False
    functools.cache  import build_dist: BROKE -> module 'functools' has no attribute 'cache'
    ```
    
    `functools.lru_cache(maxsize=None)` is 3.2+ and identical for a
    zero-argument function. Ruff's own
    `py313` target wants to rewrite it back to `functools.cache`, so the
    `noqa: UP033` carries that
    reason inline.
    
    ## Tests
    
    Three, each proven by removing what it guards:
    
    - The module is resolved **once** however many lines are read.
    - Importing this module still does **not** import `audit`, run in a
    fresh interpreter. This is the
    laziness the install path depends on, and it was load-bearing and
    untested before now.
    - The existing `sys.path` case. Holding the module made it **vacuous**:
    the accessor's body then
    runs once per process, so the `not in sys.path` guard could be deleted
    with the whole suite still
    green. It now clears the cache between calls and covers that guard
    again. Caught by the local
      review pass, which mutation-proved it on both sides of the merge base.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    
    <!-- This is an auto-generated comment: release notes by coderabbit.ai
    -->
    
    ## Summary by CodeRabbit
    
    * **Bug Fixes**
    * Improved build checks by reusing audit functionality efficiently
    across repeated validation runs.
    * Preserved compatibility with supported Python versions by loading
    audit functionality only when needed.
    * **Tests**
    * Added coverage for repeated validation calls and fresh-interpreter
    import behavior.
    
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->
    
    ---------
    
    Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
    ptr727 and claude authored Sep 7, 2026
    Configuration menu
    Copy the full SHA
    5ae7cf8 View commit details
    Browse the repository at this point in the history
  2. Promote develop to main: hold build_dist's lazily imported audit modu…

    …le (#1432)
    
    Promote `develop` to `main`. One commit, #1430, which settles #1424.
    
    `scripts/build_dist.py`'s `_fence_step` reached into `spec/audit.py`
    once per line and re-resolved
    the module every time, scanning `sys.path` and re-entering `import
    audit`. The accessor is now a
    cached zero-argument `_audit_module()`, the shape `scripts/carry.py`
    took for the same defect on
    #1423.
    
    Over the 24 authored skills, 4644 lines across the 40 Markdown files
    they comprise, warm in one
    process, best of five: **17.5 ms re-resolved against 0.9 ms held**,
    where calling `audit` directly
    costs 0.7 ms. One `--check` run makes **18708** of these calls, four
    times that corpus, and it runs
    on every pull request.
    
    ## Worth reading before merging
    
    The first draft used `functools.cache`, which is 3.9+.
    `scripts/skills_install.py` imports
    `build_dist` **at module scope**, and three install wrappers commit to
    **Python 3.7+** because that
    path runs before the fleet's own toolchain exists to install a newer
    interpreter. The draft would
    have broken `install-skills` at import on a 3.7 or 3.8 host, and every
    gate passed it, since ruff
    and mypy both target 3.13. Proven on a real CPython 3.8.20 rather than
    argued from a version table,
    and fixed with `lru_cache(maxsize=None)`.
    
    Nothing gates that floor, which is now filed as #1431.
    
    The local review also caught that holding the module made an
    **existing** test vacuous: the
    `sys.path` guard could be deleted with the whole suite still green. It
    now clears the cache between
    calls and covers that guard again.
    
    CodeRabbit reviewed this one after being rate limited on #1423 and #1426
    all evening, and raised
    that the laziness test read the child interpreter's absolute state
    rather than the import delta,
    which a startup hook could break. Fixed, with a skip rather than a
    vacuous pass where the delta
    cannot be read at all.
    
    Closes #1424
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    ptr727 authored Sep 7, 2026
    Configuration menu
    Copy the full SHA
    bb352c6 View commit details
    Browse the repository at this point in the history
Loading