Skip to content

test(gates): run each network gate's orchestrator offline, end to end - #302

Merged
stxkxs merged 4 commits into
mainfrom
claude/gates-orchestrators-offline
Nov 29, 2026
Merged

stxkxs merged 4 commits into
mainfrom
claude/gates-orchestrators-offline

Conversation

@stxkxs

@stxkxs stxkxs commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Six gates read a registry or grafana.com, so controls.py exempts them, and their stages were tested only apart. In the default run, each of these orchestrators ran no further than its def line:

  • check-image-vulnerabilities main;
  • check-falco-rule-floor main;
  • check-log-volume-budget main;
  • validate-dashboards main;
  • check-platform-crs check;
  • render-addons main.

Each one's test module now has a TheGateRunWhole class that runs it whole, with no network. Running them found one defect, which is fixed here.

What changed

scripts/tests/fakeregistry.py now serves a gate run whole:

  • chart_archive() builds a chart archive laid out as helm package writes one, with fixed modes and times, so the same files give the same digest.
  • ChartRepository serves an index.yaml carrying each archive's digest, and the archives.
  • Hosts routes each request to a fake by URL prefix. A URL no fake serves fails the test rather than reading as a registry's answer.
  • serve() points registry.py's own client at those fakes for one test, with the chart cache under the test's own directory.

The six runs. Each test module takes registry from gateloader's load(), so the instance it patches is the one its gate holds, whether it runs in the suite or alone.

  • The chart gates read a fixture tree, fetch through registry.py's client and cache, and render with the real helm. The gate-tests job installs helm. Without it these classes skip, and the per-file floors below then fail the run.
  • The falco gate also reads its rule sets through that client, from OCI fakes standing in for ghcr.io.
  • validate-dashboards reads the shipped tree. grafana.com is answered at urlopen, and each retry's wait is recorded rather than slept.
  • check-image-vulnerabilities scans through a trivy stand-in on PATH that answers each image from scripted reports.

Each class holds three things:

  • the clean run;
  • a finding the run names;
  • each way a stage fails, with the status that failure earns. A pin the registry rules out is 1; a registry that stays down, or a render that fails, is 2.

What the runs found. check-image-vulnerabilities refused to run whenever the render produced fewer distinct images than it had units. check-image-pins.chart_coverage already holds every chart to contributing an image, per chart; that is the floor the gate's own comment names. The total only refused catalogs with nothing wrong:

  • two charts whose one image is the same;
  • a chart pinned by more than one unit;
  • imageless charts outnumbering the images the rest render beyond one each.

The end-to-end run met the first case and exited 2. The total is removed. test_corpus_floors held its text as part of the derived floor, and now holds the per-chart derivation alone.

Floors. run.py raises each gate's (lines, branches) floor to what the suite now reaches:

Gate Before After
check-platform-crs.py (51, 51) (96, 91)
validate-dashboards.py (52, 49) (98, 97)
render-addons.py (67, 56) (98, 95)
check-log-volume-budget.py (65, 59) (100, 97)
check-falco-rule-floor.py (58, 33) (97, 91)
check-image-vulnerabilities.py (76, 70) (99, 98)
check-image-pins.py (91, 85) (93, 88)

check-image-pins.py rises because the image gate's run covers its inventory.

scripts/tests/reverify-tests.sh gains seven probes. Six each revert one composition step in an orchestrator, and the seventh restores the image total. Each names the end-to-end test that must fail. They sit in their gates' own sections.

Checks run on this branch

All local, at this head (980d0be, on 3deae31), under Python 3.15.2 with the lock installed --require-hashes:

  • COVERAGE_REQUIRED=1 coverage run --rcfile=.coveragerc scripts/tests/run.py: 1592 tests across 44 modules pass, 64 of them new, with all 25 per-file floors held.
    • Lines are at 91.3%, against 85.6% on main.
    • Branches are at 88.8%, against 82.3%.
    • 472 of 492 functions are entered, against 459.
  • scripts/tests/reverify-tests.sh: pass=300 fail=0, main's 293 and the 7 this adds.
    • CI's run at the first head, 24a3017, gave pass=260 fail=33. Four of the new modules imported registry before gateloader had put scripts/ on sys.path. In the suite an earlier module had already imported gateloader. The harness runs one module at a time, and there those four could not import.
  • scripts/tests/controls.py: all 25 controls complete a proof.
  • scripts/tests/empty-corpus.py: all 36 probed gates refuse an empty corpus.
  • scripts/check-named-things.py: all 276 path and target references resolve.
  • ruff, ruff format, mypy over scripts/, and shellcheck: pass.

The rebase onto #299's squash met one conflict, in run.py's floors table, where #299's catalog.py floor sits beside this PR's control-exempt block. Both are kept.

@github-actions

Copy link
Copy Markdown

CI Results

Check Status
Zero-placeholder gate ✅ success
Pinned chart archives ✅ success
YAML Lint ✅ success
Dashboard gate (live grafana.com ids + AMG-saveable) ✅ success
Kyverno policy tests (+ verify-images contract) ✅ success
Admission pins a verified tag to its digest (kind) ✅ success
Fork-safety gate (no hardcoded org, blocking) ✅ success
Account ids read as secrets and masked first ✅ success
Helm-render (every addon × every env) ✅ success
Rendered images carry no unacknowledged CRITICAL ✅ success
Policy-admission (Enforce-tier Kyverno vs the fleet) ✅ success
ApplicationSet schema + sync waves ✅ success
Appset render (ApplicationSet template strings) ✅ success
Secret scan (gitleaks) ✅ success
Render + assert + schema + misconfig (all environments) ✅ success
Renovate manager coverage ✅ success
Loki volume warns before cutoff ✅ success
Falco loads every rule set it installs ✅ success
Gate scripts pass lint, typecheck and shellcheck ✅ success
Policy validity (kustomize + kyverno) ✅ success
The gates themselves are tested ✅ success
Pods name ServiceAccounts that exist ✅ success
Catalog CRs admissible against the operator chart ✅ success
Catalog source reads its revision ✅ success

All checks passed.

@github-actions

Copy link
Copy Markdown

CI Results

Check Status
Zero-placeholder gate ✅ success
Pinned chart archives ✅ success
YAML Lint ✅ success
Dashboard gate (live grafana.com ids + AMG-saveable) ✅ success
Kyverno policy tests (+ verify-images contract) ✅ success
Admission pins a verified tag to its digest (kind) ✅ success
Fork-safety gate (no hardcoded org, blocking) ✅ success
Account ids read as secrets and masked first ✅ success
Helm-render (every addon × every env) ✅ success
Rendered images carry no unacknowledged CRITICAL ✅ success
Policy-admission (Enforce-tier Kyverno vs the fleet) ✅ success
ApplicationSet schema + sync waves ✅ success
Appset render (ApplicationSet template strings) ✅ success
Secret scan (gitleaks) ✅ success
Render + assert + schema + misconfig (all environments) ✅ success
Renovate manager coverage ✅ success
Loki volume warns before cutoff ✅ success
Falco loads every rule set it installs ✅ success
Gate scripts pass lint, typecheck and shellcheck ✅ success
Policy validity (kustomize + kyverno) ✅ success
The gates themselves are tested ❌ failure
Pods name ServiceAccounts that exist ✅ success
Catalog CRs admissible against the operator chart ✅ success
Catalog source reads its revision ✅ success

One or more checks failed — see the job logs.

stxkxs and others added 4 commits November 29, 2026 04:33
fakeregistry answered registry.py's own tests at the urlopen level. A gate
run whole needs more than that: a chart helm can render, an HTTPS
repository that indexes it, and every request routed to the fake serving
its host.

- chart_archive() builds a chart archive laid out as helm package writes
  one, with fixed modes and times, so the same files give the same digest.
- ChartRepository serves an index.yaml carrying each archive's digest, and
  the archives. Its `answer` stands in for a repository that is down.
- Hosts routes each request to a fake by URL prefix and records it. A URL
  no fake serves fails the test rather than reading as a registry's answer.
- serve() points registry.py at those fakes for the length of one test,
  with the chart cache under the test's own directory and the index cache
  emptied.

Co-authored-by: stxkxsbot <275011021+stxkxsbot@users.noreply.github.com>
Six gates read a registry or grafana.com, so controls.py exempts them, and
their stages were tested only apart. check-image-vulnerabilities main,
check-falco-rule-floor main, check-log-volume-budget main,
validate-dashboards main, check-platform-crs check and render-addons main
each ran no further than its def line in the default run. Each one's test
module now has a TheGateRunWhole class that runs it whole, with no network:

