Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Versions and Upgrades

Release status

Check the tags page and the releases page for the current list, or run git ls-remote --tags origin and gh release list --limit 100. Until a release tag exists, non-production deployments may pin a specific commit SHA and record the version and commit reported by the console diagnostics page. Both mergespan-prod and mergespan-prod-ingress must wait for a stable release tag, never an RC. The tag-driven release workflow is present on main; the first published tag will be the first release. This tree’s workspace version is 0.1.0; a release tag for this tree is v0.1.0, and its release candidates are v0.1.0-rc.1, v0.1.0-rc.2, and so on.

This documentation describes the code at main. It does not invent version numbers or release dates beyond the workspace version checked into this tree.

Version and build identity

The release version has one source of truth: [workspace.package] version in the root Cargo.toml. Every crate and runtime inherits it with version.workspace = true, so the native binary, Worker and dashboard report the same version. Diagnostics also report the full Git commit compiled into the build.

crates/engine/build.rs resolves the repository’s actual HEAD at compile time and embeds the full commit; crates/engine/src/build_info.rs exposes it as GIT_COMMIT and the workspace version as VERSION. The commit is unknown when the workspace is not the Git top-level or has no Git metadata. Both the native runtime and the Worker depend on this crate, so one build script gives both artifacts the same identity. GET /health remains a liveness-only response and does not carry version or commit data.

Release procedure

  1. Change [workspace.package] version with a normal pull request. Use a 0.x minor bump for any breaking Durable Object storage or configuration-format change. Run cargo check --workspace without --locked to refresh Cargo.lock, review the lockfile diff to confirm only workspace package versions changed, then commit the updated lockfile with the pull request.

  2. Merge the pull request to main with the repository’s squash-merge policy.

  3. Create and push the release candidate from a clean local main that contains the squash commit:

    git fetch origin --tags
    git switch main
    git pull --ff-only origin main
    git tag -a vX.Y.Z-rc.1 -m "MergeSpan vX.Y.Z-rc.1"
    git push origin vX.Y.Z-rc.1
    

    The workspace version stays the plain X.Y.Z; the -rc.N marker lives only in the Git tag, the release name and the release evidence. Lightweight tags are peeled correctly, but an annotated tag is the repository convention. The peeled commit must be on origin/main.

  4. Wait for the release workflow to build and publish the RC as a GitHub prerelease. An RC is never deployed to mergespan-prod or mergespan-prod-ingress. Fix forward with rc.N+1; do not move or delete an RC tag that has been pushed.

  5. After the RC is published and tested, tag the same squash commit for the stable release:

    git tag -a vX.Y.Z -m "MergeSpan vX.Y.Z"
    git push origin vX.Y.Z
    

    The stable tag does not rebuild. It promotes the original RC assets after resolving the unique successful RC tag-push run for that commit.

  6. The tag push runs .github/workflows/release.yml. It never deploys anything and never changes repository settings, rulesets, secrets, runners or Workers.

Release candidates

A release candidate is vX.Y.Z-rc.N. The workspace version stays the plain X.Y.Z, so an RC and its stable release are built from the same source version and carry the same six asset names (mergespan-linux-amd64, mergespan-linux-arm64, mergespan-worker-X.Y.Z.tar.gz, and one .sha256 each). The RC number never changes the artifact names or the version compiled into the binary.

The tag checker understands both forms and reports channel (stable or rc), prerelease (true/false), and rc_number for an RC. It fails closed on an RC tag unless the caller sets RELEASE_ALLOW_RC=1; the release workflow sets it only for a pushed RC and a read-only dispatch validation of an existing RC tag. The stable path never receives it.

An RC tag push runs:

  1. the same shared ci-build checks as the required CI job, with release caches disabled;
  2. A’s explicit long invariant suite, cargo test --locked -p mergespan-engine --lib full_ci -- --ignored;
  3. the native checkpoint restart smoke against the freshly built dist/mergespan-linux-* binary that matches the Linux runner architecture;
  4. the Worker checkpoint restart smoke against the freshly built dist/mergespan-worker-X.Y.Z.tar.gz with pinned Miniflare;
  5. when a previous stable release exists, the real old-asset continuation: the published previous release’s matching Linux binary seeds a checkpoint and the RC binary continues it, and the previous Worker package seeds Durable Object SQLite state that the RC package reads. The same run must have passed the long Full CI A suite before the upgrade artifact may claim I1-I4. If the previous asset is missing, cannot run, or the evidence is absent, the upgrade gate is BLOCKED; it is never reported as a pass. The Worker smoke itself prints I3/I4 as BLOCKED for its harness; those invariants come from A’s suite, not from that smoke.

The RC then writes release-evidence.json and its independent .sha256, uploads them with 7-day retention, verifies the six original assets again, and publishes the tag as a prerelease with gh release create --verify-tag --generate-notes --prerelease --latest=false only after every gate succeeds.

Stable promotion

A stable tag vX.Y.Z requires exactly one successful, published, same-commit RC. There is no stable rebuild and no first-release exception: SKIP(no previous stable) only skips the historical upgrade proof, not the RC requirement. The stable path:

  1. queries the complete paginated release list and resolves the unique successful .github/workflows/release.yml tag-push run for the stable commit whose head_branch is vX.Y.Z-rc.N; multiple matching RC runs, a dispatch run, an expired run, a failed run, or a missing published prerelease is BLOCKED;
  2. downloads that run’s original release-bundle and release-evidence artifacts for the exact attempt, verifying each archive’s SHA-256 against the Actions artifact API (the release page checksums are never a trust source);
  3. verifies the evidence digest, the exact repository/workflow/run/attempt/ commit/tag metadata, the 7-day retention window, the six-file set and every asset byte, and—when a previous stable exists—the upgrade evidence from the same RC run;
  4. copies those unchanged six files into the stable publish directory and re-runs the six-asset structural verification without building;
  5. refreshes origin with the job token and re-reads the stable tag immediately before publishing, requiring it to still peel to the stable commit and remain on origin/main;
  6. publishes those exact bytes with gh release create --verify-tag --generate-notes --title vX.Y.Z.

A missing or ambiguous RC, a wrong commit, a fork/other workflow, a failed or expired run, an artifact digest mismatch, a moved tag, a non-qualified manifest, or a configured previous stable without real upgrade evidence all fail closed. A missing previous-stable continuation is BLOCKED, never green.

Published tags are immutable by policy: never move or delete a vX.Y.Z tag after it is published. The close-to-publish refresh is a best-effort check, not an atomic tag lock. If a tag was moved or deleted, or a release must be retried after its assets were published, publish a new version and tag; do not reuse the old one. Re-running the workflow for an unchanged tag is only for a failed run before publication.

Manual dispatch, branch validation and runner trust

Manual dispatch has two read-only modes. Neither has contents: write; neither creates a tag, a release or any other remote write. Dispatch is accepted only from the repository default branch (main) and the exact same-repository branch ci/full-ci-c, both pinned by the workflow only. A dispatch validation runs no secrets, no publish/tag job and no write token, and its evidence carries provenance: dispatch-validation / event: workflow_dispatch, so it is never accepted as stable or RC release provenance.

# A: no-tag validation from the approved CI branch (dry-run evidence)
gh workflow run release.yml --ref ci/full-ci-c -f mode=build -f run_attempt=1

# A: no-tag validation from main (same read-only mode)
gh workflow run release.yml --ref main -f mode=build

# A: validate an existing RC tag without publishing it
gh workflow run release.yml --ref main -f mode=build -f tag=vX.Y.Z-rc.1

# B: validate an earlier no-tag run by its explicit run id/attempt.
#    No tag input: this mode never names or creates a release.
#    The expected source commit is this dispatch run's own github.sha, so run
#    B from the same commit that produced run A.
gh workflow run release.yml --ref ci/full-ci-c -f mode=promote \
  -f run_id=123456789 -f run_attempt=1

The no-tag build runs the full shared checks, A’s long suite, both runtime smokes + packaging, writes channel: dry-run / provenance: dry-run evidence and uploads the bundle and evidence. The RC-tag build is validation-only for evidence purposes. The promote mode downloads the earlier run’s artifacts for the exact attempt, verifies the Actions artifact ZIP digests, the independent evidence digest, the manifest, the six assets’ bytes, the complete release history and (when a previous stable exists) the upgrade gate. It expects the current dispatch/checkout commit (github.sha of the promote run), the same repository/workflow/event/branch, and the 7-day retention window; a run that names any other source SHA is rejected. It never builds, publishes or creates a release. Its success does not authorize a stable release.

