Skip to content

review_checks: run heavy scanners when the lease policy fails; add missing-tools row - #2116

Merged
remigiusz-antczak merged 1 commit into
mainfrom
land/wave-1029at
Oct 29, 2026
Merged

remigiusz-antczak merged 1 commit into
mainfrom
land/wave-1029at

Conversation

@remigiusz-antczak

Copy link
Copy Markdown
Collaborator

Summary

Heavy scanners (gitleaks, osv-scanner, semgrep, trivy) were wrongly skipped as "heavy lease full" in two cases. First, when the lease policy returned an unusable state, the state went to none but the next lease_take call returned 1. Second, when perun_policy.py crashed with an uncaught exception, exit 1 was read as "full". Now a lease counts as full only on exit 1 together with stdout FULL; any other failure runs the scanners without a lease and reports the policy failure once.

Also adds one closing review_checks: missing tools: row that lists every scanner that is not installed or whose DB is blocked, each with its install or warm-DB hint. Seen in a recent full audit where semgrep, trivy and osv silently did not run.

zizmor, bandit and hadolint stay unleased on purpose: they are light single-file checks.

Verification

  • bash scripts/test-review-checks-lease-policy.sh: 10/10 (new; covers rc=2, a traceback exit 1, a real FULL and the missing-tools row).
  • skill_index.py --check, size ratchet, changelog fragments and the banlist grep pass against origin/main.

🤖 Generated with Claude Code

…ssing-tools row

When perun_policy.py heavy-acquire exited with an unexpected code (rc=2),
lease_take set lease=none and returned 0, but the next call hit the
"lease must be ok" guard and returned 1. Every later heavy scanner (semgrep,
trivy, osv-scanner, ...) was then skipped with a false "heavy lease full",
including under --full. lease=none now means no lease policy, so scanners
run; only a genuinely full lease skips. The policy failure is reported once
on stderr without adding a bogus not-checked row to whichever scanner hit it
first.

"Full" is now an explicit signal: heavy-acquire exits 1 and prints FULL.
Python also exits 1 on any uncaught exception (for example a
ModuleNotFoundError), which used to read as a full lease; it is now a policy
failure and the scanners run unleased. stdout goes to a file, not $(...),
because the lease pid is the caller's parent and must stay this shell.

A tool that is not installed, or whose offline DB is missing (osv-scanner,
trivy), is now listed in one closing "review_checks: missing tools:" line
on stderr with an install or warm-the-DB hint for each.

zizmor, bandit and hadolint are intentionally unleased: they are light
single-file checks. Only the heavy scanners take the lease.

Adds scripts/test-review-checks-lease-policy.sh, registered in
scripts/ci-tests.d/ (3/10 pass against the parent's review_checks.sh, 10/10
after), plus a changelog.d fragment.

Tests: 10/10

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@remigiusz-antczak
remigiusz-antczak merged commit 072cce5 into main Oct 29, 2026
8 checks passed
@remigiusz-antczak
remigiusz-antczak deleted the land/wave-1029at branch October 29, 2026 03:24
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.

1 participant