Skip to content

feat: the image ships its launcher, so a repo pins nothing - #62

Merged
fatherlinux merged 11 commits into
mainfrom
feat/floating-launcher
Nov 17, 2026
Merged

fatherlinux merged 11 commits into
mainfrom
feat/floating-launcher

Conversation

@fatherlinux

Copy link
Copy Markdown
Member

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:latest exactly as the tools in the image do. That makes the conversion the last fleet-wide PR wave.

  • The image ships the launcher. bin/sdlc is copied to /usr/share/sdlc/launcher. sdlc launcher <ref> prints it with LAUNCHED_FROM='<ref>' written in. The ref is validated by IMAGE_REF_RE, and anything else exits 2. With LAUNCHED_FROM empty (a rev-pinned clone), the launcher is unchanged: same default image, same argv, same banner.
  • The bootstrap is bin/sdlc-bootstrap, committed in a converted repo as .sdlc/bin/sdlc. It pulls sdlc:${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 into sh) and runs it. An image that cannot print one is a 2. SDLC_IMAGE=main, a release tag and a full localhost/ ref all work.
  • The hook form (examples/pre-commit-floating.yaml) is repo: local, language: system, entry: .sdlc/bin/sdlc commit|push, with no rev:. The validator's host-contract check allows a path to a script in the repo. It rejects an inline sh -c bootstrap because it reads case and $l as host programs, which is why the bootstrap is a file.
  • The CI stub (examples/ci.yml) keeps the job name sdlc ci. Its step is run: .sdlc/bin/sdlc ci, plus the Gourmand job. SDLC_IMAGE comes from the repository variable, so a repo opts into :main without 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.
    • It replaces the rev-pinned or standalone hooks.
    • It replaces a workflow only when every job in it is exactly what the stub carries. Otherwise it rewrites the sdlc ci step in place to the floating form.
    • It refreshes gatehouse.yml from examples/gatehouse.yml (gatehouse@1aea583) when the two differ only in comments.
    • It moves quay.io/crunchtools/python-sdlc refs to quay.io/crunchtools/sdlc and keeps everything else.
    • It never touches .specify/ and refuses symlinked targets.
    • It exits 2 on any shape it would have to guess at.
  • RPM, later: it installs the same bootstrap as /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.

  • Of the 63, six rewrite the step in place: acquacotta, ashigaru, claude-agent, constitution, rotv, trentina.
  • Of the 14, six have a ci.yml with 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. :main has no launcher command until this merges, so SDLC_IMAGE=main cannot run yet.

pilot @ commit shape diff sdlc ci failing with those skipped commit hook
josui @ 97514e8 python-only +107/-44 1 constitution 0 0
mcp-nagios @ 1b31d75 python + container +104/-34 1 constitution 0 0
syslog @ 017b592 container-only +124/-26 1 constitution, containerfile-lint 0 (build, smoke and scan pass) 0

Each diff:

  • writes .sdlc/bin/sdlc
  • replaces .pre-commit-config.yaml with the floating example
  • makes ci.yml the stub (created new in syslog)
  • deletes gourmand.yml, which the stub now covers (josui, syslog)
  • refreshes gatehouse.yml comments

It 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:

  • constitution: XII still requires the rev pin (check_sdlc_wiring) for Python repos, and the standalone gourmand/gatehouse hooks (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.
  • containerfile-lint: hadolint at warning flags fleet conventions: DL3007 (:latest), DL3041 (unpinned dnf) and DL3002. Every container repo will need a .hadolint.yaml or a threshold, or the default has to change.
  • mcp-nagios runs the python stack only. A Python repo that names no stacks keeps COMPAT, so its container checks need stacks = ["python", "container"].

Tests

  • tests/test_convert_repo.py is new and runs in CI's unit loop.
  • tests/test_plan.py has new launcher cases.
  • tests/test_host_contract.sh has bootstrap and floating cases. The host contract holds: podman and POSIX sh only.
  • tests/contract.sh checks that the image prints this commit's bin/sdlc and carries this commit's bootstrap.

🤖 Generated with Claude Code

https://claude.ai/code/session_01R7Y1jckWHhAgXg2WBwkWbb

Josui and others added 3 commits November 17, 2026 20:22
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

@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 high, 2 medium)