No-tag dispatch evidence never qualifies for a real publish: the RC publish re-verifies with --require-push and the stable path requires a published RC tag-push run. Do not pass tag in promote mode. A same-repository pull-request dry run remains a safe subset: it never publishes, does not run release-only gates, and does not use release build caches. Fork pull requests are excluded from the release workflow.

Runner and publishable-bytes prerequisite. Caches are disabled for a release/RC build (cache: false), and the build puts its Rust output, worker-build binary and downloaded tools in a job-local directory so it cannot reuse a pre-existing worker-build or target from a shared writable HOME or the workspace. Normal CI keeps its existing cache behavior.

Disk use of the uncached build. The isolated path is also the long path: shared checks, A’s long suite, both native musl builds, Worker packaging and both restart smokes run in one job. It therefore does not retain intermediates past their consumer. In this job-local tree only, cargo incremental state is off and the dev/test profile carries no debug info (nothing reads it; the installed binaries and staged dist/ assets are the outputs), each worker-build phase compiles into its own target directory, and .github/scripts/reap-job-target.sh removes only those generated target directories once their consumer has finished (each native cross-target tree as its binary is staged into dist/, the Worker target and downloaded tools after build/ is written, and the debug/test target after the long suite). The script is inert unless CARGO_TARGET_DIR is exactly this run’s generated $RUNNER_TEMP/release-tools-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT/target, so cached PR CI keeps its workspace target and Actions caches unchanged. If an uncached attempt still fails with ENOSPC, the job prints df/du headroom before Worker packaging so a runner-capacity limit is distinguishable from job-tree growth; raising a disk limit or switching runners is an operator action, not a workflow fix.

All jobs run on the fixed GitHub-hosted ubuntu-24.04 runner. A tag-push release no longer requires a dedicated clean runner; the build and both publish jobs all use that same hosted runner. A no-tag run has no publish privileges and its output is not publishable evidence.

Old-release continuation. When a previous stable exists, the upgrade step downloads the exact baseline filenames derived from that tag’s plain X.Y.Z version (mergespan-linux-<arch>, its .sha256, mergespan-worker-X.Y.Z.tar.gz, its .sha256) and verifies each exact checksum before executing or opening the file. It never uses a glob or a sidecar for another file. The same-asset restart continuation still runs. The upgrade artifact records A’s long-suite result as i1..i4 and the real runtime result as runtime_i1..runtime_i4; A’s green suite alone is never reported as PROVEN when the real runtime harness only has I1/I2 (I3/I4 remain BLOCKED for the Worker smoke). An absent old asset, a failed checksum, a failed continuation or partial runtime proof is BLOCKED, never green.

The workflow must be on the default main branch before its dispatch entry is generally available; the approved branch is additionally allowed by the workflow’s exact allowlist and is never a release source.

Release artifacts and verification

Release assets are exactly six files, and an RC uses the same names as its stable release (<version> is always the plain workspace X.Y.Z):

  • mergespan-linux-amd64 and mergespan-linux-arm64 — static ELF64 binaries.
  • mergespan-worker-<version>.tar.gz — the built Worker package.
  • one .sha256 file for each of the three artifacts.

Choose the Worker tarball for Cloudflare and the matching mergespan-linux-* binary for a native systemd or Docker deployment. The three artifacts and their checksums are the complete release asset set.

release-evidence.json and its .sha256 are workflow artifacts used to qualify the release; they are not release assets, so the six-name rule does not change.

The Worker package contains build/index.js, build/index_bg.wasm, build/package.json, build/worker/shim.mjs, the complete web/ dashboard asset directory, a README.md, and a generated wrangler.toml copied from runtimes/cloudflare/wrangler.toml with its [build] table removed and [assets] directory set to web. It is a deployment artifact, not a source tree: it has no crates/, runtimes/, Cargo.toml, Cargo.lock or CI files. Extract it and deploy it with the pinned Wrangler CLI; do not run cargo or worker-build inside it.

