Skip to content

feat: v0.2.0 three commands, three config blocks - #2

Merged
fatherlinux merged 3 commits into
mainfrom
feature/three-commands
Nov 4, 2026
Merged

fatherlinux merged 3 commits into
mainfrom
feature/three-commands

Conversation

@fatherlinux

Copy link
Copy Markdown
Member

Summary

The shape constitution XII v1.30.0 requires:

Command Runs when Config block
sdlc commit pre-commit hook [tool.sdlc.commit]
sdlc push pre-push hook [tool.sdlc.push]
sdlc ci CI job sdlc ci [tool.sdlc.ci]
  • Each command runs its defaults; checks adds, skip removes; a check's settings live in [tool.sdlc.<command>.<check>]. sdlc tiers prints what runs.
  • ci = push minus Gourmand and Gatehouse (CI runs those through their own workflows) plus the repo's own checks, which are named kinds — image-build and pytest-in-image — never shell.
  • Two hooks instead of eleven. bin/sdlc asks the image for a plan and carries it out, and refuses any host step that isn't podman build or podman run.
  • Paths come from each tool's own config. Paths a kind takes must stay inside the repo.
  • CodeQL fails on new findings — anything not in .sdlc/codeql-baseline.json.
  • SDLC_SKIP=<check> skips one check once.
  • Trivy removed (RT #1551). No image build at this repo's pre-push.

Test plan

  • tests/test_plan.py — resolution, refusals, path confinement, CodeQL baseline (all pass)
  • tests/test_host_contract.sh — every command needs only git/podman; a non-podman host step is refused and never runs
  • tests/contract.sh on a dev image — passes, including the plan order and ci leaving out the reviewers
  • End to end on a fixture: image-build applied @project.version and @git.sha labels; pytest-in-image ran inside a Hummingbird image with no network; a failing test → 1, no tests → 2, a broken build → 1, an unknown check → 2
  • CI builds, runs the unit tests in the image, and the contract test against the pushed digest

Gatehouse findings not changed

  • actions/checkout@v7 in the README example: the fleet pins GitHub Actions at the major tag and Dependabot moves them (constitution XV); not a violation.
  • "Contract test runs against the local tag before push": it also runs against the pushed digest in verify-digest, which is the profile's requirement; the pre-push run is an earlier, cheaper failure, not a replacement.

🤖 Generated with Claude Code

https://claude.ai/code/session_01R7Y1jfy8tZHovMEJUNjjD2

`sdlc commit` (the pre-commit hook), `sdlc push` (the pre-push hook) and
`sdlc ci` (the CI job) are configured by [tool.sdlc.commit], [tool.sdlc.push]
and [tool.sdlc.ci] in the consuming repo's pyproject.toml. Each runs its
defaults; `checks` adds and `skip` removes; a check's settings live in its own
[tool.sdlc.<command>.<check>] table. Constitution XII v1.30.0 requires the
shape.

ci is push minus Gourmand and Gatehouse, which CI already runs through their
own workflows, plus the repo's own checks. Those are named kinds -- image-build
and pytest-in-image at launch -- and never shell; a repo that needs something
new gets a new kind here. A path a kind takes (containerfile, context, mounts)
must stay inside the repository, since it reaches a host bind mount or a build
context.

The hooks file exports two hooks instead of eleven. bin/sdlc is shell and
cannot read TOML, so it asks the image for a plan and carries it out, refusing
any host step that is not `podman build` or `podman run`. The host contract is
held by the launcher, not trusted to a repo's config.

Paths come from each tool's own config; the old flat keys are gone and a stray
key is refused rather than ignored. CodeQL fails on findings not in the
committed .sdlc/codeql-baseline.json instead of reporting and passing. Trivy is
removed from this image's build (RT #1551 replaces image scanning fleet-wide),
and the image build is gone from this repo's own pre-push.

tests/test_plan.py pins the resolution rules; it and test_codeql_globs.py,
which CI never ran, now run in the built image on every build.

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

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

Full review.

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

Comment thread bin/sdlc

TAB=$(printf '\t')

run_host() {

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 launcher evaluates a host-step payload before checking that it is a permitted Podman command. The plan is generated from repository configuration, and the line-based plan format does not escape embedded newlines or tabs. A crafted configuration value can therefore inject another host plan record whose payload runs arbitrary shell commands; eval executes that payload before the podman check. This can turn a CI run on a repository change into host command execution.

Suggestion: Do not use eval to parse plan payloads. Pass host steps in a structured, safely encoded format and construct the permitted Podman argument vector without invoking a shell; validate the command and subcommand before any execution.

Evidence:

run_host() {
  eval "set -- $1"
  [ "${1:-}" = podman ] || die "a host step may only run podman; refused: $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 584463d. A host step is now an argv joined by the ASCII unit separator; the launcher splits it with IFS (globbing off), never evals it, and checks podman build|run before anything runs. The plan refuses any field containing a tab, newline, CR or the separator, so a config value cannot forge a second line. tests/test_host_contract.sh proves a non-podman step is refused and a $(...)-shaped word is never executed; tests/test_plan.py proves the forged values are refused at the source.

fatherlinux and others added 2 commits November 4, 2026 06:08
v0.1.0 rebuilt on a tool release, which changed nothing: the Containerfile pins
both tools exactly, so the rebuild pulled the version it already had. A release
has to MOVE THE PIN. Three steps now do that end to end:

1. update-tools.yml, on the tools' `parent-image-updated` dispatch and weekly,
   runs scripts/update_tools.py: if a release tag is newer than the pin, it
   moves both ARG copies, bumps this image's patch version in IMAGE_TAG,
   pyproject.toml and the version label, adds a CHANGELOG entry, and opens a
   PR that merges itself when green. Tags, not GitHub Releases: gourmand has
   none.
2. release.yml tags a merged version that has a CHANGELOG heading and no tag.
3. container.yml, after a tag's image is promoted, runs
   scripts/bump_consumers.py: one auto-merging rev bump PR in every repo that
   pins python-sdlc, each gated by that repo's own CI, with the failures named
   for a rerun -- fleet-bump.py's shape. Only a 404 on a repo's config means
   "does not pin"; any other API failure fails the run rather than skipping the
   repo silently.

All three use the crunchtools-ci App token: a PR or tag made with GITHUB_TOKEN
starts no workflow, so it could never go green, be promoted or reach anyone.
Auto-merge is now enabled on this repo, which it was not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R7Y1jfy8tZHovMEJUNjjD2
bin/sdlc ran `eval "set -- $1"` on a host step BEFORE checking it was podman,
and the plan is line-based, so a config value containing a newline could
inject a second plan line whose payload the eval would run -- command
substitution and all -- ahead of the check. Gatehouse found it.

A host step is now its argv joined by the ASCII unit separator (0x1f). The
launcher splits on it with IFS and globbing off, so no word is ever read as
shell, then checks `podman build|run`. The plan refuses any field holding a
tab, a newline, a carriage return or the separator, so a value cannot forge a
line. tests/test_host_contract.sh now proves a non-podman step is refused and
that a podman word shaped like `$(...)` is never run; tests/test_plan.py proves
the forged values are refused at the source.

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

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

Reviewed 2 commits since 91132a8 (incremental).

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

Comment thread scripts/bump_consumers.py
continue
try:
print(f" {bump(repo, args.version)}")
except subprocess.CalledProcessError as command_error:

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 (Consistency Check): This CalledProcessError handler formats the exception and its raw stderr, while the other CalledProcessError handler in this file strips and prints the stderr text directly (lines 108–110). Here the exception output can duplicate the error and render stderr as a bytes representation, making failure messages inconsistent.

Suggestion: Format command_error.stderr consistently with the handler at lines 108–110: strip it, decode it if needed, and print the reason once.

Evidence:

140 |         except subprocess.CalledProcessError as command_error:
141 |             print(f"  FAILED: {command_error}: {command_error.stderr}", file=sys.stderr)
108 |         except subprocess.CalledProcessError as exc:
109 |             reason = exc.stderr.strip()
110 |             print(f"  warning: {repo}: auto-merge not queued: {reason}", file=sys.stderr)

set -eu
v=$(sed -n 's/^version = "\(.*\)"$/\1/p' pyproject.toml | head -1)
[ -n "$v" ] || { echo "pyproject.toml names no version" >&2; exit 1; }
if gh release view "v$v" >/dev/null 2>&1; 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.

LOW (General Review): This suppresses every error from gh release view, making an existing release indistinguishable from an authentication, API, or network failure. The workflow then proceeds as though the version were untagged, obscuring the original failure and potentially producing a less informative error later.

Suggestion: Capture the command result and treat only a confirmed not-found response as an untagged version; report or fail on other errors.

Evidence:

if gh release view "v$v" >/dev/null 2>&1; then

@fatherlinux
fatherlinux merged commit 976419f into main Nov 4, 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.

1 participant