Skip to content

fix(#69): failed repo listing exits 2, no EXIT trap, rollout docs pass the audit - #72

Merged
enricopiovesan merged 1 commit into
bootstrap-governancefrom
claude/issue-69-review-fixes
Nov 24, 2026
Merged

enricopiovesan merged 1 commit into
bootstrap-governancefrom
claude/issue-69-review-fixes

Conversation

@enricopiovesan

Copy link
Copy Markdown
Contributor

Summary

Fixes the defects the post-merge review of #71 found (#71 (comment)). #69's Definition of Done item 1 (API errors never pass) was not fully met.

Governing Spec

no-spec-needed (governance compliance; the rules are in docs/ai-agent-hardening.md)

Project Item

Refs #69 (Project 1, reopened).

What Changed

  • D1: a failed repo listing no longer passes. gh repo list ran in < <(...) with no status check; a rate-limit error gave an empty list and "All repos compliant." with exit 0. It is now captured with stderr; a failure, or zero active repos, exits 2 ("audit incomplete").
  • D2: no EXIT trap. On bash 3.2 any EXIT trap turns a set -u abort into exit 0, because $? is already 0 when the trap runs. The review's suggested rc=$?; …; exit "$rc" does not help there (checked on macOS /bin/bash 3.2.57). Every deliberate exit now goes through finish(), which removes the temp file; a crash only leaves a temp file.
  • D3: a fresh rollout passes the audit. For a repo with no agent docs, rollout_governance.sh wrote a CLAUDE.md containing ".github, version $VERSION" (flagged as a prose version) and no AGENTS.md (fails the pointer column). It now points at .governance-version and also writes an AGENTS.md pointing at CLAUDE.md.
  • N1: tests hit the read they name. FAKE_FAIL now matches the end of the API path, so the 500 cases cover the per-repo constitution read and the workflow listing separately from the org constitution and has_file cla.yml. New cases: HTTP 500 (403 rate limit) on repo list, and an org with no active repos.
  • CHANGELOG [Unreleased] updated.

Not changed: N2 (rulesets ? on 5xx; pre-existing, ruleset reads need admin) and N3 (prose-check wording edge cases).

Validation

  • bash scripts/org/audit_compliance_test.sh: all checks pass.
  • The new test file against the current bootstrap-governance audit fails the repo list and no-repos cases (exit 0).
  • macOS /bin/bash 3.2: injecting an unbound variable now exits 1 (was 0 with the trap).
  • The prose check finds nothing in the new generated CLAUDE.md.
  • bash -n on all changed scripts.

🤖 Generated with Claude Code

…s the audit

Fixes from the post-merge review of #71.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@enricopiovesan enricopiovesan added the needs-review Full-CI PR waiting for an independent cross-tool review label Nov 23, 2026
@enricopiovesan

Copy link
Copy Markdown
Contributor Author

Fallback review (Decision 133, fresh context, after the 4-hour window): pass.

  1. Spec/DoD match: pass. D1 makes a failed or empty repo listing exit 2. D2 removes the EXIT trap and routes deliberate exits through finish. D3 makes the rollout generate CLAUDE.md with no version, plus an AGENTS.md pointer.
  2. Failure modes: pass.
    • HTTP 403/500 on the repo list exits 2.
    • Zero active repos exits 2.
    • A set -u abort now exits non-zero on bash 3.2.
    • The api_failed call inside the workflow_comments subshell still propagates exit 2 through set -e.
  3. No gate weakened: pass. FAKE_FAIL now matches path suffixes, and the target list was widened to cover every earlier read plus two new ones.
  4. Minimal: pass. Four files changed.
  5. Behaviour tests: pass.
    • 33/33 on /bin/bash 3.2.57; CI audit-tests passes on bash 5.
    • Against the old script, the new "repo list 500" and "no repos" tests fail (they exit 0).

Non-blocking nits:

  • scripts/org/rollout_governance.sh:167: the generated AGENTS.md points at scripts/agent/claim.sh, which the rollout doesn't copy into the target repo.
  • The per-file fetch inside workflow_comments is never hit with a 500 in the tests. Covering it needs a fixture with a third workflow file. The code is correct on inspection.

@enricopiovesan
enricopiovesan merged commit 53da884 into bootstrap-governance Nov 24, 2026
8 checks passed
@enricopiovesan enricopiovesan removed the needs-review Full-CI PR waiting for an independent cross-tool review label Nov 24, 2026
@enricopiovesan
enricopiovesan deleted the claude/issue-69-review-fixes branch November 24, 2026 01:39
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