Skip to content

fix(automerge): treat NAF credit/billing gate code as high-risk#87

Merged
topcoder1 merged 1 commit into
mainfrom
fix/naf-billing-gate-risk-pattern
May 28, 2026
Merged

fix(automerge): treat NAF credit/billing gate code as high-risk#87
topcoder1 merged 1 commit into
mainfrom
fix/naf-billing-gate-risk-pattern

Conversation

@topcoder1
Copy link
Copy Markdown
Owner

Summary

whois-api-llc/wxa_webcat#438 — a fix to src/webcat/api/middleware/naf.py, the validate_call/log_successful_call client that authorizes and charges every customer API call — auto-merged because the path has no auth/billing keyword. The file is the billing gate but slipped through the risk-tier globs.

Adds a targeted pattern so NAF gate code requires manual click-merge:

(^|/)naf(/|\.(py|go|ts|js)$)
  • Matches a naf file or naf/ module at any depth → catches webcat's naf.py and asm-core's src/naf/client.go.
  • Scoped to the naf segment, not a broad middleware/ rule, so benign middleware (logging, CORS, rate-limit) isn't over-classified.
  • Kept in lock-step across the workflow regex and the GH selftest mirror (per the in-file "keep these in lock-step" note).

Changes

  • .github/workflows/claude-author-automerge.yml — pattern + category comment.
  • selftest/test_automerge_risk_patterns.sh — mirror pattern.
  • selftest/risk_patterns_corpus.txt — RISKY (naf.py, naf/client.go, internal/naf/validate.go) + SAFE (naf-integration.md, naffle/, snafu/) cases.

The matching bb-automerge.py change ships in a companion dotclaude PR so the shared corpus stays green on both selftests.

Test plan

  • bash selftest/test_automerge_risk_patterns.sh → all cases pass
  • BB_AUTOMERGE_PY=… bash selftest/test_bb_automerge_risk_patterns.sh → 142 cases pass (with the companion dotclaude change applied locally)

Auto-merge rationale: MANUAL-MERGE — touches .github/workflows/** (production CI infra), and ci-workflows PRs always require manual merge (the caller/reusable filename collision). Merge this together with the companion dotclaude PR to keep GH/BB in lockstep.

🤖 Generated with Claude Code

wxa_webcat#438 auto-merged a fix to src/webcat/api/middleware/naf.py — the
validate_call/log_successful_call client that authorizes and charges every
customer API call — because the path contains no auth/billing keyword. The
file IS the billing gate but slipped through the risk-tier globs.

Add a targeted pattern `(^|/)naf(/|\.(py|go|ts|js)$)` matching a `naf` file
or `naf/` module at any depth (catches webcat's naf.py and asm-core's
src/naf/client.go), kept in lock-step across the workflow regex and the GH
selftest mirror. Scoped to the `naf` segment rather than a broad
`middleware/` rule so benign middleware (logging, CORS, rate-limit) is not
over-classified into manual-merge.

Corpus: RISKY entries for naf.py / naf/client.go / internal/naf/validate.go;
SAFE entries (naf-integration.md, naffle/, snafu/) proving the segment match
doesn't over-block substring look-alikes. The matching bb-automerge.py change
ships in dotclaude so the shared corpus stays green on both selftests.

GH selftest: all cases pass. BB selftest: 142 cases pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions github-actions Bot added the risk:blocked Risk class: blocked label May 28, 2026
@github-actions
Copy link
Copy Markdown

Risk class: blocked — manual merge required.

This PR touches one of the blocked path categories from .github/risk-paths.yml (Dockerfiles, docker-compose, .github/workflows/**, **/.env*, **/secrets*, infra/, terraform/, k8s/, or the classifier config itself).

Auto-merge is refused by claude-author-automerge.yml. A maintainer should review the diff and click "Squash and merge" themselves.

(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.")

@github-actions
Copy link
Copy Markdown

Coverage Floor — mode: enforce

metric value
measured 100.0%
floor (current) 99.0%
target 100.0%
last bumped 2026-05-12

@claude
Copy link
Copy Markdown

claude Bot commented May 28, 2026

No issues found. Regex correctly anchors naf as a path segment (not substring), SAFE cases for naffle/ and snafu/ are sound, and RISKY/SAFE corpus is in lock-step with the workflow pattern.

@topcoder1 topcoder1 merged commit c43ca1e into main May 28, 2026
13 checks passed
@topcoder1 topcoder1 deleted the fix/naf-billing-gate-risk-pattern branch May 28, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:blocked Risk class: blocked

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant