Skip to content

[AI:Task] T20260705-94A14772: Split closed-pr-recovery.ts under the 200 code-line cap by extracting rejection-issue creation - #49

Open
dzykovic wants to merge 1 commit into
masterfrom
ai/tasks/T20260705-94A14772
Open

[AI:Task] T20260705-94A14772: Split closed-pr-recovery.ts under the 200 code-line cap by extracting rejection-issue creation#49
dzykovic wants to merge 1 commit into
masterfrom
ai/tasks/T20260705-94A14772

Conversation

@dzykovic

@dzykovic dzykovic commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Task T20260705-94A14772: Split closed-pr-recovery.ts under the 200 code-line cap by extracting rejection-issue creation

Priority: 4 | Parent: F20260705-CC7FF1B9

Summary

Problem

engine/pipeline/composers/closed-pr-recovery.ts is 376 total / ~293 code
lines (excluding logging/comments/JSDoc) — well over the engine/pipeline/**
≤200 cap.
A cohesive seam is the manual-issue creation path:
loadRejectedIssueTemplate (303-319) + createRejectionIssue (321-360),
~57 lines that deal only with tracker-issue templating and creation.

Solution

Extract loadRejectedIssueTemplate + createRejectionIssue into
engine/pipeline/composers/_shared/rejection-issue.ts (named exports taking
the narrow deps they use), with a colocated rejection-issue.test.ts.
processItem calls the extracted createRejectionIssue. If the file is still
marginally over, additionally extract the reopenItem frontmatter-rewrite
helper (267-295).

Behavior-preserving: the reopen/reject/duplicate decision logic and MAX_REOPENS
cap stay in closed-pr-recovery.ts. Keep all logging intact.

Affected Files

  • engine/pipeline/composers/closed-pr-recovery.ts:303-360 — remove the two functions, import them
  • engine/pipeline/composers/_shared/rejection-issue.ts — new: extracted template load + issue creation
  • `engine/pipeline/composers/_shared/rejection-issue.t

[…truncated]


Automated by AI Automation Pipeline. Current state is tracked via the PR
label (ai:processing, ai:in-review, ai:ready-to-merge, ai:failed) and the
PR comments — not this description.

Copilot AI lite review requested due to automatic review settings August 6, 2026 22:39

Copilot AI 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.

Pull request overview

This PR reduces the size/complexity of the rejection-handling composer by extracting cohesive helper logic into shared modules under engine/pipeline/composers/_shared/, keeping closed-pr-recovery.ts focused on orchestration while preserving existing behavior.

Changes:

  • Extracted manual “rejection issue” templating + tracker issue creation into _shared/rejection-issue.ts.
  • Extracted work-item reopen frontmatter rewrite into _shared/reopen-work-item.ts.
  • Extracted diagnoser-agent invocation + parsing into _shared/rejection-diagnoser.ts and updated the composer to use it, with new unit tests for rejection-issue helpers.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
engine/pipeline/composers/closed-pr-recovery.ts Replaces in-file helper implementations with imports from _shared/*, keeping orchestration and decision logic in place.
engine/pipeline/composers/_shared/reopen-work-item.ts New shared helper to rewrite work-item frontmatter for reopen + sync to DB.
engine/pipeline/composers/_shared/rejection-issue.ts New shared helper for loading rejected-issue-body.md and creating a manual tracker work item.
engine/pipeline/composers/_shared/rejection-issue.test.ts Adds focused unit tests for template loading + tracker issue creation behaviors.
engine/pipeline/composers/_shared/rejection-diagnoser.ts New shared helper for running the diagnoser agent and extracting the recommendation: result.
.operator/data/tasks/T20260705-94A14772.md Marks the task as completed and records completed_at.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants