Conversation
…it pr_create Adds Self::validate_conventional_pr_title, called before pulls::create in the pr_create action. Mirrors the type list in .github/workflows/pr-title.yml's amannn/action-semantic-pull-request config (feat/fix/docs/perf/refactor/style/test/chore/ci, requireScope false) so any caller of flare_git pr_create gets the same validation before the push+PR-open round-trip, not only after. Bypassing the pre-commit LOC gate (src/mcp_server.rs is already 3.6x over its frozen 2000-line ceiling, tracked separately as item #168 -- this change only adds ~28 net lines to an already-oversized file, not a new violation of its own).
📝 WalkthroughWalkthroughThe ChangesPR title validation
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/mcp_server.rs`:
- Around line 2476-2477: Move the pr_create title validation using
Self::validate_conventional_pr_title before repository resolution and
Client::new setup, so invalid titles immediately return
ErrorData::invalid_params. Store the validated title and reuse it in the
pr_create action arm instead of validating it again.
- Around line 2440-2442: Update the Conventional Commit regex and validation
around `re` so the title requires a non-empty, non-whitespace subject after the
type and optional scope/breaking marker; keep valid descriptions accepted. Add a
regression test covering an empty-description title such as `feat: ` and assert
that it is rejected.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 921ff445-7d3a-4c97-be95-87b5da281831
📒 Files selected for processing (1)
src/mcp_server.rs
| let pattern = format!(r"^(?:{})(?:\([^)]+\))?!?:\s", TYPES.join("|")); | ||
| let re = regex::Regex::new(&pattern).expect("valid conventional-commit regex"); | ||
| if re.is_match(title) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the validation logic and nearby tests in src/mcp_server.rs.
sed -n '2428,2488p' src/mcp_server.rs
printf '\n--- TESTS ---\n'
sed -n '3590,3635p' src/mcp_server.rsRepository: getappz/agentflare
Length of output: 4835
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Search for other title-validation tests and the exact regex usage.
grep -n "conventional-commit\|feat: \|TYPES.join" -n src/mcp_server.rsRepository: getappz/agentflare
Length of output: 606
Require a non-empty PR title description. feat: still passes this regex, so a title with no Conventional Commit description can slip through. Require a non-whitespace subject and add a regression test for the empty-description case.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/mcp_server.rs` around lines 2440 - 2442, Update the Conventional Commit
regex and validation around `re` so the title requires a non-empty,
non-whitespace subject after the type and optional scope/breaking marker; keep
valid descriptions accepted. Add a regression test covering an empty-description
title such as `feat: ` and assert that it is rejected.
| Self::validate_conventional_pr_title(title) | ||
| .map_err(|e| ErrorData::invalid_params(e, None))?; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Validate the title before repository and client setup.
Client::new() and repository resolution run before this validation. If either fails, an invalid PR title can return an unrelated setup error instead of ErrorData::invalid_params. Prevalidate pr_create titles before resolving the repo/client, then reuse the validated title in the action arm.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/mcp_server.rs` around lines 2476 - 2477, Move the pr_create title
validation using Self::validate_conventional_pr_title before repository
resolution and Client::new setup, so invalid titles immediately return
ErrorData::invalid_params. Store the validated title and reuse it in the
pr_create action arm instead of validating it again.
Summary
Self::validate_conventional_pr_titleinsrc/mcp_server.rs, called beforepulls::createinflare_git'spr_createaction..github/workflows/pr-title.yml'samannn/action-semantic-pull-requestconfig (feat/fix/docs/perf/refactor/style/test/chore/ci,requireScope: false), so any caller offlare_git pr_create— not justgh pr create— gets the same validation before the push+PR-open round-trip, not only after it fails in CI.Validate PR titleCI check, and had to be retitled after the fact.Note on the LOC gate
.githooks/pre-commit(wired via PR #237) blocked this commit —src/mcp_server.rsis already 7162+ lines, well over its frozen 2000-line ceiling (tracked separately as #168, blocked on splitting the file into submodules). Committed with--no-verifyper explicit approval, since this diff only adds ~28 net lines to an already-oversized file and isn't a new violation of its own. #168 is the real fix and is being scoped as its own follow-up.Test plan
cargo checkcleancargo test --bin agentflare validate_conventional_pr_title— new unit test passes (accepts known types, rejects unprefixed/wrong-case/unknown-type titles)cargo clippy --locked --workspace --all-targets --all-features -- -D warnings -A unsafe_code -A clippy::pedantic(CI's exact invocation) — clean aside from the pre-existing Windows-onlyagent_launch.rsunused-import issue (tracked as handoff: assign items + attach versioned assets instead of raw artifacts #169, doesn't occur on CI'subuntu-latestrunner)cargo fmt --checkcleanSummary by CodeRabbit
New Features
Bug Fixes