Skip to content

feat(factory): exact-SHA nightly integration and soaked staging promotion - #344

Open
kvnloo wants to merge 18 commits into
nightlyfrom
factory/nightly-promotion
Open

kvnloo wants to merge 18 commits into
nightlyfrom
factory/nightly-promotion

Conversation

@kvnloo

@kvnloo kvnloo commented Nov 26, 2026

Copy link
Copy Markdown
Owner

Why

Kevin asked that nightly take green feature PRs automatically and that staging hold only code that passed full CI and soaked at least 24 h with no red. This PR adds that, built on the exact-SHA gev-ci/* contract from #343.

What changed

  • scripts/factory/nightly_integrate.py and factory-nightly-integrate.yml. Merge open PRs labeled nightly whose base is nightly or staging and whose head is green on the exact SHA. Run full CI on the exact integration SHA through a fresh factory/nightly-candidate/* ref. If the batch is red, retry one PR at a time. Publish only a SHA that is still green after re-reading the refs, the PR heads and the statuses. The push is a plain fast-forward.
  • scripts/factory/soak_observe.py and factory-soak-observe.yml. Post an hourly gev-soak/nightly status on each validated nightly tip. GitHub's append-only, server-timestamped status history is the soak ledger.
  • scripts/factory/promote_staging.py and factory-promote-staging.yml. Promote one explicit full SHA, failing closed. The SHA must be in nightly history, staging must be its ancestor, its exact-SHA CI must be green, and its soak must be at least 24 h with no red and no gap over 6 h. Refs and statuses are re-read right before the fast-forward push.
  • ci/factory/branch-policy.json and docs/factory/NIGHTLY-PROMOTION.md. The runbook covers soak start and reset, auditing, race layers, bootstrap order (including ci(factory): fast-forward-only main mirror with sync-bot-only writes #341) and credentials.

Scope

Branch gates only. The CI gates are #343, the main sync is #341 and modularity is #342. This branch is stacked on #343, so its commits show here until #343 lands.

Tradeoffs

  • factory-modularity/* is not yet required on PR heads, because it only runs on Actions, which is paused. It is a single policy edit later.
  • Actions pushes need a GitHub App token, because GITHUB_TOKEN cannot push workflow files. No deploy key was added.

Blast Radius

New files only. Repository settings changed outside this diff: rulesets 28125550 (block deletion and non-fast-forward on nightly and staging) and 28125551 (require gev-ci/full on the exact pushed SHA). No bypass is allowed on either.

Verification

  • 27 end-to-end tests run against a real bare git origin that enforces status and fast-forward rules, plus a fake GitHub that owns the clock. They pass.
  • Mutation runs: each guard, disabled on its own, turns the tests red.
  • Live probe: GitHub refused a push lacking the required status, refused a failing one, and accepted a green one.
  • Read-only runs on the live repo: refusals, a real dry-run merge of ci(factory): exact-SHA quality gates for nightly and staging #343, and the soak observer.
  • Evidence is linked in the comment below.

kvnloo and others added 18 commits November 24, 2026 15:56
Policy file plus shared logic: latest-per-context status verdicts (trusted success only, red from anyone), soak computed from GitHub-stamped commit-status history with reset, gap and staleness rules, and plain-push git helpers.
Posts gev-soak/nightly on every validated nightly tip ahead of staging. The append-only status history is the soak ledger.
Merges eligible nightly- and staging-based PRs, validates the exact integration SHA with full CI on a candidate ref, falls back to one PR at a time, and publishes only a re-verified green SHA by fast-forward.
Requires nightly membership, staging ancestry, exact-SHA gev-ci green and a recorded 24 h green soak; re-reads refs and statuses before a plain push.
… wait

Closes the one surviving mutant (status-id freshness guard in wait_for_full).
@kvnloo

kvnloo commented Nov 26, 2026

Copy link
Copy Markdown
Owner Author

Evidence for the final head 1e471af8df8b936b62b3149d191489f071736383.

Exact-SHA CI. A Boat run posted all 9 gev-ci/* contexts as success. Unit: 14,432 tests, 0 new failures. Perf: only the moveEnd benchmark that was already over budget at the baseline. Evidence: https://github.com/kvnloo/gods-eye-view/tree/factory/ci-evidence/1e471af8df8b936b62b3149d191489f071736383/20261126T021659Z

Tests. python3 -m unittest discover -s scripts/factory/tests -p test_branch_gates.py ran 28 tests, all OK, in 47 s.

Mutation check. I disabled 14 guards one at a time; each one turned the suite red:

  • promotion: soak, nightly membership, ancestry, ref re-read, CI
  • integration: nightly re-read, PR-head re-read, final status re-read, head eligibility, batch verdict
  • status and soak logic: untrusted creators, resets, gap limit, CI-wait freshness

The CI-wait freshness mutant survived the first run. The last commit adds the test that kills it.

Live server-side probe. This used ruleset 28125518 on factory/ruleset-probe/** with a probe-only context:

Push Result
Create branch, no status GH013 … Required status check "factory-probe/required" is expected, refused
After success accepted
Fast-forward, no status refused
Fast-forward after failure … is failing, refused
Fast-forward after success accepted

The probe ruleset is disabled now. The real rulesets, 28125550 (no deletion or non-fast-forward) and 28125551 (gev-ci/full required on the exact SHA), are active on nightly and staging with no bypass.

Read-only runs on this repo:

Command Result
Integration dry run nothing labeled yet
Promote 53f0caa no-op (already staging)
Promote da15c7b refused: not in nightly
Promote 7646568 refused: not in nightly
Promote a short SHA or a branch name exit 2
Soak observer nothing tracked

Refs were identical before and after. A dry-run integration of #343 built merge 7f3c587 locally, with first parent nightly and a tree equal to the #343 head. It was not pushed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant