From 87d52d395b63c8c4f9af2dad5a699bd961495c4c Mon Sep 17 00:00:00 2001 From: Scott McCarty Date: Wed, 4 Nov 2026 19:51:38 -0500 Subject: [PATCH 1/2] feat!: ci may not skip a push verdict Constitution XII says CI runs push's checks except Gourmand and Gatehouse. Those two are CI_EXCLUDES, decided here. Skipping any other verdict in the `ci` block alone left it on pre-push -- a developer's machine, one `--no-verify` from gone -- while the required `sdlc ci` reported green. 24 of the 33 repos converted under RT#1552 carried `[tool.sdlc.ci] skip = ["codeql"]`, each justified by a comment saying the CodeQL Action covered it. Against the rulesets: that check was required in 1, advisory in 21, and never ran on a pull request in 2 -- ashigaru has no CodeQL workflow at all, and rotv's upload-sarif step is gated on `github.event_name != 'pull_request'`. So in 23 repos the only place CodeQL could block was a hook I had been pushing past with --no-verify. resolve() now refuses the config and names what it objects to. sdlc_config() validates every block whichever command runs, so a repo that adds the skip back finds out on its next `sdlc commit` rather than in CI -- where the skip is exactly what would have made it read green. A check the repo added itself may still be skipped in ci; a check that should run nowhere belongs out of [tool.sdlc.push], where the decision sits in one place. The TRENTINA fixture in tests/test_plan.py carried the skip and now does not; six new refusal cases cover every verdict, plus the two that stay legal, a repo-added check, and the commit-time catch. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01R7Y1jesjfgxHeqtKJCvay6 --- CHANGELOG.md | 25 +++++++++++++++++++++++++ README.md | 8 ++++++++ sdlc | 25 ++++++++++++++++++++++++- tests/test_plan.py | 26 ++++++++++++++++++++++++-- 4 files changed, 81 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6d6bff..e351e03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,31 @@ All notable changes to this project are documented here, following ## [Unreleased] +## [0.5.0] - 2026-11-05 + +### Changed + +- **`[tool.sdlc.ci] skip` may no longer name a push verdict.** Constitution XII + says CI runs push's checks except Gourmand and Gatehouse. Those two are + `CI_EXCLUDES`, decided by this tool. A repo that skipped any of the rest in + the `ci` block alone kept the check on pre-push -- a developer's machine, one + `--no-verify` from gone -- while the required `sdlc ci` reported green. + + This was not hypothetical. 24 of the 33 repos converted under RT#1552 carried + `[tool.sdlc.ci] skip = ["codeql"]`, each with a comment saying the CodeQL + Action covered it. Checked against the rulesets: the Action's check was + required in 1 of them, advisory in 21, and in 2 (`ashigaru`, `rotv`) it never + ran on a pull request at all -- `ashigaru` has no CodeQL workflow, and + `rotv`'s `upload-sarif` step is gated on `github.event_name != 'pull_request'`. + So in 23 repos the only place CodeQL could block was the pre-push hook. + + `resolve()` now refuses the config, with the names it objects to. Because + `sdlc_config()` validates every block whichever command runs, a repo that + adds the skip back finds out on its next `sdlc commit`, not in CI -- which + matters, because in CI the skip is exactly what would have made it read + green. A check the repo added itself may still be skipped in `ci` freely, and + a check that should not run anywhere belongs out of `[tool.sdlc.push]`, where + the decision is visible in one place. ## [0.4.0] - 2026-11-04 Fewer push cycles, and a gate you can see into. Every change here comes from diff --git a/README.md b/README.md index 70536e2..a9c842c 100644 --- a/README.md +++ b/README.md @@ -197,6 +197,14 @@ One rule for all three blocks: - `checks` **adds** to that command's defaults; `skip` removes from them. What push skips, ci skips too. +- **`[tool.sdlc.ci] skip` may not name a push verdict** — mypy, pytest, + semgrep, pip-audit, constitution or codeql. Constitution XII says CI runs + push's checks except Gourmand and Gatehouse, and this tool decides which two + those are. Skipping a verdict in ci alone leaves it on pre-push, which is a + developer's machine and one `--no-verify`, while the required `sdlc ci` + reports green. If a check should not run, take it out of + `[tool.sdlc.push]` — then the choice is in one place. A check the repo added + itself may be skipped in ci freely. - A check that needs settings gets its own table: `[tool.sdlc..]`. - A check that is not built in must say what `kind` it is. diff --git a/sdlc b/sdlc index 31e72e8..74d1ee3 100755 --- a/sdlc +++ b/sdlc @@ -243,7 +243,30 @@ def resolve(cfg: dict, command: str) -> list[str]: base = list(DEFAULTS[command]) own = block(cfg, command) drop = set(names(own.get("skip"), f"[tool.sdlc.{command}] skip")) - if command != "ci": + if command == "ci": + # XII: "CI runs push's checks except Gourmand and Gatehouse". Those two + # are CI_EXCLUDES, decided by this image and not by a repo. Skipping any + # other verdict HERE leaves it on the one tier nothing enforces: pre-push + # runs on a developer's machine and `--no-verify` is one flag, while the + # required `sdlc ci` still reports green. 24 of the 33 converted repos + # skipped `codeql` exactly this way, each with a comment claiming the + # CodeQL Action covered it; the Action was a required check in one of + # them, advisory in 21, and absent from pull requests entirely in two. + # + # A check the repo does not want in CI at all belongs out of + # [tool.sdlc.push] too, where the choice is visible in one place instead + # of being a difference between two tiers nobody reads side by side. + verdicts = sorted(drop & (set(DEFAULTS["push"]) - set(CI_EXCLUDES))) + if verdicts: + cannot( + f"[tool.sdlc.ci] skip names {', '.join(verdicts)}, which the push " + f"tier renders a verdict with. CI may not skip a verdict " + f"(constitution XII): only {' and '.join(CI_EXCLUDES)} run through " + f"their own workflows, and this image decides that, not a repo. " + f"Skip a check the repo added itself, or take it out of " + f"[tool.sdlc.push] as well." + ) + else: drop |= skipped() out = [c for c in base if c not in drop] for name in names(own.get("checks"), f"[tool.sdlc.{command}] checks"): diff --git a/tests/test_plan.py b/tests/test_plan.py index 85976db..5a00f5c 100644 --- a/tests/test_plan.py +++ b/tests/test_plan.py @@ -6,7 +6,9 @@ rules are pinned case by case: - each command runs its defaults; a block's `checks` adds, `skip` removes - - ci runs push's checks except the two reviewers CI already runs elsewhere + - ci runs push's checks except the two reviewers CI already runs elsewhere, + and a repo may not skip any of the rest: that would leave a verdict on + pre-push alone, which is a developer's machine and one `--no-verify` - a check that is not built in must name a kind, and only real kinds exist - the whole config is checked whichever command runs - CodeQL fails only on findings that are not in the committed baseline @@ -81,6 +83,22 @@ def cannot_run(fn, *args) -> str | None: check("a repo check has its kind", S.kind_of(cfg, "image") == "image-build") check("a built-in has no kind", S.kind_of(cfg, "mypy") is None) +# XII: CI runs push's verdicts. A ci-only skip would leave a check on pre-push +# alone -- a developer's machine, one `--no-verify` from gone -- while the +# required `sdlc ci` reported green. It is refused, whichever verdict it names. +for verdict in sorted(set(S.DEFAULTS["push"]) - set(S.CI_EXCLUDES)): + msg = cannot_run(S.resolve, {"ci": {"skip": [verdict]}}, "ci") + check( + f"ci may not skip {verdict}", + msg is not None and "CI may not skip a verdict" in msg, + str(msg), + ) +msg = cannot_run(S.resolve, {"ci": {"skip": list(S.CI_EXCLUDES)}}, "ci") +check("ci may still name the two it never runs", msg is None, str(msg)) +# The repo's own checks are its own business: it added them, it may skip them. +own = {"push": {"checks": ["img"], "img": {"kind": "image-build"}}, "ci": {"skip": ["img"]}} +check("ci may skip a check the repo added", "img" not in S.resolve(own, "ci")) + # ----------------------------------------------------------------- refusals msg = cannot_run(S.kind_of, {"commit": {"checks": ["mystery"]}}, "mystery") @@ -108,6 +126,11 @@ def config_error(pyproject: str) -> str | None: check("a block that is not a command is refused", msg is not None and "only keys are" in msg) msg = config_error('[tool.sdlc.ci]\nchecks = ["typo"]\n') check("a typo in ci is found on commit", msg is not None and "typo" in msg, str(msg)) +# The whole config is checked whichever command runs, so a ci-only skip of a +# verdict is caught on the next commit rather than in CI, where the skip is +# precisely what would have made CI read green. +msg = config_error('[tool.sdlc.ci]\nskip = ["mypy"]\n') +check("a ci skip of a verdict is found on commit", msg is not None and "mypy" in msg, str(msg)) # --------------------------------------------------- project in a subdirectory # @@ -377,7 +400,6 @@ def plan_of(target: str, pyproject: str, **env) -> list[list[str]]: [tool.sdlc.ci] checks = ["image", "image-tests"] -skip = ["codeql"] [tool.sdlc.ci.image] kind = "image-build" From 5cf69cecc34470113438aabe17a1aa273b5e8244 Mon Sep 17 00:00:00 2001 From: Scott McCarty Date: Wed, 4 Nov 2026 20:13:08 -0500 Subject: [PATCH 2/2] chore: this is 0.5.0, not 0.4.0 Crunchtools 1's call, and the right one: 0.4.0 is ready now and this is blocked behind 24 consumer repos dropping the ci codeql skip, so holding the number here would park the fleet behind that. Rebases onto main once 0.4.0 merges. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01R7Y1jesjfgxHeqtKJCvay6 --- Containerfile | 2 +- IMAGE_TAG | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Containerfile b/Containerfile index 7fb85a3..22c1f68 100644 --- a/Containerfile +++ b/Containerfile @@ -44,7 +44,7 @@ LABEL description="Every CrunchTools Python SDLC check in one image: ruff, mypy, LABEL org.opencontainers.image.source="https://github.com/crunchtools/python-sdlc" LABEL org.opencontainers.image.description="Every CrunchTools Python SDLC check in one image." LABEL org.opencontainers.image.licenses="AGPL-3.0-or-later" -LABEL version="0.4.0" +LABEL version="0.5.0" # What the image carries, readable without starting anything. `sdlc versions` # prints these and a consuming repo's CI pins them. diff --git a/IMAGE_TAG b/IMAGE_TAG index 1d0ba9e..8f0916f 100644 --- a/IMAGE_TAG +++ b/IMAGE_TAG @@ -1 +1 @@ -0.4.0 +0.5.0 diff --git a/pyproject.toml b/pyproject.toml index 88c365e..7b034c8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ [project] name = "python-sdlc" -version = "0.4.0" +version = "0.5.0" description = "One container image and one script for every CrunchTools Python SDLC check" requires-python = ">=3.14" license = "AGPL-3.0-or-later"