Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion IMAGE_TAG
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.0
0.5.0
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<command>.<check>]`.
- A check that is not built in must say what `kind` it is.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
25 changes: 24 additions & 1 deletion sdlc
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down
26 changes: 24 additions & 2 deletions tests/test_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
#
Expand Down Expand Up @@ -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"
Expand Down
Loading