Skip to content

fix(flare-git-core): name touched trust-root paths in push deny message - #313

Merged
getappz merged 1 commit into
masterfrom
task/320
Jul 23, 2026
Merged

fix(flare-git-core): name touched trust-root paths in push deny message#313
getappz merged 1 commit into
masterfrom
task/320

Conversation

@getappz

@getappz getappz commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Auto-opened on item done for I6vs4hnmCa4pD0oVTiNq1.

Summary by CodeRabbit

  • Bug Fixes
    • Improved push protection for changes affecting configured trust-root paths.
    • Denial messages now identify only the trust-root paths actually changed.
    • Pushes are denied with a clear explanation when affected files cannot be verified.
    • Continued blocking pushes targeting the default branch.

Replace the boolean push_touches_trust_root/touches_trust_root plumbing
with a TrustRootTouch enum (Clean/Touched(Vec<String>)/Unknown) so the
shim's deny message names exactly which trust-root path(s) matched
instead of listing every known pattern. An unreadable diff now fails
closed to Unknown (still denies) with a distinct message, rather than
silently defaulting to Clean.

Agentflare-Agent: claude-code_2-1-218_agent
Agentflare-Branch: task/320
Agentflare-Item: 320
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

classify_pure now receives structured trust-root touch results. Push handling distinguishes clean, touched, and unverifiable diffs, while classify resolves the result and preserves separate default-branch checks. Tests cover updated signatures, outcomes, and denial messages.

Changes

Trust-root classification

Layer / File(s) Summary
Trust-root resolution contract
crates/flare-git-core/src/classify.rs
Adds TrustRootTouch and resolve_trust_root_touch, which identify matched paths, clean diffs, or unverifiable diffs.
Push decision integration
crates/flare-git-core/src/classify.rs
Updates classify_pure and classify to use structured trust-root results and retain independent default-branch denial.
Classification behavior tests
crates/flare-git-core/src/classify.rs
Updates classifier call sites and verifies push outcomes, existing command behavior, path-specific denial reasons, and unverifiable-diff messaging.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • getappz/agentflare#279: Modifies the same classification logic and introduces the refactored trust-root handling.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is missing the required Summary, Test plan, and Notes for reviewers sections. Add the required template sections with a brief change summary, test checklist, and reviewer notes on risk areas and backward compatibility.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the main change: improving push deny messages for touched trust-root paths.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch task/320

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

@getappz getappz changed the title flare-git-core: name touched trust-root paths in push deny message (TrustRootTouch) fix(flare-git-core): name touched trust-root paths in push deny message Jul 23, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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 `@crates/flare-git-core/src/classify.rs`:
- Around line 363-369: Replace the single-branch use of pushed_branch() in the
classification flow with parsing of every pushed source/destination refspec
pair. Use destinations for targets_default_branch protection checks and inspect
all sources for trust-root changes, including --all and --mirror; if any push
mode or refspec cannot be resolved, fail closed. Add end-to-end coverage for
feature:master, master:feature, and multi-ref pushes.
🪄 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: d900c56e-7b96-45e6-9f78-c05245a87d12

📥 Commits

Reviewing files that changed from the base of the PR and between d503df0 and e7f91fb.

📒 Files selected for processing (1)
  • crates/flare-git-core/src/classify.rs

Comment on lines +363 to 369
let trust_root_touch = pushed
.as_deref()
.is_some_and(|b| push_touches_trust_root(repo_root, b, &default_branch));
.map(|b| resolve_trust_root_touch(repo_root, b, &default_branch))
.unwrap_or(TrustRootTouch::Clean);
let targets_default_branch = pushed
.as_deref()
.is_some_and(|b| is_protected_branch(b, Some(&default_branch)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

Parse push sources and destinations separately.

pushed_branch() returns the refspec source, so git push origin feature/x:master sets targets_default_branch to false and bypasses the default-branch denial; master:feature is wrongly denied. --all/--mirror also inspect only one branch, so trust-root changes on other pushed refs can evade classification. Model every pushed source/destination pair, check protection on destinations and trust-root changes on all sources; fail closed when a push mode cannot be resolved. Add end-to-end regressions for feature:master, master:feature, and multi-ref pushes.

🤖 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 `@crates/flare-git-core/src/classify.rs` around lines 363 - 369, Replace the
single-branch use of pushed_branch() in the classification flow with parsing of
every pushed source/destination refspec pair. Use destinations for
targets_default_branch protection checks and inspect all sources for trust-root
changes, including --all and --mirror; if any push mode or refspec cannot be
resolved, fail closed. Add end-to-end coverage for feature:master,
master:feature, and multi-ref pushes.

@getappz
getappz merged commit 8342fcf into master Jul 23, 2026
17 of 19 checks passed
@getappz
getappz deleted the task/320 branch July 23, 2026 15:17
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