ci: shift checks left (check-json, script tests, image pins) #187

Open
opened 2026-11-15 20:02:13 +00:00 by Claude · 3 comments
Owner

Spec: Enforcement map for each prose-only rule, resolution comment, "New controls".

What

  • Add check-json from the pre-commit-hooks repository already in .pre-commit-config.yaml (it covers renovate.json).
  • Add a local language: system hook running python -m unittest discover -s tests/scripts, with files: ^(scripts|tests/scripts)/ and pass_filenames: false. Remove Lint's separate unit-test step, because pre-commit run --all-files now runs it.
  • Before that hook is added, make every git-fixture test drop GIT_* variables from the environment it passes to git, the way tests/scripts/test_select_molecule_scenarios.py:86-113 already does. A hook runs with GIT_DIR (and often GIT_INDEX_FILE) exported, and tests/scripts/test_check_bot_pr_diff.py:36-48 passes {**os.environ, ...} straight to git, so inside a hook its git init, git add and git commit would act on the real repository instead of the fixture. Add a check for it (for example, run the suite once with GIT_DIR set to a bogus path and expect it to pass).
  • Add a local hook running python3 scripts/check_image_versions.py pins on ^(\.gitea/workflows/|images/), with pass_filenames: false. The hook fails when its file set is empty instead of passing silently.

Acceptance

  • Lint is green, and each new hook fails on a deliberately broken input when checked locally (do not commit the breakage). The PR shows each hook failing on its example.
  • The suite passes with GIT_DIR set to a bogus path.
  • check_bot_pr_diff.py still accepts a Renovate bump of the hook repositories' rev: lines.
  • The PR says what was verified and what was not.
