Skip to content

Commit 39bcfce

Browse files
fatherlinuxclaude
andauthored
feat: jq in the image, and a stated boundary for the shell test toolbox (#13)
* feat: jq in the image, and a stated boundary for the shell test toolbox Two repos in the fleet conversion failed `sdlc ci` on pytest for the same reason, and it was not their code: `jq: command not found`. - crunchtools/josui: all four entrypoint tests. The entrypoint is a shell script and calls jq at line 87. - crunchtools/claude-agent: 4 of 103 shell-hook tests. mypy, pip-audit, the constitution validator and CodeQL all pass there; the only external command the hook calls is jq. This is not one repo's quirk. Claude Code hands a hook its event as JSON on stdin, hooks are shell scripts, and jq is the smallest correct way to read JSON from bash. Both repos declare `Requires: jq` in their own package manifests (packaging/claude-agent.spec:16 and the debian control file; josui's Containerfile installs it). More hook-shipping repos are coming. The alternative was to run those tests inside each repo's own built image with the `pytest-in-image` kind. That is the right answer for a per-repo runtime dependency, and it is the answer for crunchtools/tig, whose tests need the image's install paths (crunchtools/tig#29). It is the wrong answer here: claude-agent's reference Containerfile installs the PUBLISHED package, so building it in the gate would test the last release rather than the pull request. Its real install test is already the 8-distro matrix in packages.yml. Those four are unit tests of a shipped script whose declared dependency is jq, and unit tests belong in the gate image. So jq goes in, and the boundary goes in as a comment above the `dnf install`, where someone adding the next package will read it: beyond the checks this image carries bash, coreutils, git, curl, python3 and jq, and nothing else. A test that reaches for socat, nc, node or a repo's own runtime is an integration test and belongs in `pytest-in-image` against that repo's image, or in a new kind. Without a written line this list becomes a host-tools grab bag one repo at a time. tests/contract.sh now asserts jq, curl and bash execute, alongside the checks it already proves. That makes the toolbox a tested property of the image rather than an accident of the base, which matters because the base is Hummingbird and deliberately thin -- `which` is already in this list for exactly that reason. RT#1552 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jesjfgxHeqtKJCvay6 * fix: the release race that cost v0.3.5 its image `container.yml`'s concurrency group was keyed on `github.run_id`. That value is unique per run, so every run sat in a group of its own and the group controlled nothing at all. A merge to main and the tag `release.yml` creates from it are two pushes of the SAME commit. Both built it, both pushed the same `:<sha>` tag, the second replaced the first's manifest, and then the loser's "Verify the pushed digest" step failed with `manifest unknown` on a digest that no longer existed. v0.3.4 happened to win that race. v0.3.5 lost it: the main run moved `latest`, the tag run failed, and the `0.3.5` tag was never created. There is a git tag and a GitHub release for v0.3.5 with no image behind them, which is the one state a fleet pinning this image by exact release cannot survive -- `sdlc` exits 2 with "manifest unknown" and nothing is checked. The only reason no repo is broken by it is that the promote job which opens the version-bump pull requests lives in the run that failed, so the bump never went out. Keyed on `github.sha`, the two runs serialize and the second verifies the digest it just pushed. `cancel-in-progress` stays false off pull requests: cancelling the main run when its tag arrives would abandon a push half-finished. v0.3.5 is superseded by this release rather than backfilled. RT#1552 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jesjfgxHeqtKJCvay6 * fix: the Containerfile version label, which the validator caught Constitution II: every file that states the version states the same one. I moved IMAGE_TAG and pyproject.toml to 0.3.6 and left `LABEL version="0.3.5"` behind, and `Constitution / Validate constitution` said so: VERSION: Containerfile says 0.3.5, CHANGELOG.md says 0.3.6 (II) Which is the check working. mcp-github's 2.0.0 was bumped by hand in two of its five places and could not be tagged; that is why the rule exists. RT#1552 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jesjfgxHeqtKJCvay6 --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent 2d5c687 commit 39bcfce

7 files changed

Lines changed: 109 additions & 6 deletions

File tree

‎.github/workflows/container.yml‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,23 @@ on:
2525
- cron: "0 6 * * 1"
2626
workflow_dispatch:
2727

28+
# Keyed on the COMMIT, not the run, so the push-to-main run and the tag run of
29+
# the same commit SERIALIZE instead of racing. `github.run_id` is unique per
30+
# run, so the old group put every run in a group of its own and controlled
31+
# nothing: both builds pushed the same `:<sha>` tag, the second replaced the
32+
# first's manifest, and the loser's "Verify the pushed digest" step then failed
33+
# with `manifest unknown` on a digest that no longer existed.
34+
#
35+
# That is not theoretical. It cost v0.3.5 its image: the main run won, `latest`
36+
# moved, the tag run lost, and the `0.3.5` tag was never created -- a GitHub
37+
# release with no image behind it, which is the one state a pinned fleet cannot
38+
# survive. v0.3.4 hit the same race and happened to win it. Serialized, the
39+
# second run pushes and then verifies its own digest, which is the current one.
40+
#
41+
# cancel-in-progress stays false off pull requests: cancelling the main run
42+
# when its tag arrives would abandon a push half-done.
2843
concurrency:
29-
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
44+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
3045
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
3146

3247
permissions: {}

‎CHANGELOG.md‎

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

77
## [Unreleased]
88

9+
## [0.3.6] - 2026-11-04
10+
11+
### Fixed
12+
13+
- **Two builds of the same commit raced and one of them lost its image.**
14+
`container.yml`'s concurrency group was keyed on `github.run_id`, which is
15+
unique per run -- so every run sat in a group of its own and the group
16+
controlled nothing. A merge to main and the tag that `release.yml` then
17+
creates are two pushes of the SAME commit, so both built it and both pushed
18+
the same `:<sha>` tag; the second replaced the first's manifest, and the
19+
loser's "Verify the pushed digest" step failed with `manifest unknown` on a
20+
digest that no longer existed.
21+
22+
v0.3.4 won that race. **v0.3.5 lost it**: the main run moved `latest`, the tag
23+
run failed, and the `0.3.5` tag was never created -- a GitHub release and a
24+
git tag with no image behind them, which is the one state a fleet pinning this
25+
image cannot survive. Nothing had pinned it yet only because the promote job
26+
that opens the bump pull requests is in the run that failed.
27+
28+
The group is keyed on `github.sha` now, so the two serialize and the second
29+
verifies the digest it just pushed. v0.3.5 is superseded by this release
30+
rather than backfilled.
31+
32+
### Added
33+
34+
- **jq, and a stated boundary for the shell test toolbox.** Claude Code hands a
35+
hook its event as JSON on stdin, hooks are shell scripts, and jq is the
36+
smallest correct way to read JSON from bash. So a repo that ships such a hook
37+
has unit tests that run the script as a subprocess -- and those failed here
38+
with `jq: command not found`, which is not a verdict about the code. Two
39+
repos hit it within a day of the fleet conversion (crunchtools/josui's
40+
entrypoint tests; 4 of crunchtools/claude-agent's 103 shell-hook tests), and
41+
both declare `Requires: jq` in their own package manifests.
42+
43+
The alternative was to run those tests inside each repo's own image. That is
44+
right for a per-repo runtime dependency and wrong here: claude-agent's
45+
reference Containerfile installs the PUBLISHED package, so building it in the
46+
gate would test the last release rather than the pull request.
47+
48+
The boundary now lives as a comment above the `dnf install` where it is read:
49+
beyond the checks, this image carries bash, coreutils, git, curl, python3 and
50+
jq, and nothing else. A test that reaches for socat, nc, node or a repo's own
51+
runtime is an integration test and belongs in `pytest-in-image` against that
52+
repo's image, or in a new kind. `tests/contract.sh` now asserts jq, curl and
53+
bash execute, so the toolbox is a tested property rather than an accident of
54+
the base image.
55+
956
## [0.3.5] - 2026-11-04
1057

1158
### Changed

‎Containerfile‎

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ LABEL description="Every CrunchTools Python SDLC check in one image: ruff, mypy,
4444
LABEL org.opencontainers.image.source="https://github.com/crunchtools/python-sdlc"
4545
LABEL org.opencontainers.image.description="Every CrunchTools Python SDLC check in one image."
4646
LABEL org.opencontainers.image.licenses="AGPL-3.0-or-later"
47-
LABEL version="0.3.5"
47+
LABEL version="0.3.6"
4848

4949
# What the image carries, readable without starting anything. `sdlc versions`
5050
# prints these and a consuming repo's CI pins them.
@@ -87,7 +87,23 @@ ENV SDLC_GOURMAND_VERSION=${GOURMAND_VERSION} \
8787
# Hummingbird does not ship it. Without it `codeql database create` fails with
8888
# "Could not find a valid Python distribution" on an image that obviously has
8989
# one.
90-
RUN dnf install -y git-core tar zstd which \
90+
#
91+
# THE SHELL TEST TOOLBOX, and its boundary. Beyond the checks themselves this
92+
# image carries exactly: bash, coreutils, git, curl, python3 and jq. Nothing
93+
# else. jq is here because Claude Code hands hooks their event as JSON on
94+
# stdin, hooks are shell scripts, and jq is the smallest correct way to read
95+
# JSON from bash -- so a repo that ships such a hook has unit tests that run
96+
# the script as a subprocess, and two of them (crunchtools/josui,
97+
# crunchtools/claude-agent) declare `Requires: jq` in their own packages. That
98+
# is a shared protocol, not one repo's quirk.
99+
#
100+
# A test that reaches for socat, nc, node, or a repo's own runtime is an
101+
# integration test: it runs through the `pytest-in-image` kind against the
102+
# repo's OWN built image, or it gets a new kind. It does not get a package
103+
# here. Without that line this list becomes a host-tools grab bag, one repo at
104+
# a time. tests/contract.sh asserts the toolbox, so it is a tested property
105+
# rather than an accident of the base image.
106+
RUN dnf install -y git-core tar zstd which jq \
91107
&& dnf clean all \
92108
&& rm -rf /var/cache/dnf
93109

‎IMAGE_TAG‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.5
1+
0.3.6

‎gatehouse-findings.toml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,25 @@ rebuild is meant to move. The exact-pin rule is about the TOOLS whose verdicts \
3131
this image produces, and all of those are pinned exactly -- the contract test \
3232
asserts each reported version equals the version pinned at build time.
3333
"""
34+
35+
[[findings]]
36+
agent = "constitution"
37+
category = "constitution"
38+
file = "Containerfile"
39+
evidence = "RUN dnf install -y git-core tar zstd which jq \\"
40+
status = "not-a-bug"
41+
reason = """
42+
Same reasoning as the base-image finding above, and the same four unpinned \
43+
neighbours: git-core, tar, zstd and which have never carried exact RPM \
44+
versions on this line. The Container Image profile requires a weekly rebuild \
45+
(`0 6 * * 1`) whose entire purpose is to pick up OS security updates; pinning \
46+
an OS package to an exact version is how you build an image that stops \
47+
receiving them, which is the opposite of what the cron is for. What the \
48+
constitution pins to exact versions is the CHECK tools -- ruff, mypy, semgrep, \
49+
pip-audit, CodeQL, Gourmand, Gatehouse -- because a verdict that changes under \
50+
you is not a verdict; those are pinned by ARG and reported by `sdlc versions`. \
51+
jq is not a check, it is part of the shell test toolbox, and its filter \
52+
language is stable across every version the fleet ships. Pinning it would \
53+
freeze a CVE-bearing RPM into the gate image for no gain in reproducibility \
54+
that the digest-addressed release does not already provide.
55+
"""

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
[project]
1212
name = "python-sdlc"
13-
version = "0.3.5"
13+
version = "0.3.6"
1414
description = "One container image and one script for every CrunchTools Python SDLC check"
1515
requires-python = ">=3.14"
1616
license = "AGPL-3.0-or-later"

‎tests/contract.sh‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ for probe in \
4343
"gourmand:gourmand --version" \
4444
"codeql:codeql version --format=terse" \
4545
"uv:uv --version" \
46-
"git:git --version"
46+
"git:git --version" \
47+
"jq:jq --version" \
48+
"curl:curl --version" \
49+
"bash:bash --version"
4750
do
4851
name=${probe%%:*}
4952
cmd=${probe#*:}

0 commit comments

Comments
 (0)