Skip to content

refactor(ci): give diff chunking one module for review and verify - #18335

Merged
kyle-sexton merged 7 commits into
mainfrom
refactor/diff-chunking-module
Nov 23, 2026
Merged

kyle-sexton merged 7 commits into
mainfrom
refactor/diff-chunking-module

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

No related issue: candidate 8 of an /architecture:improve deepening pass over the CI lanes, run in a local session.

Summary

Cutting a diff into reviewable chunks, pieces, parts and folded long lines was split across a Python splitter in pr-review-main/ (with no test of its own), a bash cutter in pr-verify/ that called into the other lane's script, inline awk copied into the three review legs, and a 1800-byte limit set at six YAML sites plus JS and Python constants. A cutter fix had to touch both lanes.

Fix

  • pr-review-main/split-diff.py moves to .github/scripts/diff-chunking/diff_chunking.py. Its split command keeps the same arguments, and a new parts command replaces the awk part cutter in the three pr-review-main.yml legs and in pr-verify/chunk-diff.sh.
  • The module owns LONG_LINE_BYTES (1800). The six workflow env lines are removed. The JS copy (pr-review-main/write-verdict.mjs) and the Python copy (diff_risk.py) stay where their callers need them, and a new test holds all three equal.
  • .github/scripts/diff-chunking/ gets its own package.json ("test": "node --test", as pr-review-main's) and is listed in scripts/outside-node-packages.txt, so the test-node lane runs it as it ran the old split-diff tests inside pr-review-main; the suite declares diff_risk.py in its test-scope, since it reads that file's LONG_LINE_BYTES.
  • New suite diff-chunking/diff-chunking.test.mjs tests the module on fixture patches. The split tests moved there from pr-review-main/workflow.test.mjs with their assertions unchanged.
  • Trust paths: every job that runs the cutter checks out all of main into .base (no sparse or copy list), so the same code still comes from the base branch. The hold floor gains .github/scripts/diff-chunking/** as class gate with no author lift, the same as pr-review-main/**, and sync-hold-floor.py regenerated its copies.

Verification

  • The new Python parts output matched the old awk byte for byte on 2,050 random fixtures.
  • node --test --test-concurrency=4 over diff-chunking, chunk-diff, both workflow suites, write-verdict, spec-prompt-text and guard-coverage: 148 pass, 0 fail. Breaking fold back-off, the cap, or the header rule each turns a test red.
  • sync-hold-floor.py --check, test_floor_paths, test_diff_risk, graphql-operations.test.sh (7/7) and engine.test.sh pass.

Related

Part of the .github deepening series. #18310 also adds a hold-floor row; whichever lands second regenerates the floor files.

🤖 Generated with Claude Code

kyle-sexton and others added 3 commits November 22, 2026 23:13
diff-chunking/diff_chunking.py now owns the chunk, piece, part and
long-line fold rules and LONG_LINE_BYTES. It is split-diff.py moved out of
pr-review-main plus a `parts` command that replaces the awk cutter copied
into the three pr-review-main legs and pr-verify's chunk-diff.sh.

- The three review legs and chunk-diff.sh call `split` and `parts`; no
  step sets LONG_LINE_BYTES any more (chunk-diff.sh still takes one from a
  test).
- diff-chunking.test.mjs tests the module directly on fixture patches
  (split's tests move there from pr-review-main/workflow.test.mjs) and
  holds write-verdict.mjs's and diff_risk.py's copies of the cap equal.
- `.github/scripts/diff-chunking/**` joins the hold floor as a gate path
  with no author lift, like pr-review-main/**, so the moved code stays
  held; the generated copies and floor pins are updated.

The Python `parts` was checked byte for byte against the old awk on 2,050
random fixtures, file-parts lists included.

Reasons kept from deleted comments:
- LONG_LINE_BYTES has copies in pr-review-main/write-verdict.mjs and
  babysit-prs diff_risk.py (the merge gate ships in a plugin and cannot
  import from .github); diff-chunking.test.mjs holds all three equal.
- chunk-diff.sh takes LONG_LINE_BYTES only from a test, and refuses one
  under 40 bytes, which leaves no room for the continuation mark.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…g-module

Hold-floor files regenerated from main plus this branch's diff-chunking
row; floor pins recomputed to main's counts plus that one gate row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 23, 2026 09:37
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T09:45:40.314292Z 1eb1fea 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 Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed a6144ef2797ec7ca8c87e1239d559e67be82248a: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Security review (incremental, blocking only): no security issues found

This review covers only the push since 610cd2a5. The lane already reviewed an earlier head, so this pass was blocking only: it reports CRITICAL and IMPORTANT findings, and none came up. The push changes one file, and I read its whole change.

.github/scripts/diff-chunking/diff-chunking.test.mjs (trusted path .github/scripts/diff-chunking/**)

  • The push changes only the // test-scope: header comment on line 1. It adds plugins/source-control/.claude-plugin/plugin.json after diff_risk.py.
  • That widens the set of changed paths that trigger this suite, so the suite runs more often. It removes no coverage.
  • The push changes no test logic or assertions. It does not touch the cutter, a workflow, permissions, token scope, the trusted-actor list, the kill switch or any merge hold.
  • It touches no plugin manifest. The diff only names plugin.json inside a comment and does not edit that file, so it produces no manifest lines.
  • It deletes no standing instruction.

The PR context describes the change accurately and contains no instructions aimed at this lane. This push adds no spend.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed a6144ef2797ec7ca8c87e1239d559e67be82248a: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Code review (incremental, blocking only): 610cd2a → a6144ef

No blocking findings. I read the whole change to the one file listed for this push. This lane already reviewed an earlier head, so this review reports blocking findings only.

What I checked

  • The change. Line 1 of .github/scripts/diff-chunking/diff-chunking.test.mjs adds a second glob to the suite's // test-scope: header: plugins/source-control/.claude-plugin/plugin.json.
  • How affected-tests.sh treats it. The header comment in scripts/affected-tests.sh (MANIFESTS, around lines 179–184) says a manifest such as plugin.json selects a suite only through R1, R2 or a declared scope (R8). Declaring the scope is therefore the right way to tie this suite to the source-control manifest. The suite already reads diff_risk.py from that plugin (line 209).
  • Precedent. Several sibling suites carry the same declaration, for example .github/scripts/pr-review-main/workflow.test.mjs:7, write-verdict.test.mjs:1 and pr-merge/merge-job.test.mjs:2.
  • Stale-glob rule. A glob that matches no file fails the run. This one names a file that exists, so the rule is not triggered.
  • Cost. The suite will also run when the source-control manifest changes. That spends only CI minutes on the existing runners and is not a hold.

I ran no tests. The PR body's verification is the author's claim and I did not confirm it.

Loosened checks

Loosened checks would be marked: fail. That is the default, because the prompt has no loosened_check_verdict: or loosened_check_patterns: line; patterns: 0. The prompt also has no loosened_check_decision_record: line, so I did not check the citation requirement. This change widens when a test runs and weakens no check.

The PR context file has no embedded instructions. The PR closes no issue, so there are no acceptance criteria to check. The one earlier post from this lane has no line anchor and reported 0 findings, so there is nothing to restate.

Verifier dropped 0 of 0 candidates.

kyle-sexton and others added 3 commits November 23, 2026 04:45
plan-test-lanes.sh refused the plan: diff-chunking.test.mjs had no Node
package, so no lane ran it. Register .github/scripts/diff-chunking as an
outside Node package, and scope the suite to diff_risk.py, whose fold
length it compares.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Loading diff_risk.py reads plugins/source-control/.claude-plugin/plugin.json,
so a change to the manifest now selects the suite (R8).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit e142e19 Nov 23, 2026
72 checks passed
@kyle-sexton
kyle-sexton deleted the refactor/diff-chunking-module branch November 23, 2026 10:19
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 5, survived 1, timeout 0, no coverage 0, invalid 0, not run 1.
Covered-code score 83%; mutation score 83%.

File Killed Survived Timeout No coverage Invalid Not run
.github/scripts/diff-chunking/diff_chunking.py 4 1 0 0 0 0
.github/scripts/pr-merge/merge-holds.mjs 0 0 0 0 0 1
.github/scripts/pr-verify/chunk-diff.sh 1 0 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
.github/scripts/diff-chunking/diff_chunking.py:170 AOR productive input-gap

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

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant