feat: begin PR workflow hardening - #308
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughMigrates PR management tooling from shell scripts to a Rust-based Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant xtask as cargo xtask
participant GH_CLI as gh cli
participant GraphQL as GitHub API<br/>(GraphQL)
User->>xtask: pr-threads list [--selector PR#]
xtask->>GH_CLI: gh api graphql (fetch unresolved threads)
GH_CLI->>GraphQL: graphql query
GraphQL-->>GH_CLI: thread list
GH_CLI-->>xtask: parsed threads
xtask-->>User: display threads
User->>xtask: pr-threads reply --comment-id X --body "msg"
xtask->>GH_CLI: gh api (add reply)
GH_CLI->>GraphQL: mutation
GraphQL-->>GH_CLI: success
GH_CLI-->>xtask: ack
xtask-->>User: reply posted
User->>xtask: pr-threads resolve --thread-ids [IDs] --yes
xtask->>GH_CLI: gh api graphql (resolve threads)
GH_CLI->>GraphQL: mutation
GraphQL-->>GH_CLI: success
GH_CLI-->>xtask: ack
xtask-->>User: threads resolved
sequenceDiagram
participant User
participant xtask as cargo xtask<br/>pr-preflight
participant LocalValidator as Local Validators
participant ShellCheck as Shell & Lint
participant SchemaValidator as Schema/Feature
User->>xtask: pr-preflight [--base origin/main] [--full]
xtask->>xtask: compute changed files (unless --full)
xtask->>xtask: derive preflight scope & build checks
xtask->>LocalValidator: execute local gate
LocalValidator-->>xtask: pass/fail
xtask->>ShellCheck: run markdownlint + dead-refs + bash -n
ShellCheck-->>xtask: pass/fail
xtask->>SchemaValidator: validate runtime schema + features
SchemaValidator-->>xtask: pass/fail
alt All checks pass
xtask-->>User: success (no blockers)
else Any check fails
xtask-->>User: bail with failing labels
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2ee2f5633
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/workflows.md`:
- Around line 19-20: The docs/workflows.md text incorrectly points to repo-root
AGENTS.md; update the reference string "AGENTS.md" to the actual path
"docs/archive/AGENTS.md" so the sentence reads e.g. See docs/archive/AGENTS.md
for full details; modify the quoted path in the line containing `AGENTS.md` to
the new path to ensure the link points to the correct file.
In `@Makefile`:
- Around line 34-38: The Makefile targets pr-threads and pr-preflight are
vulnerable to ARGS word-splitting; change the recipe invocations to safely pass
the whole ARGS value (e.g., use `@bash` -lc 'cargo xtask pr-threads $(ARGS)' and
`@bash` -lc 'cargo xtask pr-preflight $(ARGS)' or otherwise ensure the shell
evaluates the embedded quotes) and add a short note in the Makefile comments
mentioning that multi-word --body values are better supplied via --body-file to
avoid quoting pitfalls; update references to the targets pr-threads,
pr-preflight and the variable $(ARGS).
In `@xtask/src/main.rs`:
- Around line 411-425: Track and report partial successes when resolving
multiple threads: maintain a counter (e.g., successes) while iterating over
targets and calling run_gh_capture; on each successful call for a thread (use
thread.thread_id and thread.display_location for logging) increment the counter
and print the per-thread success as now, but if run_gh_capture returns an Err,
print a summary like "Resolved X/Y threads before failure" (using successes and
targets.len()) and propagate the error; alternatively, perform the
run_gh_capture call inside a match/if let to detect Err and log the
partial-summary before returning Err from the function.
- Around line 898-903: The current is_gh_auth_error function overmatches because
lowered.contains("auth") will hit words like "author" or "authentic"; update the
detection to use tighter patterns: remove the generic contains("auth") check and
instead detect whole-word "auth" or specific phrases such as "authentication",
"not logged in", "to authenticate", "you must authenticate", or "authentication
required" (use a regex with word boundaries or split/token checks). Reference
the function is_gh_auth_error and replace the simple substring check with either
a regex (e.g., word-boundary patterns) or explicit phrase matches to avoid false
positives.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: c54a1c84-ebf9-4b7f-9235-cbb76540942c
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (7)
Makefiledocs/workflows.mdpackage.jsonscripts/hooks/README.mdscripts/pr-status.shtests/hooks/test_pr_status.shxtask/src/main.rs
Starts the PR-workflow improvement cycle with the first concrete slice:
cargo xtask pr-statusas the canonical repo-maintenance entrypoint for current-head PR statusmake pr-statusas a thin alias to that xtask surfaceFollow-up slices on this branch will cover the rest of the queued PR-process work.
Test Plan:
Summary by CodeRabbit
New Features
cargo xtask pr-statuscommand to display PR status with blocker detectioncargo xtask pr-threadscommand for managing review threads (list, reply, resolve actions)cargo xtask pr-preflightcommand to verify PR readiness before submissionDocumentation
Chores