Skip to content

[OTHER] Retire superseded remote branches after VNext backlog canonicalization #358

Description

@Joncallim

Execution mode: implementation
Depends on: none

Issue Type

Repository hygiene / governance

Context

The 2026-09-03 aggressive VNext backlog/branch review has canonicalized useful design work into current main and current GitHub issues. PR #331 is closed/superseded; its valid verification-goal requirements live in #355/#356. The unmerged reviewer-scope branch's useful requirements live in #188/#337/#338. Several other refs are simply leftovers of already-merged PRs.

The connected GitHub surface used for planning cannot delete remote refs directly, so cleanup must be executed by a repository-authorized agent/CLI. Never delete by branch-name pattern alone. Re-read current remote SHA/open-PR/reachability immediately before each deletion batch.

Keep:

Desired Outcome

The remote branch list contains no reviewed superseded pre-VNext implementation/review branches. Every deleted ref is either already merged/reachable from main or has a documented supersession handoff preserving its useful requirements. No open PR/current implementation branch is removed, and PR/commit/issue history remains intact.

Tasks

Already-merged leftovers

Delete only after confirming the expected PR/commit is merged/reachable from current main:

Superseded #187 / PR #331 lineage

PR #331 is closed without merge. Its valid requirements/test ideas are preserved in #187/#355/#356. Delete only after confirming no candidate has gained a new open PR or newer unported commits:

  • architecture/issue-187-goal-run-policy-final — former PR feat: implement project verification goals and proof runs (#187) #331 head.
  • architecture/issue-187-verification-goal-execution-policy
  • architecture/issue-187-verification-goal-execution-policy-r1
  • architecture/issue-187-verification-goal-run-policy
  • architecture/issue-187-verification-goal-run-policy-v1
  • codex/issue-187-goal-definition-v2

These are historical evidence only. New proof-run work starts from current main; never rebase/cherry-pick these branches wholesale.

Superseded reviewer-scope branch

Before deletion, confirm its head has not acquired newer unported commits. If changed, stop and open a narrow preservation finding rather than deleting.

Implementation Sequence

  1. Fetch immutable current inventorygit fetch --prune/GitHub branch + open-PR APIs; record branch -> current SHA -> open PR -> reachability/disposition table for only the named candidates.
  2. Protect live refs — assert main exists/current; assert PR docs: align repository agent instructions with VNext runtime truth #351 head is excluded while PR docs: align repository agent instructions with VNext runtime truth #351 open; detect any new open PR/head created after this issue and exclude it automatically.
  3. Merged-ref proof — for each merged candidate verify exact current head commit is an ancestor/reachable from current main and expected PR is merged; if head advanced after merge, stop that branch.
  4. Superseded-ref proof — for each [EPIC] Verification goals and proof-run lifecycle #187/reviewer candidate verify no open PR and current head equals/is within reviewed superseded lineage; compare current commits against the relevant closed PR/issue handoff and stop on any unported new commit.
  5. Dry-run deletion manifest — print exact candidate name + pre-delete full SHA + disposition + preservation issue/merged PR; require no wildcard/pattern expansion and no unexpected ref.
  6. Delete in two batches — already-merged refs first; re-fetch/reconcile; then superseded unmerged refs. Use normal remote ref deletion/API, not force-moving refs.
  7. Post-delete reconcile — refetch branch/open-PR state and prove every deleted ref absent, protected/live refs present and no open PR references deleted head.
  8. Audit comment — concise exact deleted branch/pre-delete SHA list plus any deliberately skipped candidate/reason. Do not paste local paths/secrets.

Primary Code / Control Seams To Inspect First

This is remote Git governance rather than application code. Inspect:

Do not edit application files merely to perform branch cleanup.

Orthogonal Checkpoints

  1. Completeness: compare GitHub API and fetched Git remote inventory; detect refs created/changed since planning.
  2. Merged reachability: branch head advanced after merged PR, squash/rebase ancestry edge cases, wrong PR association.
  3. Supersession preservation: unmerged commits not represented in canonical issues; reviewer/[EPIC] Verification goals and proof-run lifecycle #187 requirement loss.
  4. Open-PR safety: branch becomes PR head between inventory and delete; PR docs: align repository agent instructions with VNext runtime truth #351 state changes; new legitimate branch appears.
  5. Destructive command safety: exact branch names quoted; no wildcard/regex; never main; no force-update as substitute for deletion.
  6. Race/TOCTOU: re-fetch immediately before each deletion and compare expected SHA; delete only when ref still points to reviewed SHA.
  7. Postcondition: only expected refs removed; Git history/PR/issues remain accessible; branch count/list understandable.

Acceptance Criteria

Out of Scope

Implementation Scope

Small but destructive - one repository-hygiene operation with two deletion batches and mandatory re-fetch/review gates.

Technical Notes

If any candidate fails its expected-state assertion, skip it and report the exact mismatch. Partial safe completion is preferable to deleting a branch whose current meaning changed.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions