Repository navigation
ci: check that every guarded SOPS value is in COMPOSE_VARS - #1572
Merged
Merged
Conversation
#1566 guarded WALL_HA_TOKEN in stacks/sensitive/compose.yaml and seeded it, #1563 put it in secrets/sensitive.sops.yaml, and nothing added it to render-config.sh's COMPOSE_VARS. CI validates with the seed's stand-ins and never runs render, so it passed; `make up STACK=sensitive` on trinity did not. scripts/check_compose_vars.py holds the three copies together: a guarded or seeded SOPS key must be in COMPOSE_VARS, a guarded SOPS key must have a stand-in, and a COMPOSE_VARS entry must be a SOPS key. It reads only key names, which SOPS leaves in plaintext. Wired into CI, validate.sh and `make check-compose-vars`; its fixtures run in self-tests.sh. It fails on main at #1566 and passes on #1570's head. Refs #1570. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L2Eweh7G6uK8cbuptGtxTR
…-3yavt6 # Conflicts: # docs/changelog.md
There was a problem hiding this comment.
🟡 Changes recommended
The script bypasses require_yaml(), risking CI failures when PyYAML is absent, and its fixture does not detect regressions that scan raw YAML for guards.
2 open issues
What changed in this PR
Adds a validation check to prevent guarded SOPS values from being omitted from rendered Compose environments—the failure behind WALL_HA_TOKEN in #1566, addressed by prerequisite #1570. No running service configuration changes.
Changes:
- Cross-checks Compose guards, SOPS key names,
COMPOSE_VARS, and validation stand-ins without decrypting secrets. - Integrates the check into CI, local validation, and a dedicated Make target, with 11 fixtures.
- Documents the check and the incident that motivated it.
| File | Description |
|---|---|
scripts/validate.sh |
Runs the new check during local validation. |
scripts/render-config.sh |
Adds a comment linking COMPOSE_VARS to the check. |
scripts/README.md |
Documents the checker and Make target. |
scripts/check_compose_vars.py |
Implements consistency checks and regression fixtures. |
Makefile |
Adds check-compose-vars. |
docs/changelog.md |
Records the check and its incident context. |
.github/workflows/ci.yml |
Runs the checker in CI. |
Review effort: Balanced
Gerrrt
enabled auto-merge (squash)
November 18, 2026 18:17
…re bite Load PyYAML through scripts/_deps.require_yaml(), as every sibling check does, so the pinned bootstrap is used where bare python3 lacks it (#848). The YAML-comment fixture now comments out a guard on a SOPS key that is listed but unseeded, so a regression to scanning raw text fails it; with NOT_A_GUARD, a non-SOPS name, every assertion ignored it either way (#107). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L2Eweh7G6uK8cbuptGtxTR
Merged
4 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What changed
Adds
scripts/check_compose_vars.py, a CI check (also inmake validateandmake check-compose-vars) that fails when a SOPS value guarded by${VAR:?}in anystacks/*/compose.yamlis missing fromCOMPOSE_VARSinscripts/render-config.sh. No running service changes.#1570 has merged and
mainis merged into this branch, so the check now passes here:COMPOSE_VARS OK — all 51 guarded SOPS values are rendered and seeded.Why
#1566 guarded
WALL_HA_TOKENinstacks/sensitive/compose.yamland gave it a stand-in inscripts/seed-validation-env.sh, and #1563 added it tosecrets/sensitive.sops.yaml. Nobody added it toCOMPOSE_VARS. CI validates with the seed's stand-ins and never runs render, so it passed.make up STACK=sensitiveon trinity then failed with "required variable WALL_HA_TOKEN is missing a value". The comment aboveCOMPOSE_VARSalready calls these "three copies of one fact"; now something checks them. Refs #1570.The script asserts:
secrets/*.sops.yamlis inCOMPOSE_VARS(the feat(wall): heimdall first light, and the house and family calendar on the wall #1566 bug).COMPOSE_VARS(the same bug, seen from the seed).seed-validation-env.sh.COMPOSE_VARSentry is a SOPS key (no typos or dead names).It reads only top-level key names, which SOPS stores in plaintext, so nothing is decrypted. Guards are read from the parsed YAML, as
compose-guards.shdoes, so a comment is never taken for a guard (#107). Non-SOPS guards (RENDER_UID, bind addresses) are out of scope.Blast radius
CI,
scripts/validate.sh, the Makefile and docs only. No host, VLAN or service changes.secrets/*.sops.yamlVerification
On
mainat 43a227d (#1566), it fails and names the variable:On #1570's head (ebd2cad), with the script copied in, it passes:
Also run:
python3 scripts/check_compose_vars.py --self-test: 11 fixtures pass.scripts/self-tests.shdiscovers the suite and reportscheck_compose_vars.py --self-test (11 fixtures).python3 scripts/check_docs.py: OK.python3 scripts/check_close_keywords.pyon this body and the commit message: PASS../scripts/lint.sh: ruff passes; the docker- and pipx-backed linters skipped here (no Docker daemon, no pipx). I ranyamllint --strictandactionlintonci.ymlandshellcheckonvalidate.shandrender-config.shdirectly, and all passed. CI's--require-allrun is the authority.Full
make validatenot run: this host had 30 GB free and the suite needs about 38 GB, per CLAUDE.md. Left to CI.make validatepasses (not run locally, see above)Deployed to the lab and confirmed working (CI-only change)
Docs updated (
docs/changelog.md,scripts/README.md)🤖 Generated with Claude Code
https://claude.ai/code/session_01L2Eweh7G6uK8cbuptGtxTR