Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/pin-policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def gh_api_json(path):


def call_failure(exc):
"""Return the reason a `git api` call failed, for an operator to act on.
"""Return the reason a `gh api` call failed, for an operator to act on.

The first version of this script formatted the CalledProcessError itself,
which prints the argv and the exit status and drops stderr — so the run
Expand Down
8 changes: 3 additions & 5 deletions tests/test_pin_policy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Tests for scripts/pin-policy.py.

The four gaps the audit (`auditoria-tests-canales.md`) called out for action
The four gaps the audit called out for action
all live in this script:

1. The `NONE` message for zero pins (line 290-294) — historical guard for
Expand All @@ -15,7 +15,6 @@

These tests exercise the real `pin-policy.py` binary as a subprocess (the
script's hyphenated name prevents direct import without renaming, which
import pytest
would break the four consumers). `tests/conftest.py` installs a `gh` stub
on PATH so no network or secret is involved; tests assert on stdout,
stderr, and exit code.
Expand Down Expand Up @@ -203,8 +202,7 @@ def test_run_pin_policy_zero_pins_emits_none_message(

NOTE: this test pins the *message*, not the exit code. As of the
current `scripts/pin-policy.py`, `NONE` is printed but the script
still exits 0 — which is the original fail-open the audit
(`auditoria-tests-canales.md`) flagged. Closing the fail-open
still exits 0 — which is the original fail-open the audit flagged. Closing the fail-open
(changing `if unreadable or stale: sys.exit(1)` to also trigger on
`pins == 0`) is a separate, smaller PR that lands in the same
series; this test catches both the regression of the message and
Expand Down Expand Up @@ -286,7 +284,7 @@ def test_run_pin_policy_helper_diff_emits_diff_and_exits_one(
"""A consumer whose pin's reusable bundles a helper that diverges
between the pinned SHA and the latest tag must emit `DIFF`.

The audit (`auditoria-tests-canales.md`) flagged that
The audit flagged that
`fetch_reusable_surface` only compared the workflow file, leaving
the bundled script (`scripts/pin-policy.py`) unchecked. Today's
pin-policy-reusable bundles exactly that helper, so without this
Expand Down
Loading