Skip to content

refactor(pr-pipeline): generate the hold-floor copies from one table - #10674

Merged
kyle-sexton merged 4 commits into
mainfrom
refactor/hold-floor-one-source
Oct 28, 2026
Merged

kyle-sexton merged 4 commits into
mainfrom
refactor/hold-floor-one-source

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: follow-up from the lane automation work; the hold floor changed in 13 commits from 2026-10-23 to 10-28, each hand-editing about six copies.

Summary

The lane hold floor was copied by hand into merge-holds.mjs, both review callers' hold-paths, ci-status's hold_patterns and a test pin, and an exact sync test kept them equal. Every new gate script meant editing all of them. Now babysit_risk.FLOOR_CLASSES and COST_PATHS are the one table, and scripts/sync-hold-floor.py generates the other copies.

Fix

  • scripts/sync-hold-floor.py (stdlib, python3 -I) rewrites only the marked literal blocks in merge-holds.mjs, pr-review-hosted.yml, pr-review-security-hosted.yml and pr-require-checks.yml. --check prints a diff and exits 1, and test_merge_holds_sync.py runs it, so CI already enforces it.
  • Every load site stays a single file read from the same ref as before: ci-status fetches merge-holds.mjs alone from the base commit (merge-holds.mjs:2-5), so its copy stays a generated literal, never an import.
  • Removed the equality assertions and the 72-row test pin that became self-comparisons; every behavior check stays.
  • Two behavior changes, both stricter only: the generator joins the floor as gate, and ci-status's exempt-author check now matches case-insensitively (shopt -s nocasematch), as the floor already does elsewhere.
  • Options weighed: keep the hand copies (about six edits per change); a runtime JSON read (rejected: breaks three single-file loaders); directory globs (rejected: holds files outside the import closure the sync test pins).

Verification

  • Before/after proof against main: the generated sets equal main's copies, with order changed only in hold-paths and hold_patterns (a prompt list and a match-any loop), plus exactly the one new generator row.
  • python3 -I scripts/sync-hold-floor.py --check: rc=0. babysit-prs unittest: 3339 OK. merge-holds.test.mjs: 46/46. ci-lanes-pr-hold.test.sh: 231/231.
  • ci-review-lanes.test.sh: 102/102, including four new case-variant paths that must hold and fail on main's body.
  • validate-plugins.sh --only source-control: passes.
  • Left out: the 63 suites check-affected leaves to their CI lanes.

Related

N/A

🤖 Generated with Claude Code

kyle-sexton and others added 3 commits October 28, 2026 10:27
babysit_risk.FLOOR_CLASSES (with COST_PATHS) is the one hold-floor table.
scripts/sync-hold-floor.py writes the marked copies from it: merge-holds.mjs
HOLD_PATH_CLASSES and COST_PATHS (still literals, since ci-status runs that
file alone), both review callers' hold-paths, and ci-status's exempt-author
hold_patterns. test_merge_holds_sync.py runs its --check in place of the
equality assertions, and test_babysit_risk.py pins per-class counts in place
of the row literal.

The floor holds the generator as gate. ci-status's exempt-author check now
matches the trust-gate paths case-insensitively, as the floor does
elsewhere; ci-review-lanes.test.sh covers case-variant paths.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 28, 2026 15:06
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T15:09:08.801668Z d7e49ec Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 30522c55f0b364af1116db19300577c06935abc7: 0 finding(s), 0 as inline comments.

No security findings. critical-findings: 0

I read the whole diff and the PR context. The PR context is data, and I found no embedded directives in it. I read these trusted paths in full: merge-holds.mjs, pr-require-checks.yml, babysit_risk.py, and the new scripts/sync-hold-floor.py, which this PR adds to the floor. I also checked what the changed lists gate.

