Publish a rolling Nightly pre-release after validated master updates
Motivation
Users should be able to download the latest successfully validated master build from one GitHub pre-release, without waiting for a versioned release or accumulating dated nightly releases. Rebuilding on a calendar schedule when master has not changed does not serve that purpose.
Scope
Depends on #826, #827, #828, #829 and #830. Implement .github/workflows/nightly.yml as orchestration over the shared tools.ci test, validation, package and release procedures.
Trigger and identity
- Run after canonical
wavefnd/Wavemaster updates have passed common CI, including PR merges and direct pushes. No cron schedule. A manual retry may target an eligible master commit. - Build and validate the exact CI-tested SHA; never substitute the branch's newer HEAD after validation. Only successful canonical master runs may reach the write-enabled publisher.
- Maintain one moving tag,
nightly, and one release namedWave Nightly, withprerelease=trueandmake_latest=false. - Nightly means the newest master commit that completed all required CI, package and artifact checks. A newer failing master commit leaves the previous successful Nightly available.
- Reuse the supported distribution matrix; code-generation targets without a native compiler package are not invented as downloadable host packages. A missing required platform blocks promotion of the entire generation.
- Allow the compiler's existing development version in this channel. Keep versioned-release version/tag validation unchanged.
Publication and replacement
- Finish all target builds, extracted-package checks, checksums and metadata before promoting a generation. Build/test/package failure or cancellation must not delete or move the previous published generation.
- Serialize publication and reject stale runs: a delayed A build must not replace already-published newer B. Check canonical master ancestry and the currently published SHA, not completion time alone. Repeating publication of the same successful generation is idempotent.
- Upload new artifacts under generation-specific names containing the source SHA and verify them before switching the release's active download links and moving the nightly tag. Remove obsolete assets only after the new generation is usable. Keep one public Nightly release rather than a history of dated releases.
- Do not delete the existing release or use delete-first asset replacement as the update strategy. GitHub CLI documents that
--clobberdeletes existing assets before uploading and loses them if upload fails. - Tag, release metadata and assets are separate API mutations: do not claim an atomic multi-file swap. Retain recoverable state, identify every artifact/checksum by SHA, and test interruption/retry/reconciliation around promotion. Restrict movable-tag handling to nightly; preserve versioned release tags.
Generate the release body with the full commit SHA and link, branch, UTC build time, compiler version, workflow run and current artifact/checksum links, followed by:
This release tracks the latest successfully validated master build.
Installation boundary
Nightly is available by explicit manual download from the release page. install.sh and install.ps1 must not select it automatically or accept an explicit nightly installation request; reject that request with a manual-download explanation. Preserve ordinary versioned-release installation and do not filter out all versioned prereleases merely to exclude nightly.
The documented scripts are served from https://wave-lang.dev/install.sh and https://wave-lang.dev/install.ps1 and are not present in the Wave checkout. Identify their owning source repository and coordinate the exclusion there; do not claim the installer restriction is implemented by setting the GitHub prerelease flag alone.
Difficulty: hard.
Completion criteria
- [ ] Canonical master update → successful common CI → complete package matrix → one updated Wave Nightly pre-release; no unchanged-calendar rebuilds.
- [ ] First publication and subsequent replacement use the exact validated SHA and preserve versioned releases and their Latest selection.
- [ ] Failed, cancelled, missing-platform and checksum-invalid builds leave the previous Nightly intact.
- [ ] Tests cover out-of-order completion, duplicate retries, noncanonical/unrelated SHAs and interrupted publication without deleting the last usable artifacts.
- [ ] Release body, tag, generation-specific metadata, checksums and download links agree after successful promotion; recovery handles partial API failure explicitly.
- [ ] Both installation scripts exclude nightly from automatic selection and reject explicit nightly requests, while normal versioned releases still install.
- [ ] Workflow YAML delegates procedures to tools.ci; publish tests use mocked GitHub operations before any live release mutation.
Current-master reproduction: final cutover can remove the last public Nightly
Audited canonical master e1f8effd195b6339c3979b1e091e63c25f1da983 on Linux amd64 with checkout-built Wave 0.0.1-alpha-dev, matching std, Rust 1.89.0, Cargo jobs=2 and LLVM 21.1.8. The master SHA was rechecked before registration. This is a remaining acceptance failure of this issue, which explicitly requires retaining the existing release and recovering from partial API failure. The old Python starting points are historical; the current implementation is Rust.
At publication.rs:808-825, promote deletes the previous public release before updating the nightly tag and publishing the verified staging draft. Injecting failure before the tag PATCH takes effect leaves no public Nightly: the old release and its assets are gone, the new release is still draft, and the tag still points at the old source.
Executed reproduction, using the existing stateful Remote/generation fixture (no live GitHub mutations):
#[test]
fn audit_final_tag_failure_preserves_old_publication() {
let temporary = tempfile::tempdir().unwrap();
let mut remote = Remote::new();
let (directory, mut first) = generation(temporary.path(), 'a', 1);
publication::promote(&mut remote, &directory, &mut first).unwrap();
let (directory, mut second) = generation(temporary.path(), 'b', 2);
remote.fault = Some((
"PATCH".into(), "git/refs/tags/nightly".into(), false,
));
let result = publication::promote(&mut remote, &directory, &mut second);
let public = remote.releases.values()
.filter(|r| r.get("draft") == Some(&Value::Bool(false)))
.count();
println!("result={result:?}; public releases={public}");
println!("old release exists={}", remote.releases.contains_key(&1));
println!("remaining release draft={:?}", remote.releases[&2].get("draft"));
}
The fixture is tools/tests/publication.rs. The audit ran this sequence in an isolated fixture-based harness against the current crate. A temporary test in that integration fixture can be run with:
cargo +1.89.0 test --locked --jobs 2 -p wave-tools --test publication audit_final_tag_failure_preserves_old_publication -- --nocapture
Observed:
result=Err("injected API failure"); public releases=0
old release exists=false
remaining release draft=Some(Bool(true))
Recovery design options — decision required before implementation
These are proposals, not approved or implemented behavior. GitHub's release update and asset upload APIs mutate separate objects; neither offers one transaction for tag, body and asset set.
A. Retain the current public release ID and overlap immutable asset generations (recommended). Keep the old generation and active links usable. Upload new generation-specific names without deleting old assets, verify every new asset, persist active/pending identity and previous tag information, and then perform a recoverable tag/body transition. Reconcile observed remote state after ambiguous responses instead of blindly repeating writes. Delete only obsolete owned assets after the new active state and tag have been read back and verified. A failed cleanup is retryable, not a reason to remove the active generation.
Tradeoff: old and new assets are temporarily visible together on the one public release. Validation must explicitly recognize active/pending owned sets during transition and still require the exact 29-asset, nine-target active generation and final cleaned set. The extra temporary assets are not permission to accept arbitrary extras, mismatched hashes or incomplete packages. API mutations remain non-atomic; the recovery ledger and old bytes must survive interruption.
B. Publish immutable per-generation releases behind a stable Nightly index. Keep generation URLs fixed and update the stable Nightly entry's links only after the new generation is verified. Retain the previous generation until the switch is confirmed and a bounded cleanup policy allows removal. This gives clearer rollback and avoids copying assets during promotion, but deliberately changes this issue's one-public-release/download-layout contract: multiple generation releases become public, and canonical direct asset links need a compatibility plan. It needs explicit approval of that policy change.
C. Keep draft replacement and restore a backup after delete-first failure (not recommended). A retained local/remote backup could recreate the previous release, but restoration needs further successful API calls. It cannot prevent a public download outage while GitHub is unavailable and does not satisfy the existing no-delete-first requirement.
Please mention @LunaStev to discuss the design before starting implementation.
Required checks after the design is chosen
- [ ] Preserve the last usable public generation through failures before/after tag and release-body mutations, including lost successful responses and process interruption.
- [ ] Reconcile idempotent retry, stale source/run/attempt identity, concurrent publication and partial cleanup from durable observed state.
- [ ] Preserve strict canonical CI eligibility, installer approvals, package identities, digests and the complete nine-target/29-asset active generation; no gate bypass.
- [ ] Test failure at every transition with mocks before any live release mutation.
Related: #1078 isolates the verification-before-cleanup staging-leftover defect and can be tested independently of this final-cutover design. No implementation, release mutation or status change is included in this reproduction update.
Recovery design decision — option A selected (2026-11-04)
The maintainer selected option A from the recovery comparison above. Retain the existing public Nightly release ID and preserve the previous generation while uploading immutable, generation-specific new filenames. Temporary coexistence of the old and pending asset sets is part of this choice.
The implementation contract is:
- Persist recoverable active/pending identities and the previous tag state before the final transition; interruption must not depend on an ephemeral CI workspace for recovery.
- Verify all new assets and canonical source/run/attempt identity before activation. Keep strict canonical CI eligibility and installer approval gates.
- Reconcile tag and release-body changes from observed remote state after partial failure or a lost successful response. Do not assume those API mutations are atomic.
- Keep the previous usable generation and its download links available until the new active state and tag are independently verified. Do not delete the existing public release as an update step.
- Remove only obsolete owned assets after verified activation. Cleanup failure must be retryable while the new active generation stays usable.
- During transition, explicitly recognize the owned active/pending sets without accepting arbitrary extras or weakened hashes. Require the complete nine-target/29-asset active generation and the exact final cleaned set.
- Exercise failures before and after every mutation, cancellation/interruption, stale attempts, duplicate retries, ambiguous responses and partial cleanup with mocked operations before any live publication.
#1078 remains the separate staging-leftover ordering defect. This comment records the selected recovery design; no live release, tag or asset has been changed.