Enforcement map for each prose-only rule #102

Closed
opened 2026-11-11 22:02:58 +00:00 by Claude · 2 comments
Owner

Part of #87

Question

For each rule that exists only as prose, is it enforced by a hook, by CI, left to agent instructions on purpose, or dropped? And which checks run from the base branch so a pull request cannot change its own judge?

Rules without a check today:

  • A changelog fragment for consumer-visible changes (only the format is linted).
  • A NOTICE entry and REUSE annotation for third-party material.
  • Never pull_request_target; values passed through env:.
  • Only image.yml references the organisation secrets.
  • Commit with git, never the forge API; never push to main.
  • A pull request states what was verified.
  • No local molecule or container runtime.
  • Image layers under 100 MB.
  • Hand-bumped pins (kaniko, Renovate itself); retiring an image.
  • Roles tested on both Ubuntu releases.

Context

  • Decided already: enforce by default, with the maintainer free to leave a rule to agent instructions; guardrails must be understandable to a human.
  • Decided in Guiding principles for agents and humans: each rule is labelled as held by a control, by review, or aspirational; shell and Python lint are settled (ruff and shellcheck as hooks and in CI); no custom checker is written where a standard tool does not exist, so a new custom check here needs a stated reason.
  • Not checked locally today: the script unit tests, the image checks. Generic hooks to consider: check-json, a Renovate config validator.
  • Every local hook should also run in CI.
Part of #87 ## Question For each rule that exists only as prose, is it enforced by a hook, by CI, left to agent instructions on purpose, or dropped? And which checks run from the base branch so a pull request cannot change its own judge? Rules without a check today: - A changelog fragment for consumer-visible changes (only the format is linted). - A `NOTICE` entry and REUSE annotation for third-party material. - Never `pull_request_target`; values passed through `env:`. - Only `image.yml` references the organisation secrets. - Commit with git, never the forge API; never push to `main`. - A pull request states what was verified. - No local molecule or container runtime. - Image layers under 100 MB. - Hand-bumped pins (kaniko, Renovate itself); retiring an image. - Roles tested on both Ubuntu releases. ## Context - Decided already: enforce by default, with the maintainer free to leave a rule to agent instructions; guardrails must be understandable to a human. - Decided in [Guiding principles for agents and humans](https://git.rkdr.net/Mortis/Kamino/issues/91): each rule is labelled as held by a control, by review, or aspirational; shell and Python lint are settled (`ruff` and `shellcheck` as hooks and in CI); no custom checker is written where a standard tool does not exist, so a new custom check here needs a stated reason. - Not checked locally today: the script unit tests, the image checks. Generic hooks to consider: `check-json`, a Renovate config validator. - Every local hook should also run in CI.
Claude added the
Wayfinder
Grilling
label 2026-11-11 22:02:58 +00:00
Claude added a new dependency 2026-11-11 22:03:14 +00:00
Claude added a new dependency 2026-11-11 22:03:14 +00:00
Defame1297 was assigned by Claude 2026-11-15 19:43:35 +00:00
Author
Owner

Resolution: how each prose-only rule is held

Decided in a grilling session against an inventory of .pre-commit-config.yaml and the five workflows (main at cb50e6f). Each rule: what it says, how it is held.

Rules