The release workflow verifies the published artifact set before publishing:

  • The asset set is exactly the six names above, with no extras, and every file is non-empty.
  • Each .sha256 file names its matching artifact and passes sha256sum -c --strict.
  • Both Linux binaries are ELF64 and contain no PT_INTERP or DT_NEEDED entries.
  • The Worker archive contains the required build and web files, has no source-tree directories or files, and its wrangler.toml has the correct entry point, assets directory, and no [build] command.
  • The validated full commit is embedded in both Linux binaries, the Worker wasm, and the package README.md.

The native binaries are the same artifacts used by systemd or the distroless Dockerfile in deploy/README.md. After downloading an asset set, verify it with the matching .sha256 files before deploying.

Release evidence

Two independent records bind a set of assets to the exact run and commit that produced it:

  • release-evidence.json, a canonical manifest written by .github/scripts/release-evidence.py from the release build; and
  • release-evidence.json.sha256, the independent digest of that manifest.

Runtime checks such as .github/scripts/checkpoint-smoke.sh prove behaviour; they do not prove provenance and are not release evidence.

The manifest is deliberately not a signature. Trust comes from cross-checking it against the Actions run metadata fetched from this repository’s API, and from the independent digest:

{
  "schema": 3,
  "repository": "owner/repo",
  "workflow_path": ".github/workflows/release.yml",
  "run_id": 123,
  "run_attempt": 1,
  "event": "push",
  "tag": "v0.1.0-rc.1",
  "version": "0.1.0",
  "channel": "rc",
  "commit": "<40 or 64 lowercase hex>",
  "generated_at": "2026-12-02T12:00:00Z",
  "assets": {
    "mergespan-linux-amd64": "<sha256>",
    "mergespan-linux-amd64.sha256": "<sha256>",
    "mergespan-linux-arm64": "<sha256>",
    "mergespan-linux-arm64.sha256": "<sha256>",
    "mergespan-worker-0.1.0.tar.gz": "<sha256>",
    "mergespan-worker-0.1.0.tar.gz.sha256": "<sha256>"
  },
  "qualification": {
    "long_tests": true,
    "native_checkpoint": true,
    "worker_checkpoint": true
  },
  "provenance": "tag-push",
  "head_branch": "v0.1.0-rc.1"
}

A real release may only consume a manifest whose:

  • repository, workflow path, run ID, run attempt, conclusion and event match a completed successful run of the designated .github/workflows/release.yml;
  • push run’s tag, head commit and head_branch match the release; a workflow_dispatch manifest carries provenance: dispatch-validation and is a validation source only, never promotion evidence;
  • commit equals the full commit being released (40 or 64 lowercase hex);
  • all three qualification flags are true for a published RC/stable asset set;
  • six-asset map, independent digest, per-asset checksum files and the actual asset bytes all agree;
  • timestamps are inside the Actions retention window (7 days by default);
  • the provenance value is consistent with the event and branch (a tag-push manifest whose provenance is dispatch, or the reverse, is rejected).

Anything else is rejected: wrong commit, wrong event, a different/fork workflow, a failed run, an older run, a digest mismatch, extra or missing assets, corrupt bytes, a malformed tag, or a release query that failed. A no-tag workflow_dispatch runs the same dry-run validation but is never eligible for a real release.

A stable tag is verified with the promotion subcommand, not verify. It requires the unique successful same-commit RC tag-push run, a published prerelease for that RC, the exact attempt’s original artifacts, a manifest digest, the independent Actions artifact digest for both the bundle and the evidence archive, the six byte-identical assets, and—when a previous stable exists—upgrade evidence produced by that same RC run. verify remains the audit command for a completed run’s own evidence and rejects stable tags. Stable tags never rebuild: the exact RC bytes are copied and published.

Upgrade evidence

upgrade-evidence.json and its .sha256 are separate from the release manifest. They bind:

  • the previous published stable tag;
  • the candidate version and commit;
  • native_resume and worker_resume (real old-asset continuation);
  • i1, i2, i3, i4 (A’s long invariant suite at the candidate commit);
  • runtime_i1 through runtime_i4, the real runtime harness result. The Worker smoke currently proves runtime I1/I2 only and reports I3/I4 BLOCKED, so a normal RC upgrade artifact stays BLOCKED rather than claiming PROVEN;
  • the exact source run and attempt that produced the evidence, and a 7-day timestamp.

The RC build downloads the previous release, verifies its published transport checksums, and runs the real previous binary/Worker package as the seed and the RC asset as the continuation. If the previous asset is missing, cannot run, or the long suite did not run in that same attempt, the result is BLOCKED, never a pass. A first stable release has no previous stable, so only this historical proof is skipped; the same-commit RC requirement still applies.

Dispatch and Full CI B

The two manual-dispatch modes (build/evidence and promote with an explicit RC run id) are read-only. They have no contents: write, cannot tag, cannot create a release, and their workflow_dispatch evidence is never accepted as stable promotion provenance. Build without a tag produces channel: dry-run evidence; build with an RC tag is a validation source only; promote stops before publishing.

Full CI B (the sandbox E2E trial) is shared development information. It is not a required check, not release evidence, and never authorizes an RC or stable publication. The release gate consumes only the release evidence and upgrade evidence described above.

.github/scripts/release-evidence.test.sh and .github/scripts/fetch-release-artifacts.test.sh exercise every accept/reject case with synthetic fixtures; they create no tag, call no GitHub API and change no release. .github/scripts/checkpoint-smoke.sh, .github/scripts/worker-checkpoint-smoke.mjs and .github/scripts/upgrade-smoke.sh prove runtime continuation separately and are not provenance evidence.

Workflow wiring

The workflow is wired as one source of truth:

  • validate checks the tag/version, runs all release helper tests, queries the complete release list, and chooses the mode. Tag pushes and RC validation require vX.Y.Z / vX.Y.Z-rc.N to match the plain workspace version and be on origin/main.
  • build runs the shared ci-build action with cache: false, A’s ignored long suite when not a pull request, packages the six assets, runs the native and Worker checkpoint smokes on those assets, writes and uploads the release evidence, and (after a previous stable) writes the upgrade evidence. The upgrade artifact is only green when the same attempt ran the long suite and the real old assets continued successfully.
  • verify checks the uploaded six assets and the release evidence, qualifying the bundle against the asset bytes and the run’s own evidence.
  • publish-rc re-verifies the assets and qualification, refuses an existing release, re-fetches and re-reads the RC tag immediately before publishing, enforces the upgrade gate from the current run when a previous stable exists, and creates a prerelease with --latest=false.
  • publish-stable does no build. It resolves the unique same-commit published RC, downloads the original artifacts for the exact attempt with API digest verification, validates the six assets and the upgrade evidence, copies the bytes, re-reads the stable tag immediately before publishing, and publishes only those exact files.
  • promote-check performs the same stable promotion validation with an explicit run id but no contents write and no publication.

The ci job name, trigger, runner, permissions and required-check behavior are unchanged; release-only work lives in release.yml.

Deploy a tagged release (Worker)

The two Wrangler configurations each define a default and a production Worker:

DirectoryDefault (top level)Production (-e production)
runtimes/cloudflaremergespanmergespan-prod
runtimes/cloudflare-ingressmergespan-ingressmergespan-prod-ingress, bound to mergespan-prod

The default Workers follow main. Deploy them from a normal main branch with a plain wrangler deploy. Only the production Workers are release targets, and they are deployed only from a tagged vX.Y.Z commit, never from main and never from an untagged commit. The production Workers have their own Durable Object namespace and SQLite storage; the first production deploy creates new storage and does not read or migrate the default Worker’s data.

Configure the production bindings before the first production deploy. Do not reuse the default/dev App’s values:

  • Plain vars: set the production GITHUB_APP_ID and, for dashboard login, GITHUB_APP_CLIENT_ID in [env.production.vars] in runtimes/cloudflare/wrangler.toml. They are not secrets. A plain wrangler deploy deletes Worker vars that are not in the configuration, so if you manage these in the Cloudflare dashboard instead, add --keep-vars to every production deploy.

  • Worker secrets, entered at Wrangler prompts:

    cd runtimes/cloudflare
    wrangler secret put GITHUB_APP_PRIVATE_KEY -e production
    wrangler secret put GITHUB_WEBHOOK_SECRET -e production
    wrangler secret put GITHUB_APP_CLIENT_SECRET -e production
    wrangler secret put SESSION_SECRET -e production
    
  • Ingress secret: only GITHUB_WEBHOOK_SECRET, with the same value as mergespan-prod’s webhook secret (not the dev Worker’s):

    cd runtimes/cloudflare-ingress
    wrangler secret put GITHUB_WEBHOOK_SECRET -e production
    