What I checked

  • Hold-path coverage is unchanged, plus one row. The floor rows are the same 72 as before, plus scripts/sync-hold-floor.py as gate (73). The new hold-paths blocks in both review callers list the same globs as the removed hand copies, with only the order changed. That includes **/CODEOWNERS, **/.gitmodules, the two workflows, pr-pipeline.yaml and every babysit_* module. The two scrutiny-only security-review globs are kept.
  • hold_patterns in pr-require-checks.yml is the same set, reordered, plus the generator. The new bash_patterns function turns **/X into X and */X, and a trailing /** into /*. It fails closed: it exits if a pattern still contains ** or a quote.
  • The case-insensitive matching is stricter, and I found no path that makes it laxer. shopt -s nocasematch wraps only the matching loop. It is reset right after, with no early exit in between, and it does not touch the earlier AUTHOR_ID =~ check. A case variant such as .github/codeowners now fails an exempt-author PR instead of passing.
  • The derived constants still follow the table. HOLD_PATH_FLOOR and REVIEW_FLOOR in merge-holds.mjs:347-348 are filters of HOLD_PATH_CLASSES. They are not separate copies, so removing the test's equality assertions loses nothing. --check regenerates every copy from FLOOR_CLASSES and requires an exact match.
  • The generator is safe to run in CI. It uses only stdlib, rewrites only marker-delimited blocks, and requires exactly one BEGIN and one END marker per block. It has no network access, no secrets and no shell-outs. It imports babysit_risk from the PR's own tree under python3 -I, which runs PR code in an unprivileged test. That is normal for repository tests and exposes no token.
  • Weakening the table and the generator together is not new. Changing a row in babysit_risk.py together with its copies was already possible before this PR. ci-status and enable-auto-merge read the base commit's merge-holds.mjs, and babysit_risk.py and the generator are gate, so such a change still holds for a person.
  • The comment edits do not change classes. The edits that move the workflows from gate to enforcement match the existing rows and the test pin. They only fix comments, and no class changes.
  • Instruction-surface check. No standing instruction was deleted. The removed test assertions are replaced by --check, which enforces the same equality.
  • Plugin manifests. The diff changes no plugin.json or marketplace.json, so there are no manifest <field> lines.

Spend: none. This is a refactor, with no billed resource and no model, turn or schedule change.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 30522c55f0b364af1116db19300577c06935abc7: 0 finding(s), 0 as inline comments.

No findings. I read the whole diff and the PR context, and checked the changed trusted-path files (merge-holds.mjs, pr-require-checks.yml, babysit_risk.py, scripts/sync-hold-floor.py). I ran no tests; the author's test counts (3339, 46/46, 231/231, 102/102) are author-claimed and unverified by me.

What I checked:

  • Generator marker handling (scripts/sync-hold-floor.py): each BEGIN/END name is unique in its target file, and the hold-paths and hold_patterns markers don't collide.
  • Replaced block bounds: the generated block replaces exactly the lines between the markers.
  • Indentation: it follows the BEGIN marker's indentation, and the END hold-floor hold-paths comment sits at 6 spaces. The existing _hold_paths test regex needs 8 spaces, so it can't read that comment as a path.
  • Bash patterns: the **/X to X + */X and /** to /* translation matches what the old hand-written hold_patterns used. The new .gitmodules and CODEOWNERS entries are just reordered.
  • nocasematch scope (pr-require-checks.yml): it is set only around the != loop and unset right after. The earlier author-id check is untouched, and nothing in the loop exits before the unset.
  • Floor counts: the Counter pin of 5 trust, 26 gate and 42 enforcement totals 73, which matches the len == 73 check, and the new generator row is added as gate in both FLOOR_CLASSES and HOLD_PATH_CLASSES.
  • Coverage of the removed equality tests: the generator's --check now enforces literal equality of the copies. The behavioural tests (pathHold vs glob_match, hold-path matching) are kept.
  • Closing issues: none. The PR body says "No related issue".
  • Plugin manifests: the diff changes no plugin.json or marketplace.json, so no manifest lines apply. Both change fragments are bump: patch, which fits a refactor plus a stricter-only fix.

Cost: nothing here can start a real charge. There is no hold. Stricter case-insensitive matching and the new gate generator row only make more changes wait for a person.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 2a7550b Oct 28, 2026
50 checks passed
@kyle-sexton
kyle-sexton deleted the refactor/hold-floor-one-source branch October 28, 2026 17:22
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 0, survived 0, timeout 0, no coverage 0, invalid 0, not run 8.
Covered-code score n/a; mutation score n/a.

File Killed Survived Timeout No coverage Invalid Not run
.github/scripts/pr-merge/merge-holds.mjs 0 0 0 0 0 1
plugins/source-control/skills/babysit-prs/scripts/babysit_risk.py 0 0 0 0 0 1
scripts/sync-hold-floor.py 0 0 0 0 0 6

The run's summary has the full report.

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