Rule Held by
A changelog fragment for consumer-visible changes Control: fragment-presence check from main's copy (#183)
NOTICE entry and REUSE.toml annotation for third-party material Review, prompted by a PR-template checkbox. No tool can tell copied material; the REUSE.toml glob makes reuse lint pass regardless
Never pull_request_target; values through env: Control: zizmor (#145)
Restated: each secret is referenced by exactly one workflow (image.yml the push credential, renovate.yml the Renovate token, release.yml the release token); no other workflow references secrets. except the job token Review, through CODEOWNERS on .gitea/** (#144). The old wording ("only image.yml") was false: renovate.yml uses RENOVATE_BOT_TOKEN
Commit with git, never the forge API Dropped. CI re-runs every pre-commit hook (--all-files), the commit-msg check per commit and gitleaks over the range; an API commit only gets later feedback
Never push to main Control: branch protection (#179)
A pull request states what was verified PR template plus review; no body check (gameable, needs an API call)
Do not install a container runtime to run molecule; molecule runs in CI Agent instruction, recorded as the maintainer's choice to leave it uncontrolled
Image layers under 100 MB Agent instruction in images/AGENTS.md: estimate the layer sizes when changing an image and state the estimate in the PR. No pull-request build (maintainer's choice); the registry rejecting the push on main (HTTP 413) is the backstop
Renovate's own image Control that proposes: Renovate tracks it weekly, 3-day minimumReleaseAge, not automerged (CODEOWNERS approval is needed anyway)
kaniko bump; retiring an image Aspirational, each with its trigger written in images/AGENTS.md (kaniko is pinned by layer digests Renovate cannot compute)
Roles tested on both Ubuntu releases Molecule (control) plus review for the declarations (Role standard, #133)

Which checks judge from main's copy. A script that decides whether the pull request's own diff is allowed runs from main's copy: the bot-diff gate, scenario selection, the fragment check, and check_image_versions.py bump (moves; it runs from the PR's copy today). A script that checks content or the built artefact runs from the PR's copy, so a PR can change a check together with what it checks: check_tarball.py, check_image_versions.py pins, the lint wrappers and .pre-commit-config.yaml itself; CODEOWNERS review covers edits to them. Scenario: a PR that changes an image input and edits bump to always pass must fail; a PR that adds a shipped file and its tarball allow-list entry must be able to pass.

New controls (shift left). check-json hook; a local hook running python -m unittest discover -s tests/scripts on scripts/ and tests/scripts/ changes, replacing Lint's separate step; check_image_versions.py pins as a hook on .gitea/workflows/ and images/ (bump stays CI-only: it needs the base ref); renovate-config-validator as a Lint job in the pinned Renovate image.

Also found: the gitleaks hook does nothing under pre-commit run --all-files (it scans staged changes); Lint's range scan is the real check. No change.

No separate enforcement-map document: every rule carries its "held by" label where it is written (Contributor doc set and the nested AGENTS.md). No new ADR: each decision is cheap to reverse; the base-copy line becomes one sentence in ADR 0001 (#143).

## Resolution: how each prose-only rule is held Decided in a grilling session against an inventory of `.pre-commit-config.yaml` and the five workflows (`main` at cb50e6f). Each rule: what it says, how it is held. **Rules** | Rule | Held by | |---|---| | A changelog fragment for consumer-visible changes | Control: fragment-presence check from `main`'s copy ([#183](https://git.rkdr.net/Mortis/Kamino/issues/183)) | | `NOTICE` entry and `REUSE.toml` annotation for third-party material | Review, prompted by a PR-template checkbox. No tool can tell copied material; the `REUSE.toml` glob makes `reuse lint` pass regardless | | Never `pull_request_target`; values through `env:` | Control: zizmor ([#145](https://git.rkdr.net/Mortis/Kamino/issues/145)) | | **Restated:** each secret is referenced by exactly one workflow (`image.yml` the push credential, `renovate.yml` the Renovate token, `release.yml` the release token); no other workflow references `secrets.` except the job token | Review, through CODEOWNERS on `.gitea/**` ([#144](https://git.rkdr.net/Mortis/Kamino/issues/144)). The old wording ("only `image.yml`") was false: `renovate.yml` uses `RENOVATE_BOT_TOKEN` | | Commit with git, never the forge API | **Dropped.** CI re-runs every pre-commit hook (`--all-files`), the commit-msg check per commit and gitleaks over the range; an API commit only gets later feedback | | Never push to `main` | Control: branch protection ([#179](https://git.rkdr.net/Mortis/Kamino/issues/179)) | | A pull request states what was verified | PR template plus review; no body check (gameable, needs an API call) | | Do not install a container runtime to run molecule; molecule runs in CI | Agent instruction, recorded as the maintainer's choice to leave it uncontrolled | | Image layers under 100 MB | Agent instruction in `images/AGENTS.md`: estimate the layer sizes when changing an image and state the estimate in the PR. No pull-request build (maintainer's choice); the registry rejecting the push on `main` (HTTP 413) is the backstop | | Renovate's own image | Control that proposes: Renovate tracks it weekly, 3-day `minimumReleaseAge`, not automerged (CODEOWNERS approval is needed anyway) | | kaniko bump; retiring an image | Aspirational, each with its trigger written in `images/AGENTS.md` (kaniko is pinned by layer digests Renovate cannot compute) | | Roles tested on both Ubuntu releases | Molecule (control) plus review for the declarations ([Role standard](https://git.rkdr.net/Mortis/Kamino/issues/93), [#133](https://git.rkdr.net/Mortis/Kamino/issues/133)) | **Which checks judge from `main`'s copy.** A script that decides whether the pull request's own diff is allowed runs from `main`'s copy: the bot-diff gate, scenario selection, the fragment check, and `check_image_versions.py bump` (moves; it runs from the PR's copy today). A script that checks content or the built artefact runs from the PR's copy, so a PR can change a check together with what it checks: `check_tarball.py`, `check_image_versions.py pins`, the lint wrappers and `.pre-commit-config.yaml` itself; CODEOWNERS review covers edits to them. *Scenario:* a PR that changes an image input and edits `bump` to always pass must fail; a PR that adds a shipped file and its tarball allow-list entry must be able to pass. **New controls (shift left).** `check-json` hook; a local hook running `python -m unittest discover -s tests/scripts` on `scripts/` and `tests/scripts/` changes, replacing Lint's separate step; `check_image_versions.py pins` as a hook on `.gitea/workflows/` and `images/` (`bump` stays CI-only: it needs the base ref); `renovate-config-validator` as a Lint job in the pinned Renovate image. **Also found:** the gitleaks hook does nothing under `pre-commit run --all-files` (it scans staged changes); Lint's range scan is the real check. No change. **No separate enforcement-map document:** every rule carries its "held by" label where it is written ([Contributor doc set](https://git.rkdr.net/Mortis/Kamino/issues/103) and the nested `AGENTS.md`). **No new ADR:** each decision is cheap to reverse; the base-copy line becomes one sentence in ADR 0001 ([#143](https://git.rkdr.net/Mortis/Kamino/issues/143)).
Author
Owner

Review of the map (2026-11-15): corrections to this issue.

Review of the map (2026-11-15): corrections to this issue. - **The `bump` lines conflict with the earlier [CI image pipeline: keep, simplify or replace](https://git.rkdr.net/Mortis/Kamino/issues/96).** This resolution says `check_image_versions.py bump` "moves" to `main`'s copy and "`bump` stays CI-only". Section 3 of the earlier resolution deletes it ("Goes: `bump_image_versions.py` and tests, `check_image_versions.py bump`, the 'bump in the same PR' rule"). [Order of the implementation backlog](https://git.rkdr.net/Mortis/Kamino/issues/198) reconciled this in favour of the earlier decision: [ci: shift checks left (check-json, script tests, image pins) and run the bump judge from main](https://git.rkdr.net/Mortis/Kamino/issues/187) drops its `bump` part. Read the `bump` lines here as superseded; the rest of the "judge from `main`'s copy" rule stands.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: Mortis/Kamino#102