Skip to content

feat(org): v1.6.0 audit catches governance drift, exempt list, tests (#59) - #68

Merged
enricopiovesan merged 1 commit into
bootstrap-governancefrom
claude/issue-59-governance-drift
Nov 20, 2026
Merged

enricopiovesan merged 1 commit into
bootstrap-governancefrom
claude/issue-59-governance-drift

Conversation

@enricopiovesan

Copy link
Copy Markdown
Contributor

Summary

The governance part of #59. The org audit now catches the drift #59 lists, skips exempt and archived repos, and has tests. It also fixes a bug that meant the audit almost never failed. Once merged this ships as v1.6.0; each consuming repo then fixes its own drift and pins v1.6.0 in its own PR.

Governing Spec

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

Project Item

Refs #59 (Project 1, In Progress, agent:claude, claimed with claim.sh).

What Changed

  • scripts/org/audit_compliance.sh gains five columns per repo:
    • .governance-version equals the latest stable release tag (highest vX.Y.Z by sort -V; release candidates ignored; no tag at all exits 2 instead of passing);
    • AGENTS.md exists and points at CLAUDE.md;
    • CLAUDE.md is at most 6 KB (6144 bytes);
    • no governance version in prose in CLAUDE.md, AGENTS.md or .specify/memory/constitution.md. A version counts only when it follows "governance" or .github in the same sentence, so product pins (Traverse v0.10.0), Rust 1.95, IP addresses and issue refs (.github#57) are not flagged;
    • no copy of the org constitution: a local constitution that shares more than one ### principle heading with constitution.md is a copy. Measured on the live org: traverse's file shares 6 of 7; reference-apps' repo-specific constitution and registry's pointer share 0.
  • Fixed: each cell was computed in $(check ...), so the failure count was lost in the subshell and only the ruleset column could fail the job. Cells are now computed in the current shell.
  • scripts/org/audit_exempt.txt (new): weekly-demos, demo-repository and silver-pancake-demo-repository, each with its reason (maintainer decisions on [Task]: Close governance drift across repos and extend the org audit to catch it #59). The audit lists them under "Exempt repos". rollout_governance.sh's default repo list skips exempt and archived repos too.
  • scripts/org/audit_compliance_test.sh (new): 18 checks with a stubbed gh serving a fixture tree, including a deliberately stale .governance-version; runs as the audit-tests job.
  • This repo: AGENTS.md no longer names a governance version; .governance-version → v1.6.0; docs/runbook.md documents the checks; CHANGELOG 1.6.0.

Live run (before any repo fixes, against v1.5.0)

repo pin current AGENTS→CLAUDE CLAUDE ≤ 6 KB no prose versions no constitution copy
traverse ❌ ✅ ✅ ❌ ❌
registry ❌ ✅ ❌ ❌ ✅
reference-apps ❌ ✅ ✅ ❌ ✅
.github ❌ ✅ ✅ ❌ ✅
claude-skills ❌ ❌ ✅ ❌ ✅
website ❌ ❌ ✅ ✅ ✅
repo-template ❌ ❌ ✅ ✅ ✅

This matches #59's list exactly, with no other repos flagged.

Validation

  • bash scripts/org/audit_compliance_test.sh: 18/18 pass.
  • bash scripts/org/audit_compliance.sh against the live org: table above. It exits 1, as it should while drift remains.

🤖 Generated with Claude Code

…59)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@enricopiovesan

Copy link
Copy Markdown
Contributor Author

Fallback review (Decision 133, fresh context)

Checked at 9c10fa0: bash scripts/org/audit_compliance_test.sh passes 18/18, and bash -n is clean on all three scripts. shellcheck was not available locally.

Rubric

  1. Scope: OK. The audit checks match what [Task]: Close governance drift across repos and extend the org audit to catch it #59 says is not met: pin equals the latest release, AGENTS.md points at CLAUDE.md, CLAUDE.md is at most 6 KB, no governance versions in prose, no constitution copy. The exempt list records the maintainer decision on [Task]: Close governance drift across repos and extend the org audit to catch it #59, including weekly-demos. Fixing the drift in each consuming repo is correctly left to their own PRs.
  2. Failure modes: OK for the required inputs. No stable tag, or org constitution.md headings that cannot be read, now exits 2 with a message (and there is a test for the tag case). A missing or unreadable .governance-version fails both pin columns. See note A for the per-repo optional files.
  3. No gate weakened: OK. The subshell fix makes the gate stricter: before it, only the ruleset column could fail the job. The old "AGENTS.md exists" column is replaced by "exists and points at CLAUDE.md", which is a stricter check. Ruleset and label logic are unchanged. The repos now skipped are only archived ones and three listed with a reason.
  4. Minimal: OK. Changes are limited to the audit, the exempt list, the rollout default list, tests, the workflow job, docs and CHANGELOG.
  5. Tests check behaviour: OK. Each case asserts the exit code and the exact cell in a specific column, including the 6144/6145-byte boundary, sort -V with an RC ignored, false positives the prose check must not flag (IP address, .github#57, product versions), the 1-vs-2 shared-heading threshold, exempt and archived skipping, and the error when there are no tags.

Defects: none blocking.

Non-blocking notes

  • A. raw_file (audit_compliance.sh, the raw_file/constitution= lines) treats any gh api failure the same as a 404. If .specify/memory/constitution.md, CLAUDE.md or AGENTS.md hits a transient 5xx or a rate limit, "no constitution copy", "CLAUDE.md ≤ 6 KB" and "no prose versions" show ✅ that week, when the right result is "unknown". This is the same pattern has_file already uses, so it is not a regression. A follow-up could tell 404 apart from other errors and mark those cells ? or count them as failures.
  • B. A dangling pointer passes. If a repo has an AGENTS.md that mentions CLAUDE.md but has no CLAUDE.md, it gets ✅ on "agent docs", "AGENTS.md → CLAUDE.md" and the size column. You could require has_claude=yes for agents_points.
  • C. The prose check only catches a version that comes after "governance" or ".github", with no digits or dots in between. Text like "pinned at v1.3.0 of governance" or "governance ([Task]: Close governance drift across repos and extend the org audit to catch it #59) v1.3.0" is not flagged. That is acceptable as a heuristic.
  • D. Nit: CHANGELOG 1.6.0 says "four drift checks" but lists five.
  • E. Nit: audit_compliance_test.sh is committed as mode 100644. That is fine because CI runs it through bash.

@enricopiovesan
enricopiovesan merged commit 4e60efc into bootstrap-governance Nov 20, 2026
8 checks passed
@enricopiovesan
enricopiovesan deleted the claude/issue-59-governance-drift branch November 20, 2026 23:25
@enricopiovesan enricopiovesan removed the needs-review Full-CI PR waiting for an independent cross-tool review label Nov 20, 2026
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