Spec: [Enforcement map for each prose-only rule](https://git.rkdr.net/Mortis/Kamino/issues/102), resolution comment, "New controls". ## What - Add `check-json` from the `pre-commit-hooks` repository already in `.pre-commit-config.yaml` (it covers `renovate.json`). - Add a local `language: system` hook running `python -m unittest discover -s tests/scripts`, with `files: ^(scripts|tests/scripts)/` and `pass_filenames: false`. Remove Lint's separate unit-test step, because `pre-commit run --all-files` now runs it. - Before that hook is added, make every git-fixture test drop `GIT_*` variables from the environment it passes to `git`, the way `tests/scripts/test_select_molecule_scenarios.py:86-113` already does. A hook runs with `GIT_DIR` (and often `GIT_INDEX_FILE`) exported, and `tests/scripts/test_check_bot_pr_diff.py:36-48` passes `{**os.environ, ...}` straight to `git`, so inside a hook its `git init`, `git add` and `git commit` would act on the real repository instead of the fixture. Add a check for it (for example, run the suite once with `GIT_DIR` set to a bogus path and expect it to pass). - Add a local hook running `python3 scripts/check_image_versions.py pins` on `^(\.gitea/workflows/|images/)`, with `pass_filenames: false`. The hook fails when its file set is empty instead of passing silently. ## Acceptance - [ ] Lint is green, and each new hook fails on a deliberately broken input when checked locally (do not commit the breakage). The PR shows each hook failing on its example. - [ ] The suite passes with `GIT_DIR` set to a bogus path. - [ ] `check_bot_pr_diff.py` still accepts a Renovate bump of the hook repositories' `rev:` lines. - [ ] The PR says what was verified and what was not.
Claude added the
Status
Ready for Agent
label 2026-11-15 20:02:13 +00:00
Claude added this to the Continuous delivery milestone 2026-11-15 22:21:21 +00:00
Author
Owner

ci(images): assign image versions in CI (#165) now blocks this and removes bump_image_versions.py and the bump mode. Drop the part that keeps or moves the bump judge; no manual image version bump is needed once #165 lands. (From Order of the implementation backlog, #198.)

ci(images): assign image versions in CI (#165) now blocks this and removes `bump_image_versions.py` and the `bump` mode. Drop the part that keeps or moves the `bump` judge; no manual image version bump is needed once #165 lands. (From Order of the implementation backlog, #198.)
Author
Owner

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

  • Running the script tests as a git hook can damage the clone. A hook runs with GIT_DIR (and often GIT_INDEX_FILE) exported. Some git-fixture tests pass the caller's environment straight to git: tests/scripts/test_check_bot_pr_diff.py:36-48 and tests/scripts/test_bump_image_versions.py:36-48 use {**os.environ, ...}. Inside a hook, their git init, git add and git commit would act on the real repository instead of the fixture. tests/scripts/test_select_molecule_scenarios.py:86-113 already removes every GIT_* variable, for this reason. Change: before the hook is added, make every fixture drop GIT_* variables the same way, and add a check (for example, run the suite once with GIT_DIR set to a bogus path and expect it to pass).
  • A check that scans nothing reports green. Change: each new hook ships with a deliberately failing example that the PR shows failing (already in the acceptance), and the image-pins hook fails when its file set is empty instead of passing silently.
  • The body still describes the removed bump work. It says to run check_image_versions.py bump from origin/main's copy, keep bump as a Lint step, bump the ci image version, and has an acceptance line for bump. The ordering comment drops all of it, since the image versions issue removes bump first. Change: fold the comment into the body and delete those lines and the matching acceptance item.
Review of the map (2026-11-15): corrections to this issue. - **Running the script tests as a git hook can damage the clone.** A hook runs with `GIT_DIR` (and often `GIT_INDEX_FILE`) exported. Some git-fixture tests pass the caller's environment straight to `git`: `tests/scripts/test_check_bot_pr_diff.py:36-48` and `tests/scripts/test_bump_image_versions.py:36-48` use `{**os.environ, ...}`. Inside a hook, their `git init`, `git add` and `git commit` would act on the real repository instead of the fixture. `tests/scripts/test_select_molecule_scenarios.py:86-113` already removes every `GIT_*` variable, for this reason. Change: before the hook is added, make every fixture drop `GIT_*` variables the same way, and add a check (for example, run the suite once with `GIT_DIR` set to a bogus path and expect it to pass). - **A check that scans nothing reports green.** Change: each new hook ships with a deliberately failing example that the PR shows failing (already in the acceptance), and the image-pins hook fails when its file set is empty instead of passing silently. - **The body still describes the removed `bump` work.** It says to run `check_image_versions.py bump` from `origin/main`'s copy, keep `bump` as a Lint step, bump the `ci` image version, and has an acceptance line for `bump`. The ordering comment drops all of it, since the image versions issue removes `bump` first. Change: fold the comment into the body and delete those lines and the matching acceptance item.
Claude added a new dependency 2026-11-17 17:08:33 +00:00
Claude removed a dependency 2026-11-20 21:25:58 +00:00
Claude changed title from ci: shift checks left (check-json, script tests, image pins) and run the bump judge from main to ci: shift checks left (check-json, script tests, image pins) 2026-11-20 21:51:42 +00:00
Author
Owner

Body rewritten on 2026-11-20 to the final state of the comments above (final validation round of the map, #87 (comment)). The body is the spec; the earlier comments are history.

  • No decision of that round changes this issue. The rewrite carries the earlier comments: everything about the bump judge is removed (#165 removes bump, and no manual image version bump is needed), and the title drops "run the bump judge from main".
  • It also carries the review corrections: fixtures drop GIT_* variables before the script-test hook, and the image-pins hook fails on an empty file set.
Body rewritten on 2026-11-20 to the final state of the comments above (final validation round of the map, https://git.rkdr.net/Mortis/Kamino/issues/87#issuecomment-12281). The body is the spec; the earlier comments are history. - No decision of that round changes this issue. The rewrite carries the earlier comments: everything about the `bump` judge is removed (#165 removes `bump`, and no manual image version bump is needed), and the title drops "run the bump judge from main". - It also carries the review corrections: fixtures drop `GIT_*` variables before the script-test hook, and the image-pins hook fails on an empty file set.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: Mortis/Kamino#187