Skip to content

Commit c20249e

Browse files
Josuiclaude
andcommitted
fix: sdlc ci and sdlc tiers name the push verdicts a repo skipped (#50)
`[tool.sdlc.push] skip` is the only way a verdict leaves ci, and a verdict that is not run was simply absent from the output, so a green `sdlc ci` read the same whether the repo ran lint or opted out of it. `sdlc plan ci` now prints, on stderr (stdout is the plan the launcher parses), one line such as sdlc ci: not run, skipped in [tool.sdlc.push]: lint, codeql and `sdlc tiers` prints the same line under its ci block. The reviewers ci never runs, and a verdict the ci block adds back, are not named. Closes #50 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jg4en5vBPWthjJZsCj
1 parent f52e641 commit c20249e

3 files changed

Lines changed: 72 additions & 0 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ All notable changes to this project are documented here, following
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- `sdlc ci` and `sdlc tiers` now name the push verdicts a repo took out of
12+
ci with `[tool.sdlc.push] skip`, as one line:
13+
`sdlc ci: not run, skipped in [tool.sdlc.push]: lint, codeql` (#50).
14+
Before, a skipped verdict was simply absent, so a green ci could not be
15+
told from one that opted out.
16+
917
## [0.7.1] - 2026-11-17
1018

1119
### Changed

‎sdlc‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,23 @@ def resolve(cfg: dict, command: str) -> list[str]:
296296
return out
297297

298298

299+
def push_skips(cfg: dict) -> list[str]:
300+
"""The push verdicts ci does not run because [tool.sdlc.push] skips them.
301+
302+
That skip is the only way a repo takes a verdict out of ci, and a verdict
303+
that is not run is otherwise just absent: a green `sdlc ci` read the same
304+
whether the repo ran lint or opted out of it (python-sdlc#50).
305+
"""
306+
drop = set(names(block(cfg, "push").get("skip"), "[tool.sdlc.push] skip"))
307+
ci = resolve(cfg, "ci")
308+
return [c for c in DEFAULTS["push"] if c in drop and c not in CI_EXCLUDES and c not in ci]
309+
310+
311+
def push_skip_line(cfg: dict) -> str | None:
312+
gone = push_skips(cfg)
313+
return f"sdlc ci: not run, skipped in [tool.sdlc.push]: {', '.join(gone)}" if gone else None
314+
315+
299316
def check_settings(cfg: dict, name: str) -> dict:
300317
"""A check's own table, wherever it is written. Names are unique."""
301318
found = [
@@ -469,6 +486,10 @@ def t_plan(target: str) -> int:
469486
for check in checks:
470487
if check not in BUILTINS and kind_of(cfg, check) is None:
471488
cannot(f"unknown check: {check}")
489+
# stderr, because stdout is the plan the launcher parses.
490+
line = push_skip_line(cfg) if target == "ci" else None
491+
if line:
492+
print(line, file=sys.stderr)
472493
lanes = lane_of(cfg, checks)
473494
for check in checks:
474495
lane = plain(lanes[check], "a lane name")
@@ -495,6 +516,9 @@ def t_tiers() -> int:
495516
print(f" {check}{note}")
496517
if parallel:
497518
print(f" {len(set(lanes.values()))} lanes, run at the same time")
519+
line = push_skip_line(cfg) if command == "ci" else None
520+
if line:
521+
print(f" {line}")
498522
if skipped():
499523
print(f"\nSDLC_SKIP is skipping: {', '.join(sorted(skipped()))}")
500524
return CLEAN

‎tests/test_plan.py‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,46 @@ def plan_of(target: str, pyproject: str, **env) -> list[list[str]]:
413413
return [line.split("\t") for line in buf.getvalue().splitlines()]
414414

415415

416+
# python-sdlc#50: a push skip is the only way a verdict leaves ci, so ci and
417+
# tiers say so; otherwise a green ci reads the same whether lint ran or not.
418+
check("no push skip, nothing to report", S.push_skips(empty) == [])
419+
check(
420+
"a push skip is named, in push order",
421+
S.push_skips({"push": {"skip": ["codeql", "lint"]}}) == ["lint", "codeql"],
422+
)
423+
check(
424+
"the reviewers ci never runs are not named",
425+
S.push_skips({"push": {"skip": ["gatehouse", "mypy"]}}) == ["mypy"],
426+
)
427+
check(
428+
"a verdict ci adds back is not named",
429+
S.push_skips({"push": {"skip": ["lint"]}, "ci": {"checks": ["lint"]}}) == [],
430+
)
431+
432+
433+
def stderr_and_stdout(fn, target: str | None, pyproject: str) -> tuple[str, str]:
434+
with tempfile.TemporaryDirectory() as root:
435+
Path(root, "pyproject.toml").write_text(pyproject)
436+
S.REPO = Path(root)
437+
out, err = io.StringIO(), io.StringIO()
438+
with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):
439+
fn(*([target] if target else []))
440+
return err.getvalue(), out.getvalue()
441+
442+
443+
SKIPS = '[tool.sdlc.push]\nskip = ["lint", "codeql"]\n'
444+
NAMED = "sdlc ci: not run, skipped in [tool.sdlc.push]: lint, codeql"
445+
err, out = stderr_and_stdout(S.t_plan, "ci", SKIPS)
446+
check("sdlc ci names its push skips once", err.splitlines() == [NAMED], err)
447+
check("the plan itself stays clean", NAMED not in out, out)
448+
err, _ = stderr_and_stdout(S.t_plan, "push", SKIPS)
449+
check("only ci names them", err == "", err)
450+
err, _ = stderr_and_stdout(S.t_plan, "ci", "[tool.ruff]\n")
451+
check("a repo that skips nothing hears nothing", err == "", err)
452+
_, out = stderr_and_stdout(S.t_tiers, None, SKIPS)
453+
check("sdlc tiers prints the same line", f" {NAMED}" in out.splitlines(), out)
454+
455+
416456
TRENTINA = """
417457
[project]
418458
name = "fx"

0 commit comments

Comments
 (0)