Derive release merge wait from CI duration and refresh a safe main advance once

Merged
UN
4d ago
+483-16

Daily Release PR #171 exhausted the fixed 30-minute merge wait while required tests were still running. Earlier main advances also aborted otherwise safe release preparation or left the release PR BEHIND.

The job now measures successful test (22) and test (26) jobs from the last 20 successful main push CI runs. It uses nearest-rank p95 plus the larger of 15 minutes or 25%, bounded to 60–120 minutes under an explicit 360-minute job timeout, and records the derivation in the log and job summary. A read-only execution of the workflow measurement step found 40 samples: p95 1,859 seconds plus 900 seconds margin, yielding the 60-minute floor.

A safe main advance during preparation or waiting rebases the release branch once and restarts the full measured wait. A published branch update uses the previous head as its push lease, and the merge API receives the new head SHA. Every intervening commit is checked for package/lock release-version changes or changes to the changelog, manifest or release notes, including changes later reverted. Metadata drift, conflicts, non-ancestor main and a second advance abort.

Validation:

  • npm run release:check and bun run release:check, with isolated HOME and git configuration: 1,045 passed each, zero failures or skips. Exact 100/100/100/100 coverage across 19 authored modules: 11,640 lines/statements, 337 functions and 3,964 branches. Both gates also passed lint, docstrings, zero duplication, privacy, audit, packing, changelog and publish-attestation checks. Independent candidate snapshots produced the same package hash.
  • node --test test/release-merge-policy.test.ts test/daily-release-plan.test.ts test/release-approval.test.ts test/release-workflow.test.ts: 60/60, also executed through the linked pm test runner. The tests execute the workflow's own shell and use real temporary git histories and a real non-git pm tracker.
  • bun test --timeout 600000 test/release-merge-policy.test.ts: 24/24 new regressions.
  • Behavioral revert controls: fixed 30-minute wait failed 2 regressions; bypassed metadata guard failed 8; restored abort-on-main-advance failed 3; removed deadline restart failed 1. All controls were restored before the passing gates.
  • Strict tracked-project health passed with isolated identity. Post-commit privacy audited 6,683 objects with approved identities and no secret or host-path findings.

The new workflow regressions run in the existing CI release gate on Node 22 and 26. CI run 39992427193 passed 4/4 matrix jobs, including 2/2 required checks, on da42c756b9aa1615e26e69527c2f4eea09b7c8e1. The current check rollup is 8 success, 2 skipped and 1 neutral, with no failures or pending checks. Skipped, neutral and unavailable automated reviews do not establish review approval; review remains pending. After merge, the orchestrator dispatches Daily Release.

PM item: pm-github-release-merge-wait (candidate evidence). The item remains in progress and its claim is released for orchestrator verification.

Summary by Sourcery

Make Daily Release waits adaptive to CI performance and safely recover once from eligible main-branch advances.

New Features:

  • Derive the Daily Release merge wait from recent successful CI durations and record the calculation in workflow logs and summaries.
  • Allow one safe main-branch advance to refresh the release branch and restart protected checks and the measured merge wait.

Bug Fixes:

  • Prevent release preparation from timing out while required CI is still running.
  • Prevent safe main advances from leaving the release PR behind or aborting unnecessarily, while failing closed on metadata drift, conflicts, non-ancestor updates, and repeated advances.

Enhancements:

  • Add a 360-minute workflow timeout and enforce head-specific branch updates and merge verification after a refresh.
  • Document the adaptive release wait and main-advance safety policy.

Documentation:

  • Document the adaptive merge wait and one-time safe main refresh behavior for Daily Release.

Tests:

  • Add comprehensive policy and workflow regression coverage using real timing data, shell execution, and temporary Git histories.

Chores:

  • Record the release merge-wait work in project-management history and changelog.

Summary by cubic

Fixes the Daily Release workflow's fixed 30-minute merge wait, which expired while required tests were still running on PR #171. The wait is now derived from measured CI durations, and a safe main advance may refresh the release branch once.

  • The wait is the nearest-rank p95 of successful test (22) and test (26) job durations from the last 20 successful main push runs, plus max(15 min, 25%), bounded to 60–120 minutes under the job's 360-minute timeout; the derivation is logged and written to the job summary.
  • A main advance during preparation or waiting rebases the release branch once and restarts the full measured wait, using the previous head as a push lease and passing the new head SHA to the merge API.
  • Conflicts, release metadata drift (including changes later reverted), non-ancestor main, and a second advance abort; dependency-only changes are eligible.

Validation: npm run release:check and bun run release:check each passed 1,045 tests with exact 100/100/100/100 coverage across 19 modules; the workflow-focused pm test passed 60/60 and the new regressions passed 24/24 under Bun. Four behavioral revert controls failed as expected, and both package dry runs produced the same package hash.