Skip to content

feat(scripts): add read-only repository settings audit - #511

Merged
ss-o merged 1 commit into
mainfrom
feature-478-repo-settings-audit
Aug 16, 2026
Merged

feat(scripts): add read-only repository settings audit#511
ss-o merged 1 commit into
mainfrom
feature-478-repo-settings-audit

Conversation

@ss-o

@ss-o ss-o commented Aug 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Implements the ADR-0013 rollout item tracked as still open by Track ADR-0013 rollout: repository settings baseline audit #478: a read-only audit that reports per-repository settings/ruleset drift against decisions/0013-repository-settings-baseline.md's R/S/- baseline table, keyed by each repo's ADR-0007 class (lib/repository-classes.yml).
  • Follows scripts/labels-sync.rb's CLI/output conventions and scripts/audit-scheduled-workflows.rb's injectable-client testable design.
  • Unions live repository rulesets and classic branch protection per ADR-0013 ("the effective rule is their union"), including the class-1 linear_history contradiction (wiki/src) and the "no CI" required_status_checks carve-out the ADR documents.
  • No --apply/--confirm-apply: the settings changes applied so far in Track ADR-0013 rollout: repository settings baseline audit #478 were hand-judged, per-repo ruleset mutations, meaningfully riskier than label create/update. Apply mode is deliberately deferred to separate follow-up work.

Verification

  • ruby scripts/test-repo-settings-audit.rb — 33/33 tests pass, written test-first (TDD), each watched fail for the right reason before implementation.
  • ruby -c clean on both scripts.
  • git diff --check clean.
  • trunk check clean (the only reported failures are a pre-existing sandbox gap: gitleaks binary missing from PATH, unrelated to these files).
  • Manually run against live z-shell/.github and z-shell/wiki via read-only gh api GETs (no mutation calls exist in this script). This surfaced real, previously-unknown drift: z-shell/.github's own main ruleset is currently missing pull_request and non_fast_forward, which the Track ADR-0013 rollout: repository settings baseline audit #478 2026-07-28 gated-apply comment recorded as present. Filed separately as its own issue rather than fixed in this PR.
  • CI wiring added at .github/workflows/repo-settings-audit-test.yml, mirroring labels-sync-test.yml's path-triggered pattern; it runs the fixture-only test suite, no live API calls.

Agent handoff

No handoff needed.

Implements the ADR-0013 rollout item that issue #478 tracks as still
open: a read-only audit reporting per-repository settings/ruleset
drift against decisions/0013-repository-settings-baseline.md's R/S/-
baseline table, following the scripts/labels-sync.rb pattern (fixture-
testable client injection, --json/Markdown dual output).

- lib/repository-classes.yml: machine-readable ADR-0007 class mapping,
  mirroring lib/labels.yml's role, with unlisted repos defaulting to
  class 3 per the manual audit methodology already used in #478.
- scripts/repo-settings-audit.rb: ClassResolver, Baseline (the R/S/-
  table), SettingsExtractor (unions live rulesets and classic branch
  protection per ADR-0013), Evaluator, RepoAuditor, Inventory,
  Renderer, and CLI. No --apply/--confirm-apply: the settings changes
  applied so far in #478 were hand-judged per-repo ruleset mutations,
  meaningfully riskier than label create/update, so apply mode is
  deferred to separate follow-up work rather than built here.
- scripts/test-repo-settings-audit.rb: fixture-injected unit tests
  (33 assertions) covering class resolution, baseline dispositions,
  the union-of-both-protection-systems extraction, per-repo auditing,
  org-wide inventory filtering/error-handling, and CLI guardrails.
- .github/workflows/repo-settings-audit-test.yml: CI wiring on the
  same path-triggered pattern as labels-sync-test.yml.

Manually verified against live z-shell/.github and z-shell/wiki via
`gh api` (read-only GETs only): the tool correctly found that
z-shell/.github's own `main` ruleset has drifted since the #478
gated-apply comment recorded it -- pull_request and non_fast_forward
rules are no longer present, live-failing pr_required and
force_push_blocked.
@ss-o
ss-o requested a review from a team as a code owner August 16, 2026 12:30
@ss-o
ss-o merged commit 0867459 into main Aug 16, 2026
7 checks passed
@ss-o
ss-o deleted the feature-478-repo-settings-audit branch August 16, 2026 12:59
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