Skip to content

[#752] feat: realign stale PRs and revalidate their heads - #769

Merged
rucka merged 42 commits into
mainfrom
feature/US-752-delivery-realign-a-stale-pr-and
Nov 29, 2026
Merged

rucka merged 42 commits into
mainfrom
feature/US-752-delivery-realign-a-stale-pr-and

Conversation

@rucka

@rucka rucka commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

PR Information

Story: #752
Type: Feature
Assignee: @rucka
Merge strategy: squash

Closes #752

Summary

Delivery can realign a PR when repository policy requires an updated base, then revalidate the published head before approval. Covers AC1–AC7.

Changes Made

  • Add bounded validation replay with independent, persisted alignment and fix budgets.
  • Expose the policy-required base update decision and add lease-protected alignment with conflict rollback.
  • Route the shipped delivery workflow and bind review, checks and approval to the current head.
  • Update ADR-037, workflow documentation, distribution mirrors and tests.

Services to Release

  • @pair/pair-cli: delivery host integration.
  • @pair/workflows: validation, execution and gate routing.

Testing

  • pnpm quality-gate: passed at closing.
  • Delivery host suite: 136 tests passed, including repeated base moves, fixes, head-specific evidence and resume.
  • Mutation: not measured. Duration delta: not measured.

Classification

risk:red · cost:yellow

Review matrix for 1704ae9
Dimension Tier Basis
Service/domain criticality green Changed workspaces have adopted Low criticality
Change/diff risk yellow Shared workflow grammar, engine, Git adapter and CLI dispatch
Business impact red Executable change to the core Collaborative Workflow
Security relevance yellow Alignment extends Git publication with ref validation, a remote head lease and host read-back
Coupling balance yellow Gate policy, alignment facts and recorded head must agree across both runners. Session preflight still spends attempts before dispatch

Cost is yellow for extra review and CI runs bounded by the workflow limits. Confidence is high for the inspected diff.

Reviewer Guide

Inspect lease and conflict handling, independent budgets across replay and resume, and invalidation of review and check evidence after head movement.

T added 5 commits November 28, 2026 18:30
Complete T-4 and exercise delivery across fixes and base moves.

Refs: #752
Complete T-5 distribution verification.

Refs: #752
@rucka rucka self-assigned this Nov 28, 2026
@rucka rucka added the pr-state:to-be-reviewed PR state: awaiting review / gate label Nov 28, 2026
@rucka rucka added the risk:red Classification: high risk tier label Nov 28, 2026

@rucka rucka left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Verdict

CHANGES-REQUESTED · risk:red · cost:yellow

Open findings: 5. Adopted delivery skips alignment.

PR: #769 · Story: #752 · Author: rucka · Review: Pair · 2026-11-28 · feature
Reviewed head: 76a7d5ceed5ce750810f502e8a40510831c5aa62
Context: How-to 11 · staff-engineer · GitHub Projects via gh
Tier: 1 reviewer · 2 working days · extended checklist · explicit human approval required by the red tier.
Identity: session · Light row: n-a — no identity (session mode)

Classification matrix
  • Criticality green (adopted Low)
  • Diff yellow (shared engine)
  • Impact red (core workflow)
  • Security yellow (Git publication)
  • Coupling yellow (gate handoff)

Assessments

Security — Input validation

Yellow. The helper validates refs and SHAs. The adapter drops the gate's base identity before dispatch.

Evidence

The helper checks the supplied repository, refs, remote values and worktree. The caller needs to bind those values to the gate decision (F3).

Security — Output handling

Green. The Git helper passes arguments directly and returns JSON.

Evidence

Verified argument arrays, the structured handoff and commit-ID validation in the CLI launcher.

Security — Authentication

Green. Git and GitHub retain the configured credentials.

Evidence

The diff adds no credential store, dependency or authentication path.

Security — Authorization

Yellow. The push uses a remote head lease. Gate permission is tied only to the head.

Evidence

F3 covers authorization to begin alignment. F5 covers the missing host read-back in the session runner.

Security — Introduced vulnerabilities

Yellow. The new policy-binding gap is tracked in F3. Zero introduced red findings identified.

Evidence

Checked command construction, remote repository matching and commit custody.

Cost

Yellow. Alignment adds review and CI runs on existing providers.

Evidence

Delivery declares three alignment attempts. F4 shows a configured process retry can exceed a declared limit.

Architecture (Coupling)

Yellow. Git policy, workflow state and publication depend on the same target.

Evidence

The adapter boundary is appropriate. A typed decision shared by both runners would close F3 and F5.

Bug fix — Red test before fix

Not applicable. Feature PR.

Details

Findings by severity

Major (blocking, all new in this first review)

  • F1. Release changeset is missing. GitHub's Changeset present jobs failed. The diff adds no .changeset/*.md, and the PR has no no-changeset label. Add the changeset for the release-facing CLI behavior. .github/workflows/ci.yml:43
  • F2. The normal delivery command skips alignment. The built locator selects the tracked adoption file, which has neither base-current nor align. The integration fixture explicitly loads the dataset copy. Update the adopted workflow and exercise named resolution (AC1/AC7). .pair/adoption/tech/workflows/delivery.yaml:34
  • F3. Alignment reuses a decision after the PR base changes. pr-alignment rechecks H and accepts the latest target. If the PR moves from strict B to non-strict C at the same H, the earlier decision still permits a push against C. Bind launch to the gated base ref/SHA or recheck policy before dispatch (AC2/AC3). workflow-facts.mjs:171
  • F4. Process retries bypass the operation limits. A return with max: 1 and retries: 1 produced attempt 2 with one saved charge. Fix retries use the same path around reservation. Enforce and persist the limits before a process retry (AC6). engine/index.ts:1081
  • F5. Session alignment lacks host facts and verification. /pair-workflow-run sends the generic packet without required PR/base refs and base SHA. Session record lacks the CLI remote read-back. Share alignment preparation and result verification across runners (AC3/AC5). session.ts:595
Positive feedback

Disposable Git fixtures cover lease refusal, remote movement and conflict rollback.

Functionality and requirements

AC4 passes the conflict fixtures. AC1–3 and AC5–7 remain open through F2–F5. Card closure requires green gates and explicit approval.

Testing and quality gates

pnpm build and pnpm gate:review passed in a detached worktree matching the reviewed head. The gate passed 3,925 tests, type checks, lint, and CSS, skills and docs checks.

The 157 focused tests passed. GitHub's changeset gate failed on the reviewed head. Review enforcement is advisory under the repository's adopted settings. Mutation was not measured.

Adoption compliance

Level 1. No new dependencies or infrastructure. ADR-037 records bounded return. F1–F5 cover release and workflow compliance. Regeneration verified all 24 changed mirror files.

Tech debt

The shipped definitions retain an exhaustion-triggered final-review alongside the loop's exhaustion stop. The fresh review occurs inside the loop.

Documentation

The schema, kind reference, example and ADR describe bounded return. The adopted definition lags the example (F2).

Performance and deployment

Extra GitHub reads and Git operations run on the delivery path. No datastore or migration change. Git fixtures cover conflict abort and denied publication.

@rucka rucka added pr-state:not-approved PR state: changes requested and removed pr-state:to-be-reviewed PR state: awaiting review / gate labels Nov 28, 2026

@rucka rucka left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Verdict

APPROVED · risk:red · cost:yellow · zero open findings on 0976d9fe5887f9be408462788c9fcbb9dfb0418a.

  • F11 resolved. A head change detected in session preflight records a typed failure without reserving an alignment attempt or starting the agent. The shipped bundle regression passes.
  • F14 resolved. The twelve packaged and installed GitHub adapters have the same SHA-256. The workflow dry-run gate passed.
  • F13 remains resolved on current main. The combination preserves workflow supervision and alignment returns, and the merge tree is clean.
  • F2 and F5 retain their resolution across integration. The CLI tests run the adopted delivery workflow and its Ready selector, and the session tests refuse a claimed head without publication. The positive path rechecks the published head before approval and merge.
  • F1, F3–F4, F6–F10 and F12 retain their recorded resolutions. The current domain check passes after retiring a suppression removed from the fixture during integration.

GitHub CI passed on the reviewed head, including the domain baseline and both smoke runners. The complete local gate encountered process and browser timeouts under load. Focused workflow, CLI, policy and browser suites passed separately. Mutation was not measured.

@rucka
rucka merged commit 2d9130b into main Nov 29, 2026
8 checks passed

This branch was successfully deployed

1 active deployment
Website Preview — 0976d9fe Deployed Nov 29, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-state:not-approved PR state: changes requested risk:red Classification: high risk tier

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delivery: realign a stale PR and revalidate its new head

1 participant