From 89b9208286cd2b2637550a149714abb36c62e11d Mon Sep 17 00:00:00 2001 From: Nikolai Emil Damm Date: Sat, 18 Jul 2026 12:16:14 +0200 Subject: [PATCH 1/4] test: guard declarative coverage of deploy/ Every deploy/ dimension should name every managed repository. When a repo is created or renamed it is typically added to one or two dimensions and missed in the rest, leaving it partly declared while un-modelled settings drift. Adds a hermetic guard that derives the expected repository set from the union of all dimensions and fails closed on any repo missing from one of them. The 14 pre-existing gaps are exempted explicitly with a tracked reason so the guard lands green and ratchets; a stale exemption also fails. Part of #56 --- .github/workflows/ci.yaml | 3 + tests/declarative-coverage.sh | 155 ++++++++++++++++++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100755 tests/declarative-coverage.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0a8f84c..0a6f59f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -32,6 +32,9 @@ jobs: - name: ๐Ÿงช Test active Admins policy run: bash tests/admin-team-policy.sh + - name: ๐Ÿงช Test declarative coverage + run: bash tests/declarative-coverage.sh + ci-required-checks: name: CI - Required Checks runs-on: ubuntu-latest diff --git a/tests/declarative-coverage.sh b/tests/declarative-coverage.sh new file mode 100755 index 0000000..0cdce81 --- /dev/null +++ b/tests/declarative-coverage.sh @@ -0,0 +1,155 @@ +#!/usr/bin/env bash +# +# Guards the *completeness* of the declarative model in deploy/. +# +# Every repository the org manages should appear in every deploy/ dimension. +# When a repo is created or renamed it is typically added to one or two +# dimensions and quietly missed in the rest, leaving it partly declared: it +# looks managed on inspection while un-modelled settings drift underneath. +# +# This test is hermetic โ€” it reads only the repository tree, never the GitHub +# API (CI runs with `permissions: {}` and no token). The expected repository set +# is therefore the UNION of the repos named across all dimensions, which is +# exactly the drift class we care about: a repo present in some dimensions and +# absent from others. See KNOWN LIMITATION at the bottom. + +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" + +fail() { + echo "declarative-coverage test: $*" >&2 + exit 1 +} + +# Dimensions, as "