v2.8.0: merge-policy for the lwp-website pilot (factory side) - #12
Merged
Merged
Conversation
src/ci.ts (validatePr, waitForCi, and a non-blocking ciStatusNow snapshot, ported from machinist agent.py) and src/merge-policy.ts (ported from machinist risk_delivery/gate.py, refusal reasons from agent-skills' herdr-issue-coordinator checklist). merge.policy is "off" by default, "dry-run" assesses and posts an audit comment, "auto" merges once every readiness and eligibility gate holds, gated by autoPaths/maxFiles/maxLines instead of gate.py's hardcoded 200-line allow-list. Wired into resumeInReview rather than the pipeline's terminal stage, so the CI wait never blocks a worker slot and undoes v2.7.0's continuous dispatch. A human /factory revise or /factory cancel always wins over the merge check on the same poll. Structural tests: a spy across the whole scenario suite proves merge is never called while policy is "off"; tests/merge-refusal-coverage.test.ts regex-parses MergeRefusalReason and fails if any reason isn't asserted by name in its ported test file (caught a real gap: draft and not-mergeable had no test); a file under protectedPaths never qualifies for auto-merge whatever autoPaths says, at both the module and scenario level. lwp-website's own config, protected paths, issue forms, gate fixes, copied skills, CI workflow and the five pilot issues are a separate PR against that repo. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/ci.ts(validatePr,waitForCi, a new non-blockingciStatusNowsnapshot — machinistagent.py:439-459,487-592) andsrc/merge-policy.ts(decideMerge/attemptMerge/renderAuditComment— machinistrisk_delivery/gate.py, refusal reasons from agent-skills' herdr-issue-coordinator checklist).merge.policyis"off"(default, unchanged behavior for every existing repo),"dry-run"(assesses eligibility, posts an audit comment, never merges) or"auto"(merges once every readiness and eligibility gate holds), scoped bymerge.autoPaths/maxFiles/maxLines.resumeInReview(checked once per poll, non-blocking) rather than the pipeline's terminal "pr" stage, sowaitForCi's own wait never ties up a worker slot and undoes v2.7.0's continuous dispatch. A human/factory reviseor/factory cancelalways wins over the merge check that poll.src/github.tsmethods (prStatus,mergeReadiness,mergePr) andsrc/git.ts'sdiffStat. Newmerge-dry-runinbox kind.Test plan
make check(typecheck + fullbun test+ skills-ref validate) green: 779 pass, 0 failresumeInReview's guards (policy-off skip, duplicate-audit-comment skip) — both confirmed to fail when the guard is removed, then restoredtests/merge-refusal-coverage.test.ts(new structural test) proven by revert-and-fail: an untested union member added toMergeRefusalReasonfails the test, confirmed, then reverteddraftandnot-mergeablehad no test intests/ported/machinist/merge-policy.test.tsmergeis never called on any path whilepolicyis"off"Not in this PR
.factory/config.json,protectedPaths,charter.md, issue forms, gate fixes, copied skills, CI workflow, and the five pilot issues — separate PR againstlwp-website.merge-dry-runis read-only for now.🤖 Generated with Claude Code