Full review.

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

1 finding(s) not raised: already judged in gatehouse-findings.toml on this branch.

Comment thread scripts/convert_repo.py Outdated
continue
parsed = parse(path.name, path.read_text())
jobs = list(jobs_of(parsed).values())
whole = set(parsed) <= COVERED_WORKFLOW_KEYS

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 (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)

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 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.

Comment thread scripts/convert_repo.py
# 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"}

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

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 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.

Comment thread gatehouse-findings.toml
agent = "constitution"
category = "constitution"
file = "bin/sdlc-bootstrap"
evidence = "image=${SDLC_IMAGE:-latest}\ncase $image in\n */*) ;;\n *) image=quay.io/crunchtools/sdlc:$image ;;"

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 (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 ;;

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 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

@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 critical, 1 medium)

Reviewed 1 commit since 22f2a08 (incremental).

Comment thread bin/sdlc
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 ;;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 ;;

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: 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.

Comment thread gatehouse-findings.toml
agent = "constitution"
category = "constitution"
file = "bin/sdlc-bootstrap"
evidence = "image=${SDLC_IMAGE:-latest}\ncase $image in\n */*) ;;\n *) image=quay.io/crunchtools/sdlc:$image ;;"

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 (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 ;;

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 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

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

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

1 finding(s) not re-raised: already answered on this PR.

@fatherlinux

Copy link
Copy Markdown
Member Author

Review of #62 at ab19d5a (a211, Max seat)

Verdict: 3 blocking, all in scripts/convert_repo.py and all cheap to fix. The bootstrap and launcher are sound. I posted this as a comment because this seat has no review tool.

What I ran

  • tests/test_convert_repo.py, tests/test_plan.py and tests/test_host_contract.sh all pass.
  • Converter dry-runs on fresh clones of repos the PR didn't pilot:
    • mcp-pcloud, deployer, mcp-gitlab and mcp-cloudflare: ci.yml replaced; publish, container and security kept.
    • acquacotta and rotv: floated in place. rotv is a master-branch repo.
    • gatehouse: refused with exit 2 (non-standard step), as the PR says.
  • None of the surviving workflows still reads the removed rev or depends on a replaced workflow's name.

Blocking

  1. Not idempotent once a repo keeps other hooks. Converting a hooks file with ruff plus the python-sdlc pin works. A second run on the result exits 2: already has local sdlc hooks that are not the floating form. The "second run finds nothing to do" tests only cover the pure-template case, where text == template short-circuits. In a re-sweep, every already-converted repo with extra hooks shows up as a refusal. Fix: in refuse_hooks/convert_hooks, accept a repo: local item whose sdlc hooks are exactly floating_hooks_item(), and return the text unchanged.

  2. Block-style default_install_hook_types gives invalid YAML with exit 0.

    default_install_hook_types:
      - pre-commit
      - pre-push

    The re.sub swaps only the first line and leaves the list items hanging. --apply writes a file pre-commit can't load, and the next run refuses it as "not YAML".

  3. head.replace("repos:", ...) hits the first occurrence of repos: in the header, comments included. With # Pinned hooks; the repos: list below ..., the comment becomes # Pinned hooks; the default_install_hook_types: [...]\n\nrepos: list below ..., followed by a second real repos:. Fix it at line start, not by string replace.

    For 2 and 3, and anything like them: before returning, yaml.safe_load the converted hooks text. Assert that it has repos, contains the two floating hooks, and that default_install_hook_types equals [pre-commit, pre-push]. Otherwise raise RefusedError. The script's contract is "exit 2 on any shape it would have to guess at". Here it guessed wrong and exited 0.

Security (asked about specifically): no blocker

  • Temp file: mktemp -d, the trap on EXIT, sh file rather than a pipe, and the -s check are all correct. The exit status survives the EXIT trap. A truncated or garbled launcher fails as an sh syntax error with exit 2. bin/sdlc never re-reads $0 in floating mode, so the temp path doesn't matter.
  • SDLC_IMAGE injection: the raw value goes after -- as one argv word, so it can't be read as a podman option. IMAGE_REF_RE rejects quotes before the value is spliced into the launcher, and contract.sh tests x'; id; '. That's good.
  • Poisoned tag: whoever can push :latest now runs code on every seat and runner host. Before, that power was mostly the same in kind, because the image already got an rw repo mount on some steps and could plant .git/hooks. What's lost is that the host-side code is no longer reviewable in git at a pinned rev. That's an acceptable trade, but say it in the README. A follow-up worth doing is signature verification (a policy.json/sigstore entry for quay.io/crunchtools/sdlc).
  • "A PR can't choose its judge" is overstated. Under pull_request, the PR controls both .sdlc/bin/sdlc and ci.yml, so it can change what runs. That was already true before this PR. The variable only stops a legitimate-looking one-line change. If you want the claim to hold, use an org ruleset required workflow. Either way, reword it.

Exit codes

0/1/2 hold through the bootstrap: mktemp, pull, launcher refusal and an empty launcher are all 2, the launcher's own status passes through, and a signal gives 2.

A broken :latest (not blocking, but do this before the wave)

These escapes exist: git commit --no-verify, SDLC_IMAGE=<tag> on a seat, and in CI an org-level SDLC_IMAGE variable, which vars. picks up for all 63 repos at once. But:

  • No image up to 0.8.0 has launcher, so until there are two releases carrying it, SDLC_IMAGE=<previous> has nothing to fall back to. Fixing a bad first release takes a whole new release while every CI run stays red.
  • The README doesn't tell anyone any of this. Add a short ":latest is broken" section: org variable, --no-verify, and how latest gets moved back.

Nits

  • A Gourmand job is "covered" without its name: being compared to the stub's Code Quality (Gourmand). That's fine across the fleet today. A renamed one would silently change the required check name, so compare it.
  • is_covered_step allows env: on the old step and the replacement drops it. Either require that env to be empty or carry it over.
  • float_sdlc_step rewrites a mixed workflow whatever its trigger. Refuse pull_request_target/workflow_run there: with the bootstrap now coming from the PR tree, that combination would run PR code with secrets. No current fleet workflow has it.
  • If no workflow names the job sdlc ci but one still clones python-sdlc by the rev in .pre-commit-config.yaml, conversion breaks it: the rev is gone, so it exits 2 forever. Guard: refuse when any surviving file still matches the PINNED_STEP awk or github.com/crunchtools/python-sdlc.
  • On a seat, [tool.sdlc] image = "main" makes the launcher from :latest start :main. That breaks the "launcher and image cannot disagree" claim, but only in the inner loop.
  • default_install_hook_types is forced to [pre-commit, pre-push]. That drops pre-merge-commit where a repo had it, even though the template's commit hook lists that stage.

I'll review Exedore 1's two pending commits (hadolint defaults, systemd smoke skip) when they land. Neither was on the branch at ab19d5a.

Josui and others added 2 commits November 17, 2026 20:56
…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

@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 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.

Comment thread bin/sdlc
# 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 "$@")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 ;;

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: 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
@fatherlinux

Copy link
Copy Markdown
Member Author

Replies to the a211 review. Everything below landed as new commits, nothing rewritten.

Blocking

  1. Idempotency: fixed in 6f17196. A hooks file that already carries the floating hooks, and nothing they replace, now comes back unchanged. I applied the converter to all 63 clones it converts and ran it again on each; every second run was empty.

  2. Block-style default_install_hook_types: fixed in 6f17196. The key is now replaced whole, list items and all.

  3. repos: in a header comment: fixed in 6f17196. The key now goes in by line, above the real repos:.

  4. Guard: added in 6f17196. verify() parses back every file it would write. It refuses with exit 2, before writing anything, unless all of these hold:

    • both hook types are installed
    • the floating hooks are there, with nothing they replace left behind
    • .sdlc/bin/sdlc is byte for byte bin/sdlc-bootstrap
    • a job named sdlc ci runs .sdlc/bin/sdlc ci

    Each bug has a test, and I confirmed all three tests fail against the old converter.

Nits (fixed in 3947763)

  • Gourmand job name: a Gourmand job only counts as covered when it is named Code Quality (Gourmand).
  • Step env: an sdlc ci step with any env other than SDLC_IMAGE is no longer replaced; it is refused with exit 2.
  • Privileged events: a mixed workflow that runs on pull_request_target or workflow_run is refused.
  • Leftover rev clones: if a surviving workflow still clones python-sdlc by rev, the conversion is refused and nothing is written.
  • README: it now says what floating trusts (whoever moves :latest, with signing as the follow-up). It also stops overstating the SDLC_IMAGE variable: an admin sets it, but that is no wall against a PR editing its own workflow.
  • pre-merge-commit: left as is. The fleet's files never listed it, and the template matches them.
  • [tool.sdlc] image on a seat: left as is. It only affects the inner loop, and the banner names the image every run.

:latest is broken: a new README section covers it: --no-verify locally, the organization variable SDLC_IMAGE=X.Y.Z for CI, and why that fallback only works once two releases carry launcher.

The hadolint defaults are in 1fafd32 and the systemd smoke skip is in 1f333f9.

@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 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.

Comment thread scripts/convert_repo.py Outdated
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"}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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"}

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 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

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

Reviewed 1 commit since 3947763 (incremental).

1 finding(s) not re-raised: already answered on this PR.

Comment thread bin/sdlc-bootstrap Outdated

# The value, with the repository named in full or not at all.
want=${SDLC_IMAGE:-latest}
want=${want#"$FLEET"}

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 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#:}

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 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

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

1 finding(s) not re-raised: already answered on this PR.

@fatherlinux

Copy link
Copy Markdown
Member Author

Re-review at a483867 (a211): approve

The three blockers are closed. I re-ran my repros with --apply. Block-style default_install_hook_types and a repos: mentioned in a header comment now both produce valid YAML with the comment left alone. A second run on each gives exit 0 and an empty diff. test_convert_repo.py and test_plan.py pass.

Exit 4 can't be faked by anything else. In run_up, the PID-1 branch is the only path that returns 4; its other returns are 0, 1 or 2. run_host maps a non-host-up podman exit to 0, 1 or 2. run_step turns a 4 from any mode other than host-up into 1. The lanes' worst status never carries a 4. test_host_contract.sh covers a tool exiting 4.

The one way to opt in is legitimate and shows in the log: a repo whose ENTRYPOINT, or whose smoke args replacing CMD, really is /sbin/init or systemd. The run says SKIPPED and exits 0. An init behind a wrapper such as tini or sh -c isn't matched, so it gets judged. That's the conservative choice.

The image allowlist holds. I ran the bootstrap against a stub podman with 21 values:

  • Accepted: empty, latest, main, 0.9.0, 10.20.30, the full quay.io/crunchtools/sdlc:<tag> form, and @sha256:<64 hex> with or without the repo name.
  • Exit 2: sdlc-evil:latest, sdlc/x, another registry, localhost/, 1.2, 1.2.3.4, .1.2, 1..2.3, a trailing space, -x, an uppercase digest, tag+digest and :../x.

Passing the checked full ref to the launcher as SDLC_IMAGE keeps the launcher and the image in agreement.

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 error threshold and the two ignores apply only when a repo has no .hadolint.yaml, and an explicit threshold still wins.

No further blockers.

@fatherlinux
fatherlinux merged commit c76e864 into main Nov 17, 2026
22 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.

1 participant