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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@
# gourmand refuses to cache without this entry and then writes the directory,
# which is also why its hook mounts the tree read-write.
.gourmand-cache/

# `python3 sdlc` and the unit tests import this repo's own `sdlc` module, which
# leaves bytecode beside it. A committed .pyc was tracked until v0.3.0.
__pycache__/
*.pyc
70 changes: 69 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,73 @@ All notable changes to this project are documented here, following

## [Unreleased]

## [0.3.0] - 2026-11-04

### Changed

- **A command's checks run in lanes, at the same time.** `sdlc ci` used to run
every check one after another, so trentina's image build -- which depends on
none of mypy, pytest, semgrep or pip-audit -- waited for all four. The job
took the sum of its checks instead of the length of its longest chain:
5m09s on the self-hosted runner, 16m05s on a GitHub-hosted one, of which the
image chain was 2m34s and 11m21s.

Each plan line now carries a lane as its second field,
`check TAB lane TAB mode TAB payload`. Steps of one lane run in sequence, in
plan order; lanes run at the same time. The image assigns them, by two rules
that name no repo:

- an `image-build` check and every `pytest-in-image` check that runs the
image it tags are one lane, because the build has to finish before the
tests start and two builds writing one tag must not race;
- everything else is the `main` lane, in plan order, which is where `uv sync`
happens -- mypy, pytest and pip-audit each sync the project venv in the
shared cache volume, and one lane makes those sequential. uv does lock the
target environment, but a gate should not bet its venv on a lock it did not
take.

And one refusal: a command that rewrites the tree gets no lanes at all. ruff
rewrites your source and gourmand writes its cache, and a build context or an
in-image mount reading those files while they change is a check judging a
tree that no longer exists. `sdlc commit` is ruff, so commit stays
sequential, which is what "seconds, offline, free" wanted anyway.

A repo with no image-build check gets one lane, and one lane is the
launcher's sequential path: the same run, the same output, as before. `sdlc
push` has no image chain, so push is unchanged too.

- **The CPU budget is for the whole gate, not for each container.** It is
divided between the lanes, floor of one CPU each, so two lanes take the same
share of the machine that one lane took when the checks were sequential.
`sdlc ci` on a laptop is no busier than it was.

- **Each lane's output is buffered and printed whole, in plan order**, as each
check finishes -- a log that cuts two lanes into each other is a log nobody
can read. Buffering collapses the timestamps people were reading the
`== <step>` markers for, so every block now ends with `== <check> passed in
Ns`, or with how long it ran before it failed.

- `sdlc tiers` prints each check's lane when a command has more than one.

### Added

- `SDLC_LANE_STALL` (default 3600 seconds): how long the printer waits with no
check finishing before it stops waiting on the order. What it measures is
silence, and two things cause it -- a lane killed outright (SIGKILL, the OOM
killer, a cancelled CI job), which runs no cleanup and so never reports at
all, or one check that honestly takes longer than the threshold. The first is
the one worth guarding, because without the guard the printer polls for a
report that is never coming. Tripping it is cosmetic: the launcher says so,
waits for every lane to stop and prints what is left, possibly out of plan
order, and every lane's real exit status is still collected.

### Fixed

- Two lanes starting on a machine with no cache volume could both try to create
it, and the one that lost the race called it a gate that could not run.
- A `__pycache__/*.pyc` was committed, and nothing ignored it. Running
`python3 sdlc` or the unit tests left a modified tracked file behind.

## [0.2.2] - 2026-11-04

### Fixed
Expand Down Expand Up @@ -182,7 +249,8 @@ cached tag was never refreshed — that gate had been running a two-week-old
reviewer while CI pulled fresh. Local and CI were different reviewers on the
same diff.

[Unreleased]: https://github.com/crunchtools/python-sdlc/compare/v0.2.2...HEAD
[Unreleased]: https://github.com/crunchtools/python-sdlc/compare/v0.3.0...HEAD
[0.3.0]: https://github.com/crunchtools/python-sdlc/releases/tag/v0.3.0
[0.2.2]: https://github.com/crunchtools/python-sdlc/releases/tag/v0.2.2
[0.2.1]: https://github.com/crunchtools/python-sdlc/releases/tag/v0.2.1
[0.2.0]: https://github.com/crunchtools/python-sdlc/releases/tag/v0.2.0
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.2.2"
LABEL version="0.3.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.2.2
0.3.0
49 changes: 46 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ default_install_hook_types: [pre-commit, pre-push]

repos:
- repo: https://github.com/crunchtools/python-sdlc
rev: v0.2.2
rev: v0.3.0
hooks:
- id: sdlc-commit
- id: sdlc-push
Expand Down Expand Up @@ -69,7 +69,47 @@ laptop and CI both. One pin.
| `push` | mypy, pytest, gourmand, gatehouse, semgrep, pip-audit, constitution, codeql |
| `ci` | mypy, pytest, semgrep, pip-audit, constitution, codeql |

`sdlc tiers` prints what each command runs in the repo you are in.
`sdlc tiers` prints what each command runs in the repo you are in, and which
lane each check runs in.

## Lanes

A command's checks run in lanes. Steps of one lane run in sequence; lanes run
at the same time, so a command takes about as long as its longest chain rather
than the sum of everything in it.

The image decides the lanes, by two rules:

- An `image-build` check and every `pytest-in-image` check that runs the image
it tags are **one lane** — the build has to finish before the tests start.
- Everything else is the `main` lane, in the order `tiers` prints. That is
where `uv sync` happens, and one lane keeps two syncs out of one venv.

A command that rewrites the tree — anything running `ruff-check`,
`ruff-format` or `gourmand` — gets no lanes at all, because a build context
reading those files while they change is judging a tree that no longer exists.
That makes `sdlc commit` sequential by definition.

A repo with no `image-build` check has one lane and runs exactly as it did
before lanes existed. So does `sdlc push`, which never builds a container.

The CPU budget is for the whole gate, not for each container: it is divided
between the lanes, floor of one CPU each. Two lanes are no busier on your
laptop than one was.

Each lane's output is buffered and printed whole, in the order `tiers` lists
the checks, so two lanes never cut into each other's log. Each block ends with
how long its check took, because buffering is what the `== <step>` timestamps
used to tell you.

If no check finishes for `SDLC_LANE_STALL` seconds (default 3600) the printer
stops waiting on the order, says so, waits for every lane to stop and then
prints what is left. That guards against a lane killed outright — SIGKILL, the
OOM killer, a cancelled CI job — which runs no cleanup and so never reports at
all, leaving the printer waiting for a report that is never coming. One check
honestly taking longer than the threshold reaches it too; raise the variable if
that is your repo. Either way only the order is given up, never the verdict:
every lane's real exit status is still collected.

## Configuring it

Expand Down Expand Up @@ -192,7 +232,10 @@ then runs the reviewer CI runs.
A developer machine needs `git`, `podman`, `pre-commit` and `gh`. `bin/sdlc` is
POSIX shell, runs only `git` and `podman`, and refuses any step that is not a
`podman build` or `podman run`. `tests/test_host_contract.sh` proves it with a
restricted `PATH`.
restricted `PATH`, and proves the lane executor there too: that the lanes
really overlap, that a `2` in one beats a `1` in another whichever finishes
first, that a failure in one lane does not stop the other, and that no two
lanes' output interleaves.

## Licence

Expand Down
Binary file removed __pycache__/sdlccpython-314.pyc
Binary file not shown.
Loading
Loading