Skip to content

fix(applier): drop the GNU-only grep -P, and name the credential the cure needs - #1029

Merged
hyperpolymath merged 1 commit into
mainfrom
fix/branch-gates-portable-grep
Sep 22, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
fix/branch-gates-portable-grep

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Two hardening follow-ups on #1027, which landed the org-inherited fix.

1. grep -P is a GNU extension. Classifying active branch rulesets into
repo-level vs org-inherited is the load-bearing step of this script — it is
what stops the PUT that 404'd 67 times. It must not depend on which grep
the runner ships. awk -F'\t' does the same field test portably.

Mutant F is retargeted at the awk line, so the control still dies: without
the ownership filter the applier becomes DRIFT and PUTs to
repos/acme/org-inherited/rulesets/18225024 — the measured 404, reproduced.

2. The ORG-INHERITED detail named the endpoint but not the credential.
An org-level ruleset write needs admin:org. A repo-scoped token reads the
inherited ruleset in full and cannot write it — that asymmetry is the whole
bug. Saying so in the report line saves the operator a second 403 chase.

Suite: 46/46, mutant F killed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ji1bq3TypfycfUPAR7hSxR

Two hardening follow-ups on the org-inherited fix:

1. `grep -P` is a GNU extension. The classification of active branch
   rulesets into repo-level vs org-inherited is the load-bearing step of
   this script; it must not depend on which grep the runner ships. awk
   with an explicit `-F'\t'` does the same field test and is portable.
   Mutant F is retargeted at the awk line so the control still dies.

2. The ORG-INHERITED detail named the endpoint but not the credential.
   An org-level ruleset write needs `admin:org`; a repo-scoped token
   reads the ruleset in full and cannot write it, which is precisely the
   asymmetry that produced the original 404. Saying so in the report
   line saves the operator a second 403 chase.

Suite: 46/46, mutant F still killed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ji1bq3TypfycfUPAR7hSxR
@coderabbitai

coderabbitai Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 90b502c2-5a6d-4822-80d5-9026874a0f14

📥 Commits

Reviewing files that changed from the base of the PR and between 682fc60 and 383ba15.

📒 Files selected for processing (2)
  • scripts/apply-branch-gates.sh
  • scripts/tests/branch-gates-apply-test.sh
 ________________________________________________________________________________________________________________________________
< Design using services. Design in terms of services-independent, concurrent objects behind well-defined, consistent interfaces. >
 --------------------------------------------------------------------------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • 🔴 Error committing to branch - (🔄 Check to retry)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath merged commit 0f2d9b5 into main Sep 22, 2026
44 of 45 checks passed
@hyperpolymath
hyperpolymath deleted the fix/branch-gates-portable-grep branch September 22, 2026 23:56
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

❌ Failed to create Coding Agent finishing-touch task. Please try again.

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