Repository navigation
feat: the image ships its launcher, so a repo pins nothing - #62
Conversation
The launcher (bin/sdlc) now rides in quay.io/crunchtools/sdlc and the image
prints it with `sdlc launcher <ref>`, the ref written into it. A repo carries
bin/sdlc-bootstrap as .sdlc/bin/sdlc: it pulls sdlc:${SDLC_IMAGE:-latest}
when newer, asks it for the launcher and runs it, so hooks and CI float with
the image and a release needs no bump PRs. The CI job keeps the name
`sdlc ci`; a repo opts its CI into :main with the repository variable
SDLC_IMAGE.
scripts/convert_repo.py converts one checkout to that form, deterministically,
printing the diff and writing nothing without --apply.
With no LAUNCHED_FROM, the launcher is unchanged: a rev-pinned repo runs
exactly what it ran before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb
…fuse links A workflow counts as covered only when every job is exactly what examples/ci.yml carries -- the checkout and the `sdlc ci` step, or the Gourmand call -- so a job with another step, an env or a service keeps its place and has only its step floated. Symlinked targets are refused, at plan time and again at --apply. YAML that does not parse is a refusal naming the file, not a traceback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb
| continue | ||
| parsed = parse(path.name, path.read_text()) | ||
| jobs = list(jobs_of(parsed).values()) | ||
| whole = set(parsed) <= COVERED_WORKFLOW_KEYS |
There was a problem hiding this comment.
HIGH (Bug Hunter): The workflow is considered replaceable based only on which top-level keys it has, not their values. A covered workflow triggered by schedule, release events, or custom branches can therefore be replaced with examples/ci.yml and silently lose its original triggers. Custom workflow-level permissions can also be replaced.
Suggestion: Before replacing a workflow, verify its trigger and permission values match the stub’s behavior; otherwise keep the workflow and convert only its sdlc ci step.
Evidence:
whole = set(parsed) <= COVERED_WORKFLOW_KEYS
if jobs and whole and all(is_covered_job(j) for j in jobs):
covered.append(path)
There was a problem hiding this comment.
Fixed in ab19d5a
is_covered_workflow now also checks the trigger values. Only push to main/master and pull requests (filtered at most to those branches) count as covered. Permissions must be contents: read at both the workflow and the job level. Anything else keeps the workflow, and only its sdlc ci step floats.
| # and steps that are only the checkout and the `sdlc ci` step. Anything more -- | ||
| # another step, a service, an env, a matrix -- is something ci.yml would | ||
| # drop, so that workflow keeps its place and only its step is rewritten. | ||
| COVERED_SDLC_KEYS = {"name", "runs-on", "steps", "permissions"} |
There was a problem hiding this comment.
MEDIUM (Test Coverage): The conversion tests do not cover workflows or jobs with non-template permission values. permissions is allowed by the coverage checks based only on the key being present, so a workflow can be classified as fully replaceable even when replacing it with examples/ci.yml changes its permissions. Add a regression test to establish that such workflows are preserved or refused rather than silently replaced.
Suggestion: Add fixtures with workflow-level and job-level permissions that differ from the CI template, then assert conversion preserves the original workflow behavior or refuses conversion without writing changes.
Evidence:
COVERED_SDLC_KEYS = {"name", "runs-on", "steps", "permissions"}
COVERED_WORKFLOW_KEYS = {"name", True, "on", "permissions", "jobs"} # YAML 1.1 reads on: as True
...
whole = set(parsed) <= COVERED_WORKFLOW_KEYS
if jobs and whole and all(is_covered_job(j) for j in jobs):
covered.append(path)
There was a problem hiding this comment.
Fixed in ab19d5a
tests/test_convert_repo.py adds five cases: a schedule, a push to another branch, a path filter, workflow-level contents: write and job-level packages: write. In each one the workflow is kept with that setting intact and its step is floated in place.
| agent = "constitution" | ||
| category = "constitution" | ||
| file = "bin/sdlc-bootstrap" | ||
| evidence = "image=${SDLC_IMAGE:-latest}\ncase $image in\n */*) ;;\n *) image=quay.io/crunchtools/sdlc:$image ;;" |
There was a problem hiding this comment.
MEDIUM (Ledger): This branch silences a constitution finding in bin/sdlc-bootstrap as not-a-bug: Floating on :latest is the decision this file implements, not a slip: the fleet operator decided (a206) that nothing in a repo pins the launcher any more and that it floats with :latest exactly as the tools already do, so the conversion is the last fleet-wide pull-request wave. The pin moves from each repo to the release gate: only a tagged, contract-tested release moves :latest (container.yml promote), it never moves backwards, and a repo can hold a release back with the repository variable SDLC_IMAGE. The constitution's XII wording still describes the rev pin; amending it is the constitution repo's change, flagged with this work rather than made here.
Suggestion: Confirm the judgement is right, or drop the entry and fix the finding. The entry stops applying on its own once the code it quotes is gone.
Evidence:
image=${SDLC_IMAGE:-latest}
case $image in
*/*) ;;
*) image=quay.io/crunchtools/sdlc:$image ;;
There was a problem hiding this comment.
Not a bug: the judgement stands. Floating on :latest is the operator's explicit a206 decision this PR implements; the pin moves to the release gate (only a tested tag moves :latest, never backwards) and SDLC_IMAGE can hold a repo back. The XII amendment belongs to the constitution repo and is flagged in the PR body.
…leak Every image that declares VOLUME left an anonymous volume per smoke run; a fleet measurement filled a seat's disk with 13 GB of them. The host contract asserts every cleanup carries -v, and the container stack test runs a VOLUME image through real podman and checks nothing is left. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb
There was a problem hiding this comment.
Gatehouse found 2 issues (1 critical, 1 medium)
Reviewed 1 commit since 22f2a08 (incremental).
| podman rm -f "$_cname" >/dev/null 2>&1 || : | ||
| podman rm -f -v "$_cname" >/dev/null 2>&1 || : | ||
| printf '%s: the image could not start its entrypoint (exit %s)\n' "$ME" "$_uprc" >&2 | ||
| return 1 ;; |
There was a problem hiding this comment.
CRITICAL (Constitution): The smoke path returns 1 for container startup failures such as exit 126 or 127. The constitution requires these cases to return 2 because the check could not run, not 1 as though it found a problem.
Suggestion: Return 2 when the container never starts, including exits 126 and 127; reserve 1 for a completed check that reports a failure.
Evidence:
*) podman logs "$_cname" 2>&1 || :
podman rm -f -v "$_cname" >/dev/null 2>&1 || :
printf '%s: the image could not start its entrypoint (exit %s)\n' "$ME" "$_uprc" >&2
return 1 ;;
There was a problem hiding this comment.
Not a bug: in container-smoke, 126/127 come from the image under test. Its entrypoint is missing or not executable, which is the defect the smoke run exists to find, so it is reported as 1. Exit 125, podman itself failing to create the container, is the could-not-run case and maps to 2 at line 601. This was shipped and reviewed in 0.8.0 and is pinned by tests/test_container_stack.sh ("a missing entrypoint fails container-smoke (exit 1)"). This PR only adds -v to the cleanup line.
| agent = "constitution" | ||
| category = "constitution" | ||
| file = "bin/sdlc-bootstrap" | ||
| evidence = "image=${SDLC_IMAGE:-latest}\ncase $image in\n */*) ;;\n *) image=quay.io/crunchtools/sdlc:$image ;;" |
There was a problem hiding this comment.
MEDIUM (Ledger): This branch silences a constitution finding in bin/sdlc-bootstrap as not-a-bug: Floating on :latest is the decision this file implements, not a slip: the fleet operator decided (a206) that nothing in a repo pins the launcher any more and that it floats with :latest exactly as the tools already do, so the conversion is the last fleet-wide pull-request wave. The pin moves from each repo to the release gate: only a tagged, contract-tested release moves :latest (container.yml promote), it never moves backwards, and a repo can hold a release back with the repository variable SDLC_IMAGE. The constitution's XII wording still describes the rev pin; amending it is the constitution repo's change, flagged with this work rather than made here.
Suggestion: Confirm the judgement is right, or drop the entry and fix the finding. The entry stops applying on its own once the code it quotes is gone.
Evidence:
image=${SDLC_IMAGE:-latest}
case $image in
*/*) ;;
*) image=quay.io/crunchtools/sdlc:$image ;;
There was a problem hiding this comment.
Not a bug: the same ledger entry as the earlier thread, and the judgement stands. Floating on :latest is the operator's explicit a206 decision this PR implements. The pin moves to the release gate, and the XII amendment is flagged for the constitution repo.
A workflow counts as covered only when its triggers are ones examples/ci.yml answers (push to main or master, pull requests, at most limited to those branches) and its permissions are contents: read. A schedule, a release branch, a path filter or other permissions keep the workflow; only its `sdlc ci` step floats. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb
There was a problem hiding this comment.
Gatehouse found no issues.
Reviewed 1 commit since 03baade (incremental).
7 finding(s) dropped: their evidence is not in the diff.
1 finding(s) not re-raised: already answered on this PR.
Review of #62 at ab19d5a (a211, Max seat)Verdict: 3 blocking, all in What I ran
Blocking
Security (asked about specifically): no blocker
Exit codes0/1/2 hold through the bootstrap: mktemp, pull, A broken
|
…onventions Without a .hadolint.yaml, containerfile-lint now fails at `error` and ignores DL3007 (floating base tags, rebuilt weekly on purpose) and DL3041 (unpinned dnf packages). Warnings such as DL3002 are printed and do not fail. A repo's .hadolint.yaml replaces all of it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb
An image whose PID 1 is systemd (/sbin/init, systemd: ubi-init, bootc) cannot boot under the smoke run's lockdown. The launcher reads the entrypoint, the run's argument or the CMD from podman, and reports status 4: printed as "SKIPPED, not judged" with the reason, never "passed", and never the command's exit. Build and scan still run. Only host-up may skip; a 4 from a tool in the image stays a finding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb
…fore writing From the #62 review: - A converted repo that kept other hooks is recognised as floating, so a second run exits 0 and changes nothing. - default_install_hook_types written in block style is replaced whole, items and all, instead of leaving them under the new line. - The key goes in by line, above `repos:`, so a comment that says `repos:` is left alone. Every YAML file the conversion would write is parsed back and held to the wiring -- both hook types, the floating hooks and nothing they replace, the bootstrap, a job named `sdlc ci` running .sdlc/bin/sdlc ci -- and anything else is refused with exit 2 before a file is written. Applied to the 63 convertible clones and run again, every second run is empty. README: "When :latest is broken". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb
There was a problem hiding this comment.
Gatehouse found 1 issues (1 critical)
Reviewed 3 commits since ab19d5a (incremental).
12 finding(s) dropped: their evidence is not in the diff.
1 finding(s) not re-raised: already answered on this PR.
| # this run withholds on purpose, so it dies whatever the image is like. That | ||
| # is not judged: 4 is SKIPPED, printed as such, and never a pass. The build | ||
| # and the scan are separate checks and still run. | ||
| _pid1=$(pid1_of "$@") |
There was a problem hiding this comment.
CRITICAL (Constitution): A systemd smoke check that cannot run returns 4 and is recorded as SKIPPED rather than as exit 2. The constitution says anything other than the tool's own verdict is 2 and explicitly prohibits working around 2; a check that cannot boot the image has not run and must not be reported as a non-failing skip.
Suggestion: Return 2 when the smoke check cannot run under the available privileges, and ensure the check and command report that inability rather than treating it as a skip.
Evidence:
case "$_pid1" in
/sbin/init|/usr/sbin/init|/lib/systemd/systemd|/usr/lib/systemd/systemd|init|systemd)
printf '%s: SKIPPED: the image starts %s as PID 1, and systemd PID 1 needs privileges smoke cannot grant\n' \
"$ME" "$_pid1" >&2
return 4 ;;
There was a problem hiding this comment.
Not a bug: this skip is the operator's explicit a206 decision. The decision was that a systemd PID 1 skips container-smoke with the visible reason "systemd PID 1 needs privileges smoke can't grant", and must not pass silently. It doesn't. The output says SKIPPED, not judged. It never prints "passed". The record carries 4. Build and scan still judge the image.
A 2 here would leave every ubi-init/bootc repo permanently red over a run we lock down on purpose, which is the "worked around" outcome XII warns about. Only host-up can produce a 4. A 4 from any tool inside the image is still mapped to a finding, and test_host_contract.sh covers that ("a 4 from a check in the image is a finding, not a skip").
…tover revs From a211's review of #62: - A Gourmand job is covered only under its required check name. - An sdlc ci step with any env but SDLC_IMAGE is not replaced. - A mixed workflow on pull_request_target or workflow_run is refused: the bootstrap comes from the checkout, so floating it there would run a pull request's code with secrets. - A plan whose surviving workflows still clone python-sdlc by the removed rev is refused, nothing written. README says what floating trusts (whoever moves :latest; signing is the follow-up) and that the SDLC_IMAGE variable is an admin setting, not a wall against a pull request editing its own workflows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb
|
Replies to the a211 review. Everything below landed as new commits, nothing rewritten. Blocking
Nits (fixed in 3947763)
The hadolint defaults are in 1fafd32 and the systemd smoke skip is in 1f333f9. |
There was a problem hiding this comment.
Gatehouse found 1 issues (1 critical)
Reviewed 1 commit since 6f17196 (incremental).
3 finding(s) dropped: their evidence is not in the diff.
1 finding(s) not re-raised: already answered on this PR.
| GOURMAND_JOB_NAME = "Code Quality (Gourmand)" # a required check: never renamed by this | ||
| # Events that run with secrets on code a pull request controls. The bootstrap | ||
| # now comes from the checkout, so a step running it there would run PR code. | ||
| PRIVILEGED_EVENTS = {"pull_request_target", "workflow_run"} |
There was a problem hiding this comment.
CRITICAL (Security Scan): The converter treats only pull_request_target and workflow_run as privileged events. It can therefore convert a mixed workflow triggered by events such as issue_comment or pull_request_review_comment, which can run with repository secrets. If such a workflow checks out a pull request's head, the converted sdlc ci step runs the pull request's .sdlc/bin/sdlc with those secrets, allowing untrusted PR code to expose them.
Suggestion: Before floating the step, conservatively refuse all events that can run with secrets on pull-request-controlled code, including comment and review events, or inspect the workflow's checkout configuration and reject any path that can execute a PR head with secrets.
Evidence:
PRIVILEGED_EVENTS = {"pull_request_target", "workflow_run"}
There was a problem hiding this comment.
Fixed in a483867
The denylist is now an allowlist. A shared sdlc ci step floats only when every event in its workflow is push, pull_request, workflow_dispatch, schedule or merge_group. Any other event is refused, including events GitHub adds later. Tests cover pull_request_target, workflow_run, issue_comment and pull_request_review. The fleet dry run is unchanged at 63 converted and 14 refused.
…X.Y.Z or a digest The bootstrap runs whatever it pulls, so SDLC_IMAGE may now name only the fleet image -- bare or in full -- at main, latest, a release X.Y.Z or @sha256:<64 hex>. Anything else exits 2 with the accepted forms, before podman runs. The launcher is handed the checked full reference. A seat trying a local build runs a python-sdlc clone's bin/sdlc, which still takes one. This is the bootstrap the constitution pins by sha256; keep it stable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb
There was a problem hiding this comment.
Gatehouse found 1 issues (1 medium)
Reviewed 1 commit since 3947763 (incremental).
1 finding(s) not re-raised: already answered on this PR.
|
|
||
| # The value, with the repository named in full or not at all. | ||
| want=${SDLC_IMAGE:-latest} | ||
| want=${want#"$FLEET"} |
There was a problem hiding this comment.
MEDIUM (Bug Hunter): The repository prefix is stripped without checking that it is followed by : or @. As a result, SDLC_IMAGE=quay.io/crunchtools/sdlc1.2.3 is accepted as version 1.2.3 and pulls quay.io/crunchtools/sdlc:1.2.3, instead of refusing the malformed reference as documented.
Suggestion: After removing the repository prefix, require the remaining value to start with : or @ before stripping the separator and validating the tag or digest.
Evidence:
want=${want#"$FLEET"}
want=${want#:}
There was a problem hiding this comment.
Fixed in a483867
The fleet prefix is stripped only when : or @ follows it. quay.io/crunchtools/sdlcmain and quay.io/crunchtools/sdlc1.2.3 are now refused with exit 2 before podman runs, and both are cases in tests/test_host_contract.sh.
…ed events bin/sdlc-bootstrap strips quay.io/crunchtools/sdlc only when `:` or `@` follows, so `quay.io/crunchtools/sdlcmain` is refused, not read as main. convert_repo.py floats a shared `sdlc ci` step only in a workflow whose events are all push, pull_request, workflow_dispatch, schedule or merge_group. Any other event -- pull_request_target, workflow_run, issue_comment, and whatever GitHub adds -- is refused, since the bootstrap now comes from the checkout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb
There was a problem hiding this comment.
Gatehouse found no issues.
Reviewed 1 commit since 902228b (incremental).
1 finding(s) not re-raised: already answered on this PR.
Re-review at a483867 (a211): approveThe three blockers are closed. I re-ran my repros with Exit 4 can't be faked by anything else. In The one way to opt in is legitimate and shows in the log: a repo whose The image allowlist holds. I ran the bootstrap against a stub podman with 21 values:
Passing the checked full ref to the launcher as The converter's event check is an allowlist, not a denylist. That's the right way round. Fleet dry-run is unchanged. On mcp-pcloud, deployer, mcp-gitlab, mcp-cloudflare, acquacotta and rotv, the diff differs from my first pass only in the updated template comments. gatehouse still refuses. hadolint looks right. The No further blockers. |
What
A repo stops pinning python-sdlc. The image carries its own launcher and prints it. Hooks and CI fetch it and run it, so they float with
quay.io/crunchtools/sdlc:latestexactly as the tools in the image do. That makes the conversion the last fleet-wide PR wave.bin/sdlcis copied to/usr/share/sdlc/launcher.sdlc launcher <ref>prints it withLAUNCHED_FROM='<ref>'written in. The ref is validated byIMAGE_REF_RE, and anything else exits 2. WithLAUNCHED_FROMempty (a rev-pinned clone), the launcher is unchanged: same default image, same argv, same banner.bin/sdlc-bootstrap, committed in a converted repo as.sdlc/bin/sdlc. It pullssdlc:${SDLC_IMAGE:-latest}when newer (--network=none --cap-drop=all) and asks the image for the launcher. It writes the launcher to a temp file (never a pipe intosh) and runs it. An image that cannot print one is a 2.SDLC_IMAGE=main, a release tag and a fulllocalhost/ref all work.examples/pre-commit-floating.yaml) isrepo: local,language: system,entry: .sdlc/bin/sdlc commit|push, with norev:. The validator's host-contract check allows a path to a script in the repo. It rejects an inlinesh -cbootstrap because it readscaseand$las host programs, which is why the bootstrap is a file.examples/ci.yml) keeps the job namesdlc ci. Its step isrun: .sdlc/bin/sdlc ci, plus the Gourmand job.SDLC_IMAGEcomes from the repository variable, so a repo opts into:mainwithout a PR choosing its own judge.scripts/convert_repo.py <checkout> [--apply]is deterministic and uses no LLM. It prints a unified diff and writes nothing without--apply.sdlc cistep in place to the floating form.gatehouse.ymlfromexamples/gatehouse.yml(gatehouse@1aea583) when the two differ only in comments.quay.io/crunchtools/python-sdlcrefs toquay.io/crunchtools/sdlcand keeps everything else..specify/and refuses symlinked targets./usr/bin/sdlc. Nothing in a repo changes when it lands. The RPM never needs a release of its own, because the launcher it fetches floats.Fleet dry run over 77 local clones: 63 convert, and 14 refuse with a reason.
ci.ymlwith unrelated jobs, gatehouse has a non-standard step, and seven have hooks the script does not recognise.Pilots
These ran the converted repo's own CI step and commit hook against this branch's image built locally, as
SDLC_IMAGE=localhost/sdlc:floating.:mainhas nolaunchercommand until this merges, soSDLC_IMAGE=maincannot run yet.sdlc ciEach diff:
.sdlc/bin/sdlc.pre-commit-config.yamlwith the floating exampleci.ymlthe stub (created new in syslog)gourmand.yml, which the stub now covers (josui, syslog)gatehouse.ymlcommentsIt keeps ashigaru, constitution, dependabot-automerge and gatehouse-retriage, and also container, publish and security in mcp-nagios and container in syslog. The script is deterministic, so
scripts/convert_repo.py <clone at that commit>reproduces each diff exactly.None of the failures come from the conversion:
check_sdlc_wiring) for Python repos, and the standalonegourmand/gatehousehooks (check_standalone_hooks) for other repos. A converted repo fails both until the constitution accepts the floating form. That change belongs in the constitution repo, not here.warningflags fleet conventions: DL3007 (:latest), DL3041 (unpinned dnf) and DL3002. Every container repo will need a.hadolint.yamlor a threshold, or the default has to change.stacks = ["python", "container"].Tests
tests/test_convert_repo.pyis new and runs in CI's unit loop.tests/test_plan.pyhas new launcher cases.tests/test_host_contract.shhas bootstrap and floating cases. The host contract holds: podman and POSIX sh only.tests/contract.shchecks that the image prints this commit'sbin/sdlcand carries this commit's bootstrap.🤖 Generated with Claude Code
https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb