T-IVEJ-prs-once-at-close
Status: closed/done · Impact: high · Complexity: medium
D-S30G migration step 3, second half: prs[] becomes a historical
record written once in the terminal close commit. The mid-flight
record-PR commit to main (one per PR open) retires; the lease’s
pr_number — already set by task-work’s transition to awaiting-review —
is the live binding. Independent of the stamp/start retirement (T-5LP4).
| Location | Role today |
|---|---|
apps/sdlc/skills/task-work/append_pr_url.ts#appendPrUrl | Step 10.4 script: appends the PR URL to prs: frontmatter and commits to main (assertRepoOnMain guard, record-pr lifecycle subject, docs regen + rebase-push) |
apps/sdlc/skills/task-work/SKILL.md | Step 10.4 invokes the append before the Step 10.5 lease transition; carries a crash-recoverability rationale for that ordering |
apps/sdlc/lib/model/entities/task/ops/close-commit.ts | Terminal close commit; verifies/appends a single --prUrl into prs[] idempotently |
apps/sdlc/skills/task-close-out/ | Close-out flow; per the task schema it verifies/appends prs[] at close |
Proposed
Section titled “Proposed”No mid-flight prs[] write exists. At PR open, the only record is the lease
(pr_number via the Step 10.5 transition). At close, close-commit
accepts every PR URL the task produced (repeatable flag) and lands the full
ordered list in the one terminal commit. The crash window between gh pr create and the lease transition is accepted: an unbound PR is discoverable
by branch name (the probe’s open-PR lookup already does this).
Approach
Section titled “Approach”close-commit.ts: make the PR flag repeatable (--pr-url, N occurrences, order preserved, idempotent against URLs already present). TheCLOSE-COMMIT ... prs=marker reports the final count.task-work/SKILL.md: remove Step 10.4 (theappend_pr_url.tsinvocation) and its ordering rationale; the transition toawaiting-reviewwith--pr-numberbecomes the sole post-create step. Note the accepted crash window and the by-branch discovery fallback.- Delete
append_pr_url.ts(itscomputeAppend/writePrsFrontmatterhelpers live in the shared lib consumed byclose-commit.ts— verify nothing else imports the script before deleting). task-close-outskill: confirm the close flow passes every PR URL for the task (from the leasepr_numberandgh pr listby task branch) through the repeatable flag; update its prose where it references the mid-flight append.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
apps/sdlc/lib/model/entities/task/ops/close-commit.ts | modify | Repeatable --pr-url; ordered, idempotent multi-append |
apps/sdlc/skills/task-work/SKILL.md | modify | Step 10.4 removed; post-create flow is the lease transition alone |
apps/sdlc/skills/task-work/append_pr_url.ts | delete | Mid-flight writer retired |
apps/sdlc/skills/task-close-out/ | modify | Close flow gathers the full PR list and passes it to close-commit; prose updated |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1:
sdlc task close-commitinvoked with two--pr-urlvalues lands both, in order, in the terminal commit’sprs[]; re-invoking with a URL already present adds nothing. - AC-2:
apps/sdlc/skills/task-work/append_pr_url.tsno longer exists, and no file underapps/sdlc/references it (checked with a repo-wide search for the script name). - AC-3:
apps/sdlc/skills/task-work/SKILL.mdcontains no Step 10.4 append; the PR-open flow goesgh pr create→ lease transition with--pr-number. - AC-4: a task closed through the updated flow ends with
prs[]populated in its terminal commit and norecord-prcommit anywhere in its history.
Out of scope
Section titled “Out of scope”- The stamp/start-commit retirement (
T-5LP4). - Schema changes to
prs[](shape is unchanged — only the write moment moves). - Multi-PR consolidation flows (
/sdlc:consolidate-task-prs) beyond prose references to the retired step.
Dependencies
Section titled “Dependencies”D-S30Gshould be flipped toopen/acceptedbefore this lands (its migration step 1); it merged asopen/proposed.