The dashboard-related vars and secrets are optional: without them pages still serve, but auth/API answer 503. The production GitHub App’s callback is https://<mergespan-prod host>/auth/callback; its webhook URL is the production ingress /webhook or, as a fallback, mergespan-prod’s /webhook.

Deploy from a clean tagged worktree so the generated build identity is the tag commit:

git fetch origin --tags
git switch --detach vX.Y.Z

cd runtimes/cloudflare
wrangler deploy -e production --tag vX.Y.Z --message "MergeSpan vX.Y.Z"

# Deploy the ingress only after the production Worker. It has no build step.
cd ../cloudflare-ingress
wrangler deploy -e production --tag vX.Y.Z --message "MergeSpan ingress vX.Y.Z"

Alternatively, extract the verified Worker package (which has no build step) and deploy its production environment. The artifact version is the plain workspace version; unlike the tag, it has no leading v:

tar -xzf mergespan-worker-X.Y.Z.tar.gz
cd mergespan-worker-X.Y.Z

Set the production GITHUB_APP_ID and, for dashboard login, GITHUB_APP_CLIENT_ID in [env.production.vars] in the extracted wrangler.toml (they are plain vars, not secrets). If you set them in the Cloudflare dashboard instead, add --keep-vars to the deploy command so Wrangler does not delete them.

wrangler deploy --dry-run -e production   # validate without uploading
wrangler deploy -e production --tag vX.Y.Z --message "MergeSpan vX.Y.Z"

wrangler deploy selects the target from the checked-in configuration and -e; without -e production it targets the default mergespan Worker. Never omit the environment for a production release. --tag and --message attach Worker Version metadata only; they do not select a Worker, change routing, bypass rules or make wrangler deploy idempotent. The source [build] command still runs worker-build --release from the tagged source; the extracted package has no build command. Verify the pinned CLI supports these flags before relying on them: Wrangler 4.169.1 documents both for wrangler deploy.

For native deployments, replace the binary or rebuild the container using the matching mergespan-linux-* artifact from the same tag.

Storage schema

The durable coordinator state uses an explicit schema version:

#![allow(unused)]
fn main() {
pub const SCHEMA_VERSION: u32 = 1;
}

(crates/engine/src/coordinator.rs)

On load, Coordinator::from_state rejects any checkpoint whose schema field does not equal SCHEMA_VERSION:

#![allow(unused)]
fn main() {
if state.schema != SCHEMA_VERSION {
    return Err(StateError::Schema {
        found: state.schema,
        expected: SCHEMA_VERSION,
    });
}
}

There is no automatic migration between schema versions in v0.1. A future version that bumps SCHEMA_VERSION will need either:

  • a documented manual migration path (export/import), or
  • an in-place migration function added to from_state.

Neither exists today. Upgrading across a schema-version bump without a published migration procedure will make existing checkpoints unreadable. Back up the SQLite database (Worker DO storage or native repos/repo-*.sqlite3) before upgrading.

Same-version restarts and the current v1 storage format are covered by two separate local harnesses. Do not report one as the other:

  • Restart and deduplication smoke: .github/scripts/checkpoint-smoke.sh starts the real native binary on a loopback listener, sends one correctly signed synthetic pull_request webhook, requires the SQLite delivery receipt and persisted coordinator/outbox, then SIGTERMs, restarts the same binary on the same data directory and replays the exact delivery. It requires one receipt, a processed attempt, a surviving checkpoint and a duplicate attempt. It proves restart recovery and delivery deduplication; it does not prove merge-queue invariants I1-I4, which stay in A’s full_ci suite. If a previous artifact cannot be run in the available environment, mark that evidence BLOCKED and do not publish; run it on Linux CI instead of substituting a weaker check.
  • Historical read: crates/engine/tests/fixtures/upgrade/checkpoint-v1.json is a frozen v1 checkpoint. cargo test --locked -p mergespan-engine --lib upgrade and cargo test --locked -p mergespan-runtime-native --test runtime historical_v1_checkpoint prove the current engine and a real native SQLite checkpoint still read it. The fixture is never regenerated; a later schema bump must either keep reading it or add an explicit migration. This tree reads it and rejects any newer schema with StateError::Schema instead of resetting.

