feat(claude-automerge): risk_main_go opt-out for Go-monorepo tool entrypoints#89
Merged
Merged
Conversation
… entrypoints The risk-tier path scan treats ANY main.go as manual-merge (added in #77 for single-service repos where cmd/<reponame>/main.go IS the deployed service). In a Go monorepo most cmd/*/main.go are dev/CLI tools, not the deployed service, and the bare `(^|/)main\.go$` pattern can't tell cmd/<service>/main.go from cmd/<tool>/main.go — so it false-flags every tool entrypoint as manual-merge. Concrete case: techrecon#230 (a header-determinism fix touching four cmd/techrecon-*/main.go tool entrypoints) was blocked from auto-merge purely on the main.go pattern, none of them deployed services. Add a `risk_main_go` workflow input (boolean, default true → zero fleet change). When a caller sets it false, the main.go pattern is dropped from the risk scan at runtime via a fixed-string filter (grep -vF 'main\.go'); every other risk-tier pattern still fires. Such callers gate their real deployed entrypoint via their own .github/risk-paths.yml instead. - Input default true preserves existing behavior for all current callers. - Runtime filter removes exactly the main.go line (selftest asserts this). - Selftest extended: with the filter, main.go paths (incl. cmd/<service>/main.go) do NOT match, while auth/Dockerfile/migrations/oauth2 STILL match. - Patterns string itself is unchanged, so the shared corpus / BB-variant sync is preserved. Auto-merge rationale: manual-merge category — touches .github/workflows/**, and topcoder1/ci-workflows itself doesn't install the caller (filename collision), so PRs here always require manual merge regardless. Codex pre-review: skipped — additive workflow input + bash filter + selftest cases (~60 LOC), regression surface covered by selftest not Codex. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Risk class: This PR touches one of the blocked path categories from Auto-merge is refused by (This is a policy notice, not a code-quality failure. The classify job itself does not fail — required CI checks remain authoritative for "is the code green.") |
|
Coverage Floor — mode:
|
|
No issues found. Filter logic, shell condition, default behavior, and selftest sanity check all look correct. |
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.
Problem
The risk-tier path scan in
claude-author-automerge.ymltreats anymain.goas manual-merge (added in #77 for single-service repos wherecmd/<reponame>/main.gois the deployed service). In a Go monorepo, mostcmd/*/main.goare dev/CLI tools, not the deployed service — and the bare(^|/)main\.go$pattern can't distinguishcmd/<service>/main.gofromcmd/<tool>/main.go, so it false-flags every tool entrypoint.Concrete case: techrecon#230 (a header-determinism fix touching four
cmd/techrecon-*/main.gotool entrypoints — load, regress, bench, detection-counts) was blocked from auto-merge purely on themain.gopattern. None are deployed services (techrecon's only deployed binary iscmd/ja4-enrichment).Change
Add a
risk_main_goworkflow input (boolean, defaulttrue→ zero fleet change). When a caller sets itfalse, themain.gopattern is dropped from the risk scan at runtime via a fixed-string filter (grep -vF 'main\.go'); every other risk-tier pattern still fires. Such callers gate their real deployed entrypoint via their own.github/risk-paths.yml.truepreserves existing behavior for all current callers (incl.wxa-mcp-server).patternsstring itself is unchanged, so the shared-corpus / BB-variant sync is preserved.main.gopaths (incl.cmd/<service>/main.go) do not match, whileauth/Dockerfile/migrations/oauth2still match. A sanity check asserts the filter removes exactly themain.goline.Verification
bash selftest/test_automerge_risk_patterns.sh-> PASS (existing cases + new opt-out cases).actionlinton the workflow -> clean.Follow-up
A companion PR on
whois-api-llc/techreconwill setrisk_main_go: falsein its caller and gatecmd/ja4-enrichment/**(the real deployed service) viarisk-paths.yml. It depends on this input existing on@main, so this merges first.Auto-merge rationale: Manual-merge — touches
.github/workflows/**, and this repo doesn't install the caller (filename collision), so PRs here always require manual merge.Codex pre-review: Skipped — additive workflow input + bash filter + selftest cases (~60 LOC); regression surface is covered by the selftest, not Codex.
🤖 Generated with Claude Code