Skip to content

Fix PR URL handling in factory ceo input resolution#457

Draft
gx-ai-architect wants to merge 1 commit into
mainfrom
factory/run-b4131428
Draft

Fix PR URL handling in factory ceo input resolution#457
gx-ai-architect wants to merge 1 commit into
mainfrom
factory/run-b4131428

Conversation

@gx-ai-architect

Copy link
Copy Markdown
Collaborator

Closes #456

Changes

  • Added _parse_pr_url() regex helper in factory/cli.py to extract owner/repo and PR number from GitHub PR URLs (supports /files and /commits suffixes)
  • Modified _resolve_input() to detect PR URLs before generic GitHub URLs, clone the base repo, and run gh pr checkout <number> to land on the PR branch
  • Added 4 unit tests in tests/test_cli.py:
    • test_parse_pr_url_basic — basic owner/repo + number extraction
    • test_parse_pr_url_with_suffix — handles /files and /commits suffixes
    • test_parse_pr_url_not_pr — regular repo URLs return None
    • test_resolve_input_pr_url — full clone+checkout flow with mocked subprocess.run

Add _parse_pr_url() regex helper to extract owner/repo and PR number
from GitHub PR URLs (including /files and /commits suffixes). Modify
_resolve_input() to detect PR URLs before generic GitHub URLs, clone
the base repo, and run `gh pr checkout` to land on the PR branch.

Closes #456

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.10%. Comparing base (2622152) to head (bb42582).
⚠️ Report is 41 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #457      +/-   ##
==========================================
+ Coverage   87.08%   87.10%   +0.01%     
==========================================
  Files          62       62              
  Lines        9682     9697      +15     
==========================================
+ Hits         8432     8447      +15     
  Misses       1250     1250              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gx-ai-architect

Copy link
Copy Markdown
Collaborator Author

✅ Factory Review: KEEP

Verdict: KEEP
Reason: Clean, focused change: adds PR URL parsing to _resolve_input with correct regex, proper test coverage, and no guard violations

Experiment: #1
Hypothesis: Fix PR URL handling in factory ceo input resolution: add _parse_pr_url() helper, modify _resolve_input() to clone base repo and gh pr checkout N

Guard Checks

Check Result
eval_immutable ✅ PASS
scope ✅ PASS
git_clean ✅ PASS

Smoke Test

  • 313 passed, 0 failed, 3 warnings (all pre-existing)

Code Quality Assessment

  • Critical issues: 0
  • Important issues: 0
  • Minor issues: 0

Code Review Notes

  • Regex correctly anchored with named groups for owner/repo/number
  • Handles /files and /commits suffixes plus trailing slash
  • PR number validated as digits-only via \d+ — no injection risk
  • subprocess.run with check=True will raise on clone/checkout failure
  • Tests cover basic parse, suffix variants, rejection of non-PR URLs, and full flow with mocked subprocess

Posted by Factory Reviewer

@gx-ai-architect

Copy link
Copy Markdown
Collaborator Author

✅ Factory Review: KEEP

Verdict: KEEP
Reason: Clean, well-tested feature addition — PR URL parsing in _resolve_input() with proper regex validation and 4 new tests

Experiment: #1
Hypothesis: Fix PR URL handling in factory ceo input resolution

Score Comparison

Metric Value
Before N/A
After N/A (all 231 tests pass)
Threshold 0.6000

Guard Checks

Check Result
eval_immutable ✅ PASS
scope ✅ PASS
git_clean ✅ PASS
experiment_branch ✅ PASS

Code Quality Assessment

  • Critical issues: 0
  • Important issues: 0
  • Minor issues: 0

Code Review Notes

  • Regex anchored with named groups, no injection risk
  • Handles /files and /commits suffixes plus trailing slash
  • 4 tests covering parsing, suffixes, rejection, and integration flow
  • Follows existing code conventions (module-level compiled regex, underscore-prefixed helpers)
  • CEO preliminary review: CLEAN — all checklist items passing

Posted by Factory Reviewer

@osilkin98 osilkin98 added kind:capability Does something new stage:interface How humans drive it: CLI, docs, ergonomics labels Jun 11, 2026
@RobotSail

Copy link
Copy Markdown
Contributor

@gx-ai-architect we will close this one too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:capability Does something new stage:interface How humans drive it: CLI, docs, ergonomics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix PR URL handling in factory ceo input resolution

3 participants