- the chart gates read a fixture tree, fetch through registry.py's own
  client and cache from fakeregistry, and render with the real helm;
- the falco gate also reads its rule sets through that client, from OCI
  fakes standing in for ghcr.io;
- validate-dashboards reads the shipped tree, with grafana.com answered at
  urlopen and each retry's wait recorded rather than slept;
- check-image-vulnerabilities scans through a trivy stand-in on PATH that
  answers each image from scripted reports.

Each class holds the clean run, a finding the run names, and each way a
stage fails, with the status that failure earns: a pin the registry rules
out is 1; a registry that stays down, or a render that fails, is 2.

run.py raises the six floors to what the suite now reaches, and that of
check-image-pins.py, whose inventory the image gate's run covers. The new
floors are platform-crs (96, 91), dashboards (98, 97), render-addons
(98, 95), log-volume (100, 97), falco (97, 91), image-vulnerabilities
(98, 97) and image-pins (93, 88). reverify-tests.sh reverts one composition
step in each orchestrator and requires the end-to-end test that holds it
to fail.

Co-authored-by: stxkxsbot <275011021+stxkxsbot@users.noreply.github.com>
check-image-vulnerabilities refused to run whenever the render produced
fewer distinct images than it had units, as a walk that "got smaller rather
than the catalog". Every chart a unit renders is already held to
contributing an image, per chart, by check-image-pins.chart_coverage, the
floor the file's own comment names. What the total added was a refusal of
catalogs with nothing wrong: two charts whose one image is the same, a
chart pinned by more than one unit, or imageless charts outnumbering the
images the rest render beyond one each. The end-to-end run met the first:
two charts sharing their image exited 2.

The total is gone. test_charts_sharing_their_one_image_scan_it_once holds
that run, and reverify-tests.sh restores the total and requires that test
to fail. test_corpus_floors held the total's text as part of the derived
floor, and now holds the per-chart derivation alone. The gate's floor
rises to (99, 98).

Co-authored-by: stxkxsbot <275011021+stxkxsbot@users.noreply.github.com>
Four test modules imported registry by name, and the import sort put that
ahead of the gateloader import, which is what puts scripts/ on sys.path.
The suite passed because an earlier module had already imported
gateloader. reverify-tests.sh runs one module at a time, and there each of
the four failed to import, so every probe it planted against them read as a
miss. Each module now takes registry from load(), as test_gatelib and
test_registry do, and gets the instance the gates hold.

Co-authored-by: stxkxsbot <275011021+stxkxsbot@users.noreply.github.com>
@stxkxs
stxkxs force-pushed the claude/gates-orchestrators-offline branch from 2342a2d to 980d0be Compare November 29, 2026 04:34
@github-actions

Copy link
Copy Markdown

CI Results

Check Status
Zero-placeholder gate ✅ success
Pinned chart archives ✅ success
YAML Lint ✅ success
Dashboard gate (live grafana.com ids + AMG-saveable) ✅ success
Kyverno policy tests (+ verify-images contract) ✅ success
Admission pins a verified tag to its digest (kind) ✅ success
Fork-safety gate (no hardcoded org, blocking) ✅ success
Account ids read as secrets and masked first ✅ success
Helm-render (every addon × every env) ✅ success
Rendered images carry no unacknowledged CRITICAL ✅ success
Policy-admission (Enforce-tier Kyverno vs the fleet) ✅ success
ApplicationSet schema + sync waves ✅ success
Appset render (ApplicationSet template strings) ✅ success
Secret scan (gitleaks) ✅ success
Render + assert + schema + misconfig (all environments) ✅ success
Renovate manager coverage ✅ success
Loki volume warns before cutoff ✅ success
Falco loads every rule set it installs ✅ success
Gate scripts pass lint, typecheck and shellcheck ✅ success
Policy validity (kustomize + kyverno) ✅ success
The gates themselves are tested ✅ success
Pods name ServiceAccounts that exist ✅ success
Catalog CRs admissible against the operator chart ✅ success
Catalog source reads its revision ✅ success

All checks passed.

@stxkxs
stxkxs merged commit 27f1230 into main Nov 29, 2026
34 checks passed
@stxkxs
stxkxs deleted the claude/gates-orchestrators-offline branch November 29, 2026 07:51
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