Skip to content

Q.a - #44

Merged
v-Kaefer merged 5 commits into
mainfrom
Q.A
Aug 10, 2026
Merged

Q.a#44
v-Kaefer merged 5 commits into
mainfrom
Q.A

Conversation

@v-Kaefer

@v-Kaefer v-Kaefer commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Linked Issue

  • Closes #

Milestone

Summary

How to test

  • Test type: automated | smoke | manual
  • Steps:

Evidence

  • Screenshot/GIF attached when applicable
  • Log/output attached when applicable
  • Manual checklist executed when applicable

Known risks

DoD checklist

  • Scope implemented as defined
  • Tests executed and documented
  • Evidence attached when applicable
  • No known critical breakage introduced

Summary by CodeRabbit

  • New Features
    • Automatically fills or updates pull request linked-issue and milestone details based on recognized branch or backlog identifiers.
    • Preserves existing links and skips cases where the issue cannot be resolved confidently, including promotion and fork pull requests.
    • Supports preview-only updates before changes are applied.
  • Bug Fixes
    • Improves pull request synchronization by ensuring recoverable metadata is populated beforehand.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds a reusable autofill CLI that resolves pull request issues and milestones, rewrites selected body sections, updates GitHub and event data, and runs before PR synchronization. Tests cover resolution, exclusions, persistence, and workflow ordering.

Changes

Pull request autofill

Layer / File(s) Summary
PR body parsing and rewriting
project_setup/pr_autofill.py, tests/test_pr_sync_autofill.py
The module preserves non-target sections and updates Linked Issue and Milestone sections. Tests cover selective rewriting and existing explicit links.
Metadata resolution and autofill execution
project_setup/pr_autofill.py, tests/test_pr_sync_autofill.py
Branch tokens and backlog records resolve issue metadata. The workflow handles exclusions, unresolved branches, dry runs, GitHub updates, event persistence, and CLI validation.
Pre-sync workflow integration
.github/workflows/pr-sync.yml, tests/test_pr_sync_autofill.py
The workflow runs project_setup.pr_autofill before synchronization with pull request write permissions. Contract tests verify the order and permissions.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related issues

  • v-Kaefer/Github-Project-Automation issue 36: Covers the PR Sync autofill flow implemented by this change.

Possibly related PRs

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes all required headings but leaves the linked issue, summary, testing, evidence, risks, and DoD items as placeholders. Replace the placeholders with the actual issue, change summary, test results, risks, evidence, and completed DoD checklist.
Title check ❓ Inconclusive The title "Q.a" is too vague to identify the PR Sync autofill changes. Replace the title with a concise description such as "Add PR sync autofill resolver".
✅ Passed checks (3 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.
✨ 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 Q.A

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.

@v-Kaefer
v-Kaefer merged commit 8c514df into main Aug 10, 2026
19 of 20 checks passed

@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: 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 `@project_setup/pr_autofill.py`:
- Around line 39-50: Update the section-parsing loop in rewrite_pr_body to track
whether each line is inside a fenced Markdown code block and skip
SECTION_HEADING_PATTERN matching while fenced. Toggle the fence state on
Markdown fence delimiters, preserve existing preamble and section handling
outside fences, and add a regression test covering a fenced block containing a
target heading that must remain unchanged.
- Around line 146-153: Update resolve_from_branch’s explicit branch-token path
to catch GitHubRequestError from client.get_issue when the referenced issue is
unresolved. Return no issue and no milestone with the existing explanatory
message, allowing PR sync to continue without issuing a PATCH.
🪄 Autofix

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4ec83ca8-4f3b-409d-b756-3484f6924d9a

📥 Commits

Reviewing files that changed from the base of the PR and between 425ff48 and 8ed5e3a.

📒 Files selected for processing (3)
  • .github/workflows/pr-sync.yml
  • project_setup/pr_autofill.py
  • tests/test_pr_sync_autofill.py

Comment on lines +39 to +50
for line in (body or "").splitlines():
heading = SECTION_HEADING_PATTERN.match(line)
if heading:
if current_name is not None:
sections.append((current_name, current_lines))
current_name = heading.group(1)
current_lines = []
continue
if current_name is None:
preamble.append(line)
else:
current_lines.append(line)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Do not parse headings inside fenced Markdown blocks.

A fenced code example can contain ## Linked Issue or ## Milestone. This parser treats that content as a mutable section. rewrite_pr_body can then modify code that the PR author did not intend to change.

Track fenced code blocks before matching section headings. Add a regression test with a fenced block that contains a target heading.

🤖 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 `@project_setup/pr_autofill.py` around lines 39 - 50, Update the
section-parsing loop in rewrite_pr_body to track whether each line is inside a
fenced Markdown code block and skip SECTION_HEADING_PATTERN matching while
fenced. Toggle the fence state on Markdown fence delimiters, preserve existing
preamble and section handling outside fences, and add a regression test covering
a fenced block containing a target heading that must remain unchanged.

Comment on lines +146 to +153
explicit = BRANCH_ISSUE_PATTERN.search(branch or "")
if explicit:
number = int(explicit.group(1))
issue = client.get_issue(repo, number)
if "pull_request" in issue:
return None, None, f"branch references #{number}, but that item is a pull request"
milestone = (issue.get("milestone") or {}).get("title")
return issue, str(milestone) if milestone else None, f"resolved issue #{number} from branch token"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the GitHub client's non-success response behavior.
ast-grep outline project_setup/github.py --items all
rg -n -C 8 'def request_json\(|def get_issue\(|raise |HTTP|status' project_setup/github.py

# Locate existing tests for failed issue resolution.
rg -n -C 5 'get_issue\(|resolve_from_branch|issue-[0-9]+' tests project_setup

Repository: v-Kaefer/Github-Project-Automation

Length of output: 17428


Handle unresolved explicit issue tokens without stopping PR Sync.

get_issue() raises GitHubRequestError for a 404, and resolve_from_branch() does not catch it. Catch this error for the explicit branch issue, return no metadata, and let the existing message print without issuing a PATCH.

🤖 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 `@project_setup/pr_autofill.py` around lines 146 - 153, Update
resolve_from_branch’s explicit branch-token path to catch GitHubRequestError
from client.get_issue when the referenced issue is unresolved. Return no issue
and no milestone with the existing explanatory message, allowing PR sync to
continue without issuing a PATCH.

@coderabbitai coderabbitai Bot mentioned this pull request Aug 11, 2026
Merged
7 tasks
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