Skip to content

pre-push reads an unsupported-interpreter failure as 'not covered' rather than as a boundary #1137

Closed

Description

@ptr727

The defect

.husky/pre-push selects an interpreter by running python3 --version or py -3 --version, which proves a working binary and nothing about its version. scripts/local_review.py imports from datetime import UTC, added in Python 3.11, so on an older interpreter the engine fails at import time and exits 1.

The hook maps exit 1 to the not-covered verdict, so it prints "this push is blocked, which is the gate working" and points at the local-strict-review refusal table. The truth is that the check never ran, which is exit 2 and a different message entirely. The engine cannot correct this itself: the failure happens during import, before any of its own exit-code handling exists.

spec/host-tools.json declares a python3 minimum of 3.13, so such a host is already below the fleet floor. That makes this narrow, not unreachable, and the wrong-guidance direction is the bad one: a boundary reported as a verdict is exactly what the three-valued exit contract exists to prevent, per GOVERNANCE.md "Verification Discipline".

Why it is filed rather than fixed in PR #1125

The mechanical fix is small, four lines in the hook probing sys.version_info after the interpreter is chosen, but it needs a decision the pull request should not make on its own: where the floor lives. Hard-coding 3.11 in the hook duplicates a version the engine's imports imply, and hard-coding 3.13 duplicates spec/host-tools.json. Either way a second copy of a floor goes stale the way this repository's other counts have.

Options worth weighing:

  • Probe the floor in the hook against a value read from spec/host-tools.json, which is the single source but costs the hook a JSON read before it has an interpreter it trusts.
  • Guard inside scripts/local_review.py above the version-dependent import, exiting 2 with a message, which keeps the contract with the engine that owns it and needs an E402 suppression.
  • Raise the engine's own floor explicitly and let the guard cite it.

Provenance

Raised by the Copilot reviewer as a suppressed finding on the head of PR #1125, and answered there with a link to this issue.

Activity

  1. ptr727 commented on Sep 3, 2026

    @ptr727
    OwnerAuthor

    Verified resolved against the current tree.

    This issue was filed because .husky/pre-push selected an interpreter on --version alone with no floor check, so an unsupported interpreter failing at import read as "not covered" rather than as a boundary. The hook no longer does that. It now:

    • reads the floor from spec/host-tools.json rather than hard-coding it, so a copy cannot drift the way the probe order already had;
    • probes sys.version_info against that floor before invoking either engine;
    • emits its own distinct message, "below the $py_floor floor, so the review gate did not run", ahead of the engines, and separately distinguishes a gate that could not run (> 1) from a gate that refused (1), with "a review gate could not run, which is not a verdict either way".

    That is exactly the boundary-versus-verdict distinction this issue asked for. Landed as 44ae00b (#1167), and the decision the issue left open, where the floor should live, was settled in the same change: read from the spec.

    Closing. One cosmetic question is left over and is deliberately not reopened here: the unsupported-interpreter path exits 1 rather than 2. The mis-mapping this issue objected to is gone either way, since the message names the case explicitly, so the exit code is a separate call if anyone wants to make it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions