Skip to content

feat: stacks, the container stack, and quay.io/crunchtools/sdlc - #59

Merged
fatherlinux merged 11 commits into
mainfrom
feat/stacks
Nov 17, 2026
Merged

fatherlinux merged 11 commits into
mainfrom
feat/stacks

Conversation

@fatherlinux

@fatherlinux fatherlinux commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

First step from python-sdlc to the fleet-wide sdlc image (a196).

What changes

Stack detection happens in the image's planner, the half that already reads TOML and answers bin/sdlc's plan request. Files at the repo root decide the stacks: pyproject.toml is python, a Containerfile or Dockerfile is container, package.json is node, a Containerfile with a bootc base is bootc, and a repo with none of these is docs. A repo can add or drop a stack with [tool.sdlc] stacks / skip-stacks, but it can never add a command. sdlc stacks prints what was detected and what runs. A repo with no pyproject.toml writes the same tables in sdlc.toml.

Compat promise: a Python repo that sets neither key runs the python stack alone, exactly as before, even if it has a Containerfile.

Container stack:

  • containerfile-lint runs hadolint 2.14.0 in push and ci.
  • container-build, container-smoke and container-scan run in ci only, as one lane.
  • Smoke uses a new launcher mode, host-up. It starts the built image detached, with no network and no capabilities, and asks podman for the container's state (Running, ExitCode, OOMKilled) once a second for up to seconds (default 10). Still running, or exited 0, passes. Any other exit fails, as does the OOM killer or an entrypoint that cannot start (126/127). Only podman's own 125 is a 2. No clock is involved.
  • Scan runs grype 0.121.0 in the gate image over the built image's rootfs, which podman mounts with --mount type=image. It fails on a fixable Critical by default, and the repo's .grype.yaml applies. The plan names the gate image as @sdlc-image, which run_host replaces.
  • hadolint, grype and shellcheck are pinned by digest, and every actions/* step is pinned by commit SHA.

Publishing: container.yml copies the tested digest to quay.io/crunchtools/sdlc with skopeo copy --preserve-digests, so both names hold the same bytes. promote moves the same tags on both, with its read-back check and its backwards-move guard on both.

Running main before a release

No pull request run touches a registry. What has merged and not yet been released is quay.io/crunchtools/sdlc:main, the same name git and Gourmand use. promote already moves it on every push to main, and every safeguard applies:

  • The pushed :<sha> acts as the scratch tag.
  • verify-digest contract-tests that digest before anything is tagged.
  • The copy is read back and must match the tested digest.
  • The git-ancestry guard refuses to move :main onto a commit it already contains.

Only a release moves :latest and the version tags; the release is the gate.

Running it on a developer's machine:

  • SDLC_IMAGE=main, or any bare tag of sdlc (0.8.0), or a full reference. A seat's own build works too: SDLC_IMAGE=localhost/python-sdlc:dev.
  • [tool.sdlc] image = "<tag>" takes the same bare tags, on a seat only. Under CI, under GITHUB_ACTIONS, and for sdlc ci anywhere, the launcher refuses it with exit 2, so a PR cannot choose the image that judges it. The planner can't enforce that because it runs inside the chosen image.
  • Every command on a non-pinned image prints a banner naming the image and what chose it, and registry tags use --pull=newer.

Local builds are never pushed; the README says so.

Proof that Python repos are unaffected

I used the 36 public crunchtools repos that pin python-sdlc and have a pyproject.toml:

  1. Planner. sdlc plan commit, plan push, plan ci and tiers, run with the released python-sdlc:0.7.4 image and with this branch's image. All 36 × 4 outputs are byte-identical, and all exit 0. This was last run on 06bba33; the planner has not changed since, apart from one error message.
  2. Launcher, on daa02d5. main's bin/sdlc and this branch's, run through a recording fake podman for commit, push, ci, tiers and versions. The 972 podman argv lines are identical as sets in all 36 repos. In 5 of them, the two concurrent lanes log in a different order from run to run.

Tests:

  • Unit, host contract (the smoke state cases, 127 as a finding, OOM, detached run and cleanup, the CI and sdlc ci refusals of image, tag resolution), shellcheck, ruff and the image contract test all pass.
  • tests/test_container_stack.sh runs in CI with real podman: a service passes, a crashing image fails with its own error, and a missing entrypoint fails as a finding.

Design note: the remaining stacks

Until a stack ships, a repo that has it gets exit 2 and is told to add skip-stacks.

  • node (2 repos). Commit: the repo's own formatter and linter through npm exec, at the versions its package-lock.json pins. Push: npm ci --ignore-scripts, lint, tsc --noEmit when there is a tsconfig.json, npm test and npm audit --audit-level=high --omit=dev. Node comes from a Hummingbird nodejs stage, cached by lockfile hash.
  • bootc (3 repos). containerfile-lint, container-build, bootc container lint inside the built image, and container-scan. No smoke run. Building a disk image stays in the release workflow.
  • docs (6 repos). Common checks, an offline check of relative links, and markdownlint with the repo's config. This is also the fallback when nothing is detected, so it should ship before the conversion.
  • Four verbs. sdlc release would own tagging and publishing, with the build, verify and promote shape used here.
  • Launcher default image. It still defaults to python-sdlc:<IMAGE_TAG>. Switching to sdlc is one line once both names have carried a release.

🤖 Generated with Claude Code

https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb

@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 4 issues (1 high, 3 medium)

Full review.

3 finding(s) dropped: their evidence is not in the diff.

Comment thread sdlc
f"configures sdlc in its [tool.sdlc] tables, so remove {SDLC_TOML}"
)
try:
return tomllib.loads(path.read_text(encoding="utf-8"))

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 (Bug Hunter): If sdlc.toml contains invalid UTF-8, read_text(encoding="utf-8") raises UnicodeDecodeError, which is not caught here. The configuration then fails with an unhandled traceback instead of the intended cannot(...) diagnostic.

Suggestion: Include UnicodeDecodeError in the handled exceptions when reading sdlc.toml.

Evidence:

return tomllib.loads(path.read_text(encoding="utf-8"))
    except (OSError, tomllib.TOMLDecodeError) as exc:

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 7fa3d8d
config_document() now catches UnicodeDecodeError alongside OSError and TOMLDecodeError, and tests/test_plan.py asserts that a non-UTF-8 sdlc.toml exits 2 instead of raising a traceback.

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 0323fca
This is the rebased form of 7fa3d8d, which the rebase onto main rewrote. config_document() catches UnicodeDecodeError, and tests/test_plan.py asserts that a non-UTF-8 sdlc.toml exits 2.

# The fleet name gets the SAME manifest, copied rather than pushed a
# second time: a second podman push recompresses the layers and can
# produce a different digest, and then the two names hold two images.
skopeo copy --all --preserve-digests "docker://$QUAY@$digest" "docker://$SDLC:$GITHUB_SHA"

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 new registry-copy path publishes the built digest under a second repository and verifies the read-back, but the changed tests do not exercise this external registry interaction. The separate promotion path also now copies tags to both repositories, with no test of the two-repository behavior or its failure cases.

Suggestion: Add a workflow-level test using a stubbed skopeo (and git for the ancestry guard) to verify the copy and digest check for both repositories, including copy failure, digest mismatch, and a guard refusal when either repository is ahead.

Evidence:

skopeo copy --all --preserve-digests "docker://$QUAY@$digest" "docker://$SDLC:$GITHUB_SHA"
got=$(skopeo inspect --format '{{.Digest}}' "docker://$SDLC:$GITHUB_SHA")
[ "$got" = "$digest" ] || { echo "$SDLC:$GITHUB_SHA is $got, not $digest" >&2; exit 1; }

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.

Not a bug: the copy step checks itself. It reads the digest back from quay.io/crunchtools/sdlc and fails the job unless that digest equals the one it just tested. That is the same check the existing push and promote steps rely on, and none of these registry steps can run offline from a pull request, since PR runs have no Quay credentials by design.

Comment thread sdlc
GRYPE_DB = CACHE / "grype"


def t_scan_rootfs() -> int:

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): t_scan_rootfs adds a new external-tool integration with several important outcomes: it validates the mount and scan settings, constructs and runs the grype command, and translates grype exit codes into SDLC verdicts. The added tests cover scan planning, but do not exercise this function's command invocation or its success, finding, and cannot-run paths.

Suggestion: Add unit tests with a temporary /scan fixture and a stubbed run to check the command and environment, verify exit codes 0 and 2 map to the expected verdicts, and verify unexpected exits and invalid inputs are refused.

Evidence:

rc = run(cmd, env=env)[0]
if rc == 0:
    return CLEAN
if rc == 2:  # noqa: PLR2004 -- grype's own "above the threshold"
    return FOUND
cannot(
    f"grype could not scan the image (exit {rc}). Its vulnerability database is "

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 7fa3d8d
tests/test_plan.py now runs t_scan_rootfs against a fake grype and covers: grype 0 is clean, 2 is a finding, 1 is exit 2, the default --fail-on critical --only-fixed argv, the threshold override, an unknown severity, and an unwritable cache.

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 0323fca
This is the rebased form of 7fa3d8d. t_scan_rootfs is tested against a fake grype: 0 is clean, 2 is a finding, 1 is exit 2, plus the argv, the threshold override, an unknown severity, and an unwritable cache. tests/test_container_stack.sh (50416d5) also runs it for real in CI.

Comment thread sdlc Outdated
cmd.append("--only-fixed")
env = dict(os.environ)
env.update({"GRYPE_DB_CACHE_DIR": str(GRYPE_DB), "GRYPE_CHECK_FOR_APP_UPDATE": "false"})
GRYPE_DB.mkdir(parents=True, exist_ok=True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

HIGH (Constitution): The grype cache setup can fail with an uncaught filesystem error. If the cache is missing or unwritable, mkdir or opening the lock file raises an exception instead of returning the required exit code 2 for a check that could not run.

Suggestion: Catch filesystem errors from creating the cache directory and opening the lock file, and report them through cannot(...) so the check exits with 2.

Evidence:

GRYPE_DB.mkdir(parents=True, exist_ok=True)
step(...)
with (GRYPE_DB / ".lock").open("w") as lock:

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 7fa3d8d
The cache mkdir, the lock open and the flock are now wrapped in except OSError, which reports cannot-run (exit 2). A test points the cache at a path under a regular file and asserts it exits 2.

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 0323fca
This is the rebased form of 7fa3d8d. The grype cache operations report cannot-run (exit 2) on OSError, and a test asserts it. 36a89f9 then narrowed the handler to the cache alone.

@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 2 issues (1 medium, 1 low)

Reviewed 1 commit since 79513a6 (incremental).

2 finding(s) dropped: their evidence is not in the diff.

Comment thread sdlc
env = dict(os.environ)
env.update({"GRYPE_DB_CACHE_DIR": str(GRYPE_DB), "GRYPE_CHECK_FOR_APP_UPDATE": "false"})
step(f"grype, failing on a {'fixable ' if '--only-fixed' in cmd else ''}{fail_on} or worse")
try:

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 (Bug Hunter): The try block includes run(cmd, env=env), so an OSError launching Grype (for example, if the executable is missing) is reported as a database-cache failure. This misdirects troubleshooting for scan execution errors.

Suggestion: Limit the cache-specific handler to cache directory and lock operations, or use a separate error message for OSError raised while launching Grype.

Evidence:

try:
    GRYPE_DB.mkdir(parents=True, exist_ok=True)
    with (GRYPE_DB / ".lock").open("w") as lock:
        fcntl.flock(lock, fcntl.LOCK_EX)
        rc = run(cmd, env=env)[0]
except OSError as exc:
    cannot(f"cannot use grype's database cache at {GRYPE_DB}: {exc}")

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 36a89f9
The try now covers only the mkdir, the lock open and the flock. grype's launch sits outside it, where run() reports a missing or unexecutable binary in its own words.

Comment thread sdlc
env = dict(os.environ)
env.update({"GRYPE_DB_CACHE_DIR": str(GRYPE_DB), "GRYPE_CHECK_FOR_APP_UPDATE": "false"})
step(f"grype, failing on a {'fixable ' if '--only-fixed' in cmd else ''}{fail_on} or worse")
try:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LOW (General Review): The try block also covers run(cmd, env=env), so an OSError raised while starting Grype is reported as a database-cache failure. That attribution can mislead diagnosis of scan startup errors.

Suggestion: Limit this handler to cache setup and lock operations, or use an error message that distinguishes failures invoking Grype from failures accessing the cache.

Evidence:

try:
    GRYPE_DB.mkdir(parents=True, exist_ok=True)
    with (GRYPE_DB / ".lock").open("w") as lock:
        fcntl.flock(lock, fcntl.LOCK_EX)
        rc = run(cmd, env=env)[0]
except OSError as exc:
    cannot(f"cannot use grype's database cache at {GRYPE_DB}: {exc}")

The planner detects a repo's stacks from its files (pyproject.toml python,
Containerfile/Dockerfile container, package.json node, a bootc base bootc,
nothing docs) and runs each stack's checks plus the common ones. A repo may
add or drop a stack in [tool.sdlc], never name a command; a Python repo that
names neither key keeps the python stack alone, byte for byte.

The container stack: containerfile-lint (hadolint) in push and ci, and
container-build, container-smoke (a new host-up launcher mode: exits 0 or
still running after N seconds) and container-scan (grype over the built
image's rootfs via podman --mount type=image) in ci. sdlc.toml configures a
repo without a pyproject.toml. container.yml copies the tested digest to
quay.io/crunchtools/sdlc and promotes the same tags on both names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb
An unwritable grype cache and an sdlc.toml that is not UTF-8 escaped as
uncaught exceptions. Both are now cannot-run, and scan-rootfs's exit
translation (grype 0/2/1 -> 0/1/2) is tested against a fake grype.

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

@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 4 issues (3 medium, 1 low)

Full review.

2 finding(s) dropped: their evidence is not in the diff.

Comment thread bin/sdlc Outdated
printf '%s: podman run exited %s; nothing was judged\n' "$ME" "$_hrc" >&2
return 2 ;;
esac
if [ "$_hrc" -eq 255 ] && [ $(( $(now_s) - _ht0 )) -ge "$_up" ]; then

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 (Bug Hunter): The elapsed-time test uses integer-second timestamps, so a container that exits with 255 shortly after starting can be treated as having stayed up for the full timeout if it crosses a wall-clock second boundary. This can make a crashing image pass the smoke check.

Suggestion: Measure elapsed time with a monotonic sub-second clock, or otherwise distinguish Podman's timeout from a process that independently exits 255.

Evidence:

if [ "$_hrc" -eq 255 ] && [ $(( $(now_s) - _ht0 )) -ge "$_up" ]; then

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.

Not a bug: the window is real but bounded, and narrowing it would break the host contract. With whole-second timestamps, a crash only reads as "stayed up" if the image exits with exactly 255, and does so in the final second before seconds (by default between 9s and 10s after start). An exit at any earlier moment, or with any other status, is still a finding. A sub-second clock (date +%N) is GNU-only, and bin/sdlc must stay POSIX; tests/test_host_contract.sh enforces that.

skopeo copy --all --preserve-digests "docker://$REF" "docker://$QUAY:$1"
got=$(skopeo inspect --format '{{.Digest}}' "docker://$QUAY:$1")
[ "$got" = "$want" ] || { echo ":$1 resolves to $got, not the tested $want" >&2; exit 1; }
for repo in "$QUAY" "$SDLC"; do

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 (Bug Hunter): Promotion updates the two repositories sequentially. If copying or verifying the second repository fails after the first succeeds, the workflow exits with the tags pointing at different digests, contrary to the stated same-digest promotion behavior.

Suggestion: Handle partial promotion explicitly: on failure, retry or reconcile both repositories to the tested digest, and report the partial state so it cannot be mistaken for a completed promotion.

Evidence:

for repo in "$QUAY" "$SDLC"; do
  skopeo copy --all --preserve-digests "docker://$REF" "docker://$repo:$1"
  got=$(skopeo inspect --format '{{.Digest}}' "docker://$repo:$1")
  [ "$got" = "$want" ] || { echo "$repo:$1 resolves to $got, not the tested $want" >&2; exit 1; }
done

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.

Not a bug: no registry can move tags on two repositories atomically. What matters is that a split is loud and self-healing, and it is. Any copy or read-back that fails exits non-zero, so the job goes red. A rerun converges because skopeo copy --preserve-digests is idempotent and the backwards-move guard lets a tag that already holds this same commit through (current == GITHUB_SHA). Copying both names first and tagging second would not shrink the window, since tagging is itself the copy.

Comment thread sdlc
files = [found]
files = [in_repo("containerfile-lint", "containerfiles", f) for f in files]
cmd = ["hadolint", "--no-color"]
threshold = s.get("threshold")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LOW (Test Coverage): The hadolint threshold selection adds configuration behavior that is not covered by tests: the default warning threshold applies only when no hadolint config exists, while an explicit threshold should override that behavior. The contract tests exercise linting without a config, but do not verify either branch.

Suggestion: Add tests with a mocked hadolint invocation for the default threshold, a repo .hadolint.yaml or .hadolint.yml that suppresses the default, and an explicit threshold that takes precedence.

Evidence:

threshold = s.get("threshold")
if threshold is None and not any((REPO / c).is_file() for c in HADOLINT_CONFIGS):
    threshold = "warning"
if threshold is not None:
    ...
    cmd += ["--failure-threshold", str(threshold)]

Comment thread sdlc
if not isinstance(only_fixed, bool):
cannot(f"{name}: only_fixed must be true or false")
image = container_image(cfg, s)
argv = [

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 new container-scan path depends on Podman mounting the built image read-only and running the scanner with the configured host paths. Tests verify the planned argv, and scan_with tests t_scan_rootfs using a fake Grype executable, but no integration test exercises the Podman image-mount-and-scan path end to end.

Suggestion: Add an integration test using a locally built fixture image and Podman to exercise the image mount and scan invocation; the scanner can be stubbed if needed to keep vulnerability database behavior deterministic.

Evidence:

"--mount",
f"type=image,source={image},destination=/scan,rw=false",
...
"scan-rootfs",
]
return [host_step(name, argv)]

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 50416d5
New tests/test_container_stack.sh, run in CI as "Container stack end to end" against the freshly built image. It drives the real bin/sdlc and podman: a Containerfile-only repo's sdlc ci builds, smokes and scans through --mount type=image with grype (exit 0), and an image that dies on start fails container-smoke (exit 1).

tests/test_container_stack.sh runs the real launcher and podman against the
freshly built image: a Containerfile-only repo's `sdlc ci` builds, smokes and
scans a service image (exit 0), and an image that dies on start fails
container-smoke (exit 1). It proves the `--mount type=image` scan path, which
the planner's argv tests cannot.

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

@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 2 issues (1 medium, 1 low)

Reviewed 1 commit since 0323fca (incremental).

1 finding(s) dropped: their evidence is not in the diff.

Comment thread tests/test_container_stack.sh Outdated
fi

fixture crashes '["python3", "-c", "import missing_module"]'
(cd "$WORK/crashes" && SDLC_IMAGE=$IMAGE "$HERE/bin/sdlc" container-build) >/dev/null 2>&1 || :

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 test ignores a failure to build the crashing fixture, then treats any exit code 1 from container-smoke as proof that a successfully built image failed on startup. A build failure or missing image can therefore make this regression test pass without exercising the intended smoke-test failure path.

Suggestion: Check that container-build succeeds before running container-smoke; optionally also verify that the fixture image exists so the expected exit code is attributable to the crashing entrypoint.

Evidence:

(cd "$WORK/crashes" && SDLC_IMAGE=$IMAGE "$HERE/bin/sdlc" container-build) >/dev/null 2>&1 || :
rc=0
(cd "$WORK/crashes" && SDLC_IMAGE=$IMAGE "$HERE/bin/sdlc" container-smoke) > "$WORK/crashes.out" 2>&1 || rc=$?
if [ "$rc" -eq 1 ]; then

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 9e982f1
The crash case now fails if container-build does not exit 0. It passes only if container-smoke exits 1 and its output carries both the entrypoint's own No module named 'missing_module' and the launcher's "the container exited 1 within" line, so a missing image (podman 125, exit 2) cannot stand in for it.

Comment thread tests/test_container_stack.sh Outdated
fi

fixture crashes '["python3", "-c", "import missing_module"]'
(cd "$WORK/crashes" && SDLC_IMAGE=$IMAGE "$HERE/bin/sdlc" container-build) >/dev/null 2>&1 || :

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LOW (General Review): The build command’s output and exit status are both discarded. If the build fails, the following smoke test provides no context about that failure, making the test harder to diagnose.

Suggestion: Capture the build output and report it if the command fails, rather than redirecting it to /dev/null and ignoring its status.

Evidence:

(cd "$WORK/crashes" && SDLC_IMAGE=$IMAGE "$HERE/bin/sdlc" container-build) >/dev/null 2>&1 || :

The cache handler wrapped run() too, so a grype that could not start would
have been reported as a cache failure. run() already reports that itself.

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

@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 50416d5 (incremental).

A failed build or a missing image also makes container-smoke exit non-zero,
so the regression test now requires the build to succeed and the smoke
failure to carry the entrypoint's own error.

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

@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 36a89f9 (incremental).

CI publishes each pull request's tested image as
quay.io/crunchtools/sdlc:pr-<N>, and :beta when the PR has the `beta`
label; never latest, main or a version tag. The launcher runs one through
SDLC_IMAGE (a fleet tag or any reference) or [tool.sdlc] image = "<tag>"
(fleet tags only), prints which image it ran on every invocation that is not
the pinned release, and pulls a registry tag when newer.

container-scan names the gate image as `@sdlc-image`, which run_host
replaces, instead of the launcher passing SDLC_IMAGE into every container:
with no override the launcher's podman argv is byte-identical to main's.

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

@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 2 issues (1 high, 1 low)

Reviewed 1 commit since 9e982f1 (incremental).

6 finding(s) dropped: their evidence is not in the diff.

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

Comment thread .github/workflows/container.yml Outdated
run: |
set -eu
podman login -u "$QUAY_USERNAME" -p "$QUAY_PASSWORD" quay.io
podman push "localhost/python-sdlc:$GITHUB_SHA" "$SDLC:pr-$PR"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

HIGH (Constitution): The pull-request image is pushed and its digest is inspected, but the workflow does not run the required contract test against that pushed digest. The container-image profile requires testing the pushed digest, not only the locally built image tested earlier in the job.

Suggestion: After obtaining the digest, run the contract test against the image addressed by $SDLC@$digest and fail publication if that test fails.

Evidence:

podman push "localhost/python-sdlc:$GITHUB_SHA" "$SDLC:pr-$PR"
digest=$(skopeo inspect --format '{{.Digest}}' "docker://$SDLC:pr-$PR")
[ -n "$digest" ] || { echo "the registry reported no digest" >&2; exit 1; }

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 eccf58d
The publish step now runs tests/contract.sh "$SDLC@$digest" against the digest the registry reports for :pr-<N>. If that fails, the job fails before :beta can move onto the digest, and :beta is only copied from that same verified digest.

Comment thread sdlc
IMAGE_TAG_RE = re.compile(r"[A-Za-z0-9_][A-Za-z0-9._-]{0,127}")


def config_image(cfg: dict) -> None:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LOW (General Review): config_image depends on ambient SDLC_HOST_REPO and SDLC_CONFIG_IMAGE environment variables to decide whether and how to validate the launcher’s reading. That makes its behavior depend on how the caller was invoked, rather than just the configuration it appears to validate.

Suggestion: Pass the launcher-read value and whether launcher agreement is required as explicit arguments, keeping environment handling at the call boundary.

Evidence:

```python
def config_image(cfg: dict) -> None:
    if "image" not in cfg:
        seen = os.environ.get("SDLC_CONFIG_IMAGE")
        if "SDLC_HOST_REPO" in os.environ and seen:
            cannot(...)
        return
    ...
    if "SDLC_HOST_REPO" in os.environ and os.environ.get("SDLC_CONFIG_IMAGE") != tag:
        cannot(...)

<!-- gatehouse agent=general confidence=94 votes=1/1 -->

@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 08ed876 (incremental).

…state

- [tool.sdlc] image is refused (exit 2) under CI, GITHUB_ACTIONS and
  `sdlc ci`: a pull request must not choose the image that judges it, and
  only the launcher can hold that line.
- A pull request's image goes to quay.io/crunchtools/sdlc-pr, from a separate
  publish-pr job that runs none of the PR's code, with its own robot
  (QUAY_PR_USERNAME / QUAY_PR_PASSWORD, environment sdlc-pr). Pushed to a
  scratch tag, verified against the tested image ID, then tagged; a re-run of
  an older run never moves :pr-<N> or :beta back (run-id label). Bare
  pr-<N> and beta resolve to sdlc-pr.
- container-smoke starts detached and reads podman's State (Running,
  ExitCode, OOMKilled) instead of a clock; 126/127, an entrypoint that cannot
  start, is a finding, and only 125 is a 2.
- hadolint, grype and shellcheck images pinned by digest; actions pinned by
  commit SHA.

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

@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 low)

Reviewed 1 commit since eccf58d (incremental).

11 finding(s) dropped: their evidence is not in the diff.

Comment thread bin/sdlc
print v; exit
}' "$CONFIG_FILE"
}
fleet_tag() { # value where -> the image that tag names, or die

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LOW (General Review): fleet_tag no longer always returns a fleet-image reference: it routes beta and pr-* tags to the staging repository. The name obscures the function's current responsibility.

Suggestion: Rename it to something like image_for_tag or tag_image_ref to reflect that it selects the repository for a tag.

Evidence:

fleet_tag() {          # value where -> the image that tag names, or die
  case "$1" in
    ''|*[!A-Za-z0-9._-]*|[.-]*) die ... ;;
    beta|pr-[0-9]*) printf '%s:%s' "$STAGING_IMAGE" "$1" ;;
    *) printf '%s:%s' "$FLEET_IMAGE" "$1" ;;
  esac
}

Pull requests publish nothing: the publish-pr job, the sdlc-pr staging
resolution, the QUAY_PR_* secrets and the run-id label are gone, and the
pull_request trigger is back to its defaults. What has merged and not been
released is quay.io/crunchtools/sdlc:main, which promote already moves on
every push to main -- the digest verify-digest tested at :<sha>, read back
after the copy, never onto an older commit. SDLC_IMAGE=main runs it.
A release still moves :latest and the version tags. Seats iterate on local
builds, which are never pushed.

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

@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 06bba33 (incremental).

5 finding(s) dropped: their evidence is not in the diff.

Review a203. A repo-set image or tag reached the host's podman argv
unchecked, so `image = "--privileged"` with `args = ["-v", "/:/host"]` made
`sdlc ci` run a privileged, root-bound container on whoever ran it.

- The planner refuses any image or tag that is not an image reference
  (one strict regex, every kind and built-in check, pytest-in-image's
  pre-existing hole included); a repo path starting with `-` likewise.
- Smoke and scan put the image after `--`; bin/sdlc re-checks that word on
  the host for every run, and a host-up run without `--` is refused.
- The comma that could rewrite `--mount type=image,source=...` is refused
  by the same check.
- The promote guard reads a tag's revision fail-closed: only "manifest
  unknown" means absent; auth or network errors stop the job.

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

@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 3 issues (1 medium, 2 low)

Reviewed 1 commit since daa02d5 (incremental).

2 finding(s) dropped: their evidence is not in the diff.

Comment thread .github/workflows/container.yml Outdated
# exist yet. Anything else -- auth, network, a registry error --
# stops the job: a guard that cannot read what it guards would
# otherwise wave the move through.
revision_of() {

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 new revision_of function has distinct outcomes for a readable tag, manifest unknown, and other inspection failures, but the added tests do not exercise this workflow guard. In particular, there is no test showing that an inspection error other than a missing manifest stops promotion.

Suggestion: Add a focused test with a stubbed skopeo inspect that covers a successful revision lookup, manifest unknown, and an authentication or network failure; assert that only the missing-manifest case is treated as an absent tag.

Evidence:

revision_of() {
  if out=$(skopeo inspect ...); then
    printf '%s' "$out"
  elif grep -qi 'manifest unknown' "$RUNNER_TEMP/inspect.err"; then
    :
  else
    ...
    exit 1
  fi
}

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 aa57a90
The guard is now scripts/revision-of.sh, which promote calls. tests/test_revision_of.sh runs in CI's shell-checks step against a fake skopeo and asserts:

  • a readable tag prints its revision;
  • "manifest unknown" prints nothing and exits 0;
  • an auth failure and a network failure each exit non-zero, so promotion stops.

Comment thread sdlc
rel = str(target.relative_to(REPO.resolve())) or "."
# A path is a positional word in a podman argv, so one podman would read as
# an option is refused like any other path it should not be given.
if rel.startswith("-"):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LOW (Test Coverage): The new in_repo boundary rejects repository-relative paths beginning with -, but the added tests do not cover that case. This is a distinct path-validation rule intended to prevent a path from being interpreted as a podman option.

Suggestion: Add a test using an existing repository-relative path whose name begins with - and assert that planning refuses it.

Evidence:

if rel.startswith("-"):
    cannot(f"{name}: {key} {text!r} begins with '-', which podman would read as an option")

Comment thread sdlc
)


def image_ref(name: str, key: str, value: object) -> str:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LOW (Test Coverage): image_ref explicitly rejects non-string values, but the added injection tests supply only strings. The type check is a separate validation condition and is not covered by the valid/invalid string cases.

Suggestion: Add a planner test with a non-string TOML value, such as an integer tag or image, and assert that it is refused with the image-reference error.

Evidence:

text = str(value)
if not isinstance(value, str) or not IMAGE_REF_RE.fullmatch(text):
    cannot(...)

scripts/revision-of.sh replaces the inline revision_of in container.yml.
tests/test_revision_of.sh runs it against a fake skopeo: a readable tag
prints its revision, "manifest unknown" is an absent tag, and an auth or
network failure exits non-zero, so the guard fails closed.

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

@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 d820756 (incremental).

@fatherlinux
fatherlinux merged commit ab4117e into main Nov 17, 2026
16 checks passed
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.

2 participants