Skip to content

fix: sdlc ci runs a non-mutating ruff verdict (#48) - #49

Merged
fatherlinux merged 4 commits into
mainfrom
fix/ci-lint-verdict
Nov 17, 2026
Merged

fatherlinux merged 4 commits into
mainfrom
fix/ci-lint-verdict

Conversation

@fatherlinux

Copy link
Copy Markdown
Member

Fixes #48.

Ruff lived only in the commit tier, where ruff check --fix and ruff format pass anything fixable, and ci is push minus the reviewers, so the required sdlc ci judged no lint at all. A --no-verify commit reached a green check unlinted.

This adds a built-in lint: ruff check --no-fix --no-cache . then ruff format --check --no-cache . (both always run; exit is the worse of the two, so ruff's own 2 stays "cannot run"). It is image-ro, not in WRITES_TREE, so push keeps its two lanes. It leads the push defaults and ci inherits it; [tool.sdlc.ci] skip cannot name it, per the existing XII rule.

Rollout impact. Measured against all 36 consuming repos' default branches with the image's ruff 0.17.1: 35 clean, data-collector has one fixable I001 (src/data_collector/pipeline.py). No new opt-out was needed: [tool.sdlc.push] skip = ["lint"] already removes it from both tiers. Called out in the CHANGELOG as able to turn a consumer red on its bump; under 0.x SemVer that makes the next release a minor (0.7.0).

Tests: tests/test_plan.py (lint in ci, read-only plan line, lanes unchanged, ci skip refused, push skip propagates) and tests/contract.sh (lint clean on a read-only fixture, exits 1 on fixable code without fixing it, push plan order). Both pass locally against the 0.6.3 image with the new sdlc layered in; shellcheck and the host contract pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01R7Y1jgFUuEitySo4qtRTaQ

Ruff lived only in the commit tier, where it runs with --fix, and ci is
push minus the reviewers, so `sdlc ci` judged no lint at all. A new
built-in `lint` -- `ruff check --no-fix` plus `ruff format --check`,
read-only -- leads the push tier and ci inherits it.

Measured on the 36 consuming repos: 35 clean, data-collector has one
fixable I001. Opt-out is the existing `[tool.sdlc.push] skip`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R7Y1jgFUuEitySo4qtRTaQ

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gatehouse found 1 issues (1 medium)

Full review.

1 of 8 agents served by google/gemini-3.1-flash-lite (primary unavailable).

Comment thread tests/contract.sh Outdated
ok "ruff-check fails on broken code"
fi
# A finding ruff could fix is still a finding here -- that is the whole of #48.
podman run --rm -v "$FIXTURE:/repo:ro,z" -w /repo --entrypoint="" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MEDIUM (Test Coverage): The lint integration checks only that the combined command exits nonzero on a fixture with both an import violation and bad formatting. Its output is discarded, so the test would still pass if t_lint stopped after the first failing tool or never ran ruff format --check. The clean-fixture test likewise does not establish that both tools ran. This leaves the promised behavior that both kinds of findings are reported unverified.

Suggestion: Capture the lint output for the failing fixture and assert it contains diagnostics from both ruff check and ruff format --check, or otherwise verify both subprocesses run even when the first returns nonzero.

Evidence:

podman run --rm -v "$FIXTURE:/repo:ro,z" -w /repo --entrypoint="" \
  "$IMAGE" sdlc lint >/dev/null 2>&1 && rc=0 || rc=$?
if [ "$rc" -eq 1 ]; then
  ok "lint fails on code ruff would fix, without fixing it"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. The contract test now captures lint's output and requires both an F401 from ruff check and ruff format's "1 file would be reformatted" summary. If t_lint stopped after the first tool or skipped the formatter, the second string would be missing and the test would fail. It passes against the image with the new sdlc layered in.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in a4ec1a2

The contract test now requires lint's output to include an F401 and ruff format's "1 file would be reformatted".

Answers the Gatehouse finding on #49: an exit of 1 alone would still
pass if lint stopped after ruff check and never ran the formatter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R7Y1jgFUuEitySo4qtRTaQ

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gatehouse found no issues.

Reviewed 1 commit since e5dc255 (incremental).

It runs python-sdlc as of gatehouse#134; constitution#138 drops its
sdlc_exempt entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R7Y1jgFUuEitySo4qtRTaQ

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gatehouse found no issues.

Reviewed 1 commit since a4ec1a2 (incremental).

Review of #49: a repo's [tool.ruff] fix-only = true overrode --no-fix,
so ruff exited 0 having reported nothing; --no-fix-only restores the
verdict. A syntax error is 1 to ruff check and 2 to the formatter, and
max() turned that code finding into COULD NOT RUN; a finding from either
tool now wins. Contract cases for each fault alone, both of which fail
against the previous t_lint. No consumer sets fix-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R7Y1jgFUuEitySo4qtRTaQ

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gatehouse found no issues.

Reviewed 1 commit since 108e78f (incremental).

8 of 8 agents served by google/gemini-3.1-flash-lite (primary unavailable).

@fatherlinux

Copy link
Copy Markdown
Member Author

Review (a143): APPROVE at 62cbbcd. This is a comment, not a formal review: this seat has no PR-review tool.

  • --no-fix-only closes the fix-only hole. With the image's ruff 0.17.1, [tool.ruff] fix-only = true now gives exit 1 on an F821 and leaves the tree untouched. Before this change it gave exit 0 and reported nothing.
  • A finding from either tool now outranks the other's 2, so a syntax error (check 1, format 2) is a finding, not an incident.
  • I re-ran each lint_case body locally with ruff 0.17.1, and each one isolates one fault: lint-only gives check 1 / format 0, format-only gives 0/1, the syntax error gives 1/2, and fix-only F821 gives 1/0. Without --no-fix-only, the fix-only case exits 0, so the test catches a regression.
  • The CHANGELOG now covers the README change.

The ci output still doesn't name push-level skips. That gap predates this PR and is tracked in #50.

🤖 Generated with Claude Code

https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb

@fatherlinux
fatherlinux merged commit c9cd54c into main Nov 17, 2026
10 checks passed
@fatherlinux
fatherlinux deleted the fix/ci-lint-verdict branch November 17, 2026 09:13
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.

sdlc ci runs no lint or format check, so a --no-verify commit lands unlinted under a green required check

1 participant