Skip to content

fix(pr-bot): switch to valid CLI diff report and add PR base/head ran… - #124

Merged
Anandb71 merged 2 commits into
mainfrom
v2.0
Apr 20, 2026
Merged

fix(pr-bot): switch to valid CLI diff report and add PR base/head ran…#124
Anandb71 merged 2 commits into
mainfrom
v2.0

Conversation

@Anandb71

Copy link
Copy Markdown
Collaborator

…ge support

Description

Brief description of what this PR does. Link any related issues.

Fixes #(issue number)

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Performance improvement
  • Code refactoring

Changes Made

  • List the key changes made in this PR
  • Be specific about files/modules affected

Testing

Describe how you tested your changes:

  • Ran cargo test --all
  • Ran cargo clippy --all
  • Ran flutter test (if applicable)
  • Tested manually with a real codebase

Screenshots (if applicable)

For visualizer changes, include before/after screenshots.

Checklist

  • My code follows the project's style guidelines
  • I have added tests for my changes
  • I have updated the documentation where necessary
  • All new and existing tests pass
  • I have added appropriate comments where the code isn't self-explanatory

@github-actions

Copy link
Copy Markdown

🧠 Arbor Graph Impact Report

Blast Radius: High-centrality nodes affected?

🧠 Arbor Graph Impact Report

Command: diff . --json

```json
{
"changed_files": [
".github/workflows/arbor-pr-bot.yml",
"action.yml",
"crates/arbor-cli/src/commands.rs"
],
"changed_symbols": 72,
"impact": {
"api_entrypoints_affected": 22,
"blast_radius_nodes": 59,
"direct_callers": 37,
"files_likely_require_updates": 5,
"indirect_callers": 23
}
}
```

Powered by Arbor graph governance for code. See https://github.com/Anandb71/arbor for details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the Arbor PR bot workflow to generate PR impact reports using the CLI’s diff command, and adds base/head SHA range support so the CLI can compute changed files for a PR commit range (not just local working tree changes).

Changes:

  • Add ARBOR_DIFF_BASE/ARBOR_DIFF_HEAD support in arbor-cli to compute changed files from a commit-to-commit diff.
  • Update the composite GitHub Action to capture CLI output into arbor-impact.md for PR bot reporting.
  • Update the PR bot workflow to set base/head SHAs and run diff . --json.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
crates/arbor-cli/src/commands.rs Adds env-driven base/head ranged diff support for changed-file detection.
action.yml Adjusts PR-bot reporting behavior to wrap CLI output into a markdown report file.
.github/workflows/arbor-pr-bot.yml Switches PR bot to run diff . --json and passes PR base/head SHAs via env.

Comment thread action.yml
Comment on lines +55 to +57
echo '```'
} > arbor-impact.md
echo "Generated impact report from CLI output."

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

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

The code-fence lines are being echoed with backslash-escaped backticks (e.g. \```json). In bash single quotes, backslashes are literal, so the generated markdown will contain ````and won’t render as a fenced code block. Emit plain triple-backticks (andjson` if appropriate) so the report renders correctly.

Copilot uses AI. Check for mistakes.
Comment thread action.yml
Comment on lines +48 to +56
if [[ "${{ inputs.command }}" == *"diff"* || "${{ inputs.command }}" == *"check"* || "${{ inputs.command }}" == *"pr-summary"* || "${{ inputs.command }}" == *"analyze-impact"* ]]; then
if arbor ${{ inputs.command }} > /tmp/arbor-impact.out 2>/tmp/arbor-impact.err; then
{
echo "## 🧠 Arbor Graph Impact Report"
echo "Command: \`${{ inputs.command }}\`"
echo
echo '```json'
cat /tmp/arbor-impact.out || true
echo '```'
} > arbor-impact.md

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

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

The report always labels the output block as json, but this step also wraps check, pr-summary, and analyze-impact outputs which may not be JSON. Consider using an unlabeled code fence by default, or choose the fence language based on whether inputs.command includes --json to avoid misleading/incorrect rendering.

Copilot uses AI. Check for mistakes.
Comment thread action.yml
Comment on lines +51 to +54
echo "Command: \`${{ inputs.command }}\`"
echo
echo '```json'
cat /tmp/arbor-impact.out || true

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

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

arbor-impact.md now includes its own top-level "## 🧠 Arbor Graph Impact Report" heading, but the workflow that posts the comment also prepends the same heading. This will result in duplicated headers in the PR comment; consider removing the heading from the action output file (or updating the workflow template) so the posted comment has a single consistent title.

Copilot uses AI. Check for mistakes.
Comment on lines +283 to +301
let range_base = std::env::var("ARBOR_DIFF_BASE").ok();
let range_head = std::env::var("ARBOR_DIFF_HEAD").ok();

if let (Some(base), Some(head)) = (range_base, range_head) {
let base = base.trim();
let head = head.trim();

if !base.is_empty() && !head.is_empty() {
let ranged = run_git(
path,
&["diff", "-w", "--name-status", "--find-renames", base, head],
)?;

let mut files = parse_git_name_status_output(&ranged);
files.retain(|path| !is_generated_or_internal_path(path));
files.sort();
files.dedup();

return Ok(files);

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

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

New behavior for ARBOR_DIFF_BASE/ARBOR_DIFF_HEAD changes how git_changed_files computes the change set (commit-to-commit diff vs working tree). There are tests for parsing/filtering, but nothing exercising this ranged-diff path; adding a test (e.g., create a temp git repo with two commits and assert the returned file list) would help prevent regressions in the PR-bot flow.

Copilot uses AI. Check for mistakes.
@github-actions

Copy link
Copy Markdown

🧠 Arbor Graph Impact Report

Blast Radius: High-centrality nodes affected?

Command: diff . --json

{
  "changed_files": [
    ".github/workflows/arbor-pr-bot.yml",
    "action.yml",
    "crates/arbor-cli/src/commands.rs"
  ],
  "changed_symbols": 72,
  "impact": {
    "api_entrypoints_affected": 22,
    "blast_radius_nodes": 59,
    "direct_callers": 37,
    "files_likely_require_updates": 5,
    "indirect_callers": 23
  }
}

Powered by Arbor graph governance for code. See https://github.com/Anandb71/arbor for details.

@Anandb71
Anandb71 merged commit 97caeba into main Apr 20, 2026
6 checks passed
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.

2 participants