NATIVE_BIN=target/debug/mergespan WORKER_TARBALL=dist/mergespan-worker-0.1.0.tar.gz .github/scripts/upgrade-smoke.sh all runs all three cases; without a built Worker tarball the worker case reports BLOCKED. A previous-version check is a subset: point NATIVE_BIN at the earlier release’s mergespan-linux-* artifact and NEXT_BIN at the RC binary, with the same (or a copy of the) data directory. The earlier artifact must be run on Linux (the release binaries are static Linux ELF); a macOS host can only run a locally built debug binary. The WAN-severed, loopback-only environment is the intended one: the smoke signs its own webhook, never requires a GitHub response, and any outbound attempt fails without changing durable state.

Worker checkpoint evidence

.github/scripts/worker-checkpoint-smoke.mjs loads an extracted mergespan-worker-X.Y.Z.tar.gz package in local Miniflare/workerd with a persistent Durable Object SQLite directory and the same RepositoryObject class/repository ID across restarts. It sends a correctly signed synthetic webhook (not /health), uses an outbound adapter that recognizes only local synthetic responses and fails every unrecognized request, and checks:

  • a signed delivery leaves a receipt and pending checkpoint in the DO SQLite database;
  • the same state directory, class and repository ID survive a full Miniflare restart; an exact delivery replay deduplicates without a second receipt;
  • a distinct delivery after restart is still processed;
  • the frozen v1 pre-merge checkpoint (runtimes/cloudflare/tests/fixtures/upgrade/checkpoint-v1-merge.json) resumes the persisted candidate/alarm read-first and issues no second merge PUT;
  • a synthetic merge whose squash tree differs, and one whose parent differs, both pause with post_merge_mismatch instead of reporting success (I1 through the Worker path).

Build the package first (cd runtimes/cloudflare && worker-build --release, then VERSION=X.Y.Z bash .github/scripts/package-worker.sh) and run:

WORKER_TARBALL=dist/mergespan-worker-X.Y.Z.tar.gz \
  .github/scripts/upgrade-smoke.sh worker

MINIFLARE_MODULE can point at an installed miniflare package. The same-package restart/deduplication case and the frozen historical checkpoint case are reported separately. If Miniflare is not available the harness reports BLOCKED; it never substitutes a /health or package-structure check. I3 (convergence after inputs stop) and I4 (specific dequeue reasons) are also reported BLOCKED for this harness because it does not implement a full check/merge state double; those remain covered by A’s full_ci suite, not by this local smoke.

Native runtime startup refusal

The native runtime refuses to start if it finds an unexpected legacy database file outside the per-repository layout:

  • <data-dir>/mergespan.sqlite3 (legacy single-database layout)
  • orphaned SQLite sidecars in repos/ without a matching repository database

It never adopts, overwrites, or migrates these files. This is a deliberate safety measure; see runtimes/native/src/service.rs for the exact checks.

Store migrations (idempotent column additions)

SqlStore::open applies idempotent schema migrations via MIGRATION_COLUMNS (crates/engine/src/store.rs). These are additive column additions only; they do not change semantics or drop data. They run on every open and are safe to re-run.

Upgrade procedure

These steps apply whether you deploy a verified release asset or, for a non-production target, a pinned commit. Because there is no automatic schema migration in v0.1:

  1. Back up the durable state:
    • Cloudflare Worker: export the Durable Object’s SQLite storage or rely on Cloudflare’s backup policy.
    • Native: copy <data-dir>/repos/*.sqlite3 and -wal/-shm files while the process is stopped.
  2. Stop the runtime.
  3. Deploy the new binary, Worker bundle, or verified release asset.
  4. Start the runtime.
  5. Verify with one non-draft pull request and the console diagnostics page. Confirm the reported version and commit match the artifact you deployed.
  6. Keep the backup until you have observed at least one successful merge cycle.

If the new version introduces a SCHEMA_VERSION bump and no migration procedure is documented, do not upgrade. Wait for the migration guide.

Downgrade and rollback

Roll back code by redeploying the previous clean tag:

git switch --detach vA.B.C
cd runtimes/cloudflare
wrangler deploy -e production --tag vA.B.C --message "rollback to MergeSpan vA.B.C"

For the production ingress, run wrangler deploy -e production in runtimes/cloudflare-ingress after the production Worker. Roll back the default mergespan/mergespan-ingress Workers with a plain wrangler deploy from the chosen main commit.

For native deployments, replace the binary or rebuild the container using the earlier mergespan-linux-* artifact. wrangler rollback [version-id] restores a previous Worker version, but neither rollback path reverts Durable Object SQLite storage or a deployed storage migration. MergeSpan state, deduplication records and the outbox stay at the newer format. Check code/storage compatibility before rolling back a release that changed Durable Object storage or configuration formats; restore data separately if the older code cannot read the newer storage.

Downgrading to an older version that expects a lower SCHEMA_VERSION will fail on load with StateError::Schema. There is no downgrade path in v0.1. If you must downgrade across a schema version, restore from backup.

Rolling a stable release back to the exact RC it was qualified from is a code no-op: both tags point at the same commit and therefore the same storage format. Rolling back to an earlier RC/stable is not automatically safe; the current code must still read that checkpoint (historical_v1_checkpoint is the frozen baseline for v1) or you must restore a database backup. Do not deploy an older binary over newer Durable Object or native SQLite state merely because the release tag still exists.

For 0.x releases, treat any breaking Durable Object storage or configuration-format change as a minor bump, and state the incompatibility explicitly in the release notes. --generate-notes derives notes from merged pull request titles and will not explain a storage or configuration incompatibility by itself.

What changes between versions

Across releases, expect changes in these areas to require attention:

  • Configuration keys: the parser uses deny_unknown_fields. Adding a key in a newer version means older versions reject the config. Removing a key means newer versions use the default.
  • App permissions / events: the console setup checks validate against the documented set. A permission change requires updating both the App settings and the documentation.
  • Candidate branch naming: fixed at mergespan/queue/<number>. A change would break rulesets and verification workflows.
  • Check name: fixed at mergespan. A change would break required-check configurations and branch protection.
  • Webhook hint shape: the ingress Worker and Rust ingress share a wire contract. Changes require coordinated updates to both.
  • Console API routes: /api/v1/* routes are versioned by prefix. Breaking changes would require a new major version or a compatibility layer.

Source map

ConcernFile
Workspace versionCargo.toml ([workspace.package] version)
Build identitycrates/engine/build.rs, crates/engine/src/build_info.rs
Schema version constantcrates/engine/src/coordinator.rs (SCHEMA_VERSION)
Schema validation on loadcrates/engine/src/coordinator.rs (Coordinator::from_state)
Store migrationscrates/engine/src/store.rs (MIGRATION_COLUMNS, SqlStore::open)
Native startup refusalruntimes/native/src/service.rs
Release workflow.github/workflows/release.yml
Shared CI/release checks.github/actions/ci-build/action.yml
Tag/version checker.github/scripts/check-release-tag.sh and its test
Release evidence.github/scripts/release-evidence.py and its test; .github/scripts/fetch-release-artifacts.sh and its fixture test
Restart/dedupe smoke.github/scripts/checkpoint-smoke.sh, .github/scripts/upgrade-smoke.sh, .github/scripts/worker-checkpoint-smoke.mjs
Historical v1 checkpointscrates/engine/tests/fixtures/upgrade/checkpoint-v1.json, runtimes/cloudflare/tests/fixtures/upgrade/checkpoint-v1-merge.json
Release helpers.github/scripts/fetch-origin.sh, package-worker.sh, verify-release-assets.sh
Diagnostics build fieldscrates/engine/src/dashboard/service.rs, crates/engine/src/dashboard/model.rs