# Changelog and release

> How behaviour changes are recorded, how guides are re-reviewed, what the release workflow does from tag to Homebrew tap, how self-update installs a release, and what runs nightly.
>
> Describes Orbit 0.1.9. Web page: https://docs.orbit.dialectic.com/0.1.9/contributing/changelog-and-release/

This page covers the path from a merged change to an installed binary: changelog fragments, guide review, the `release.yml` stages, what the tarballs contain, how `self_update` moves an install, and the nightly jobs. It is for contributors whose change alters what an owner or agent sees, and for anyone cutting a release. Behaviour described here is as of Orbit 0.1.8.

## Changelog fragments

`docs/BEHAVIOR-CHANGELOG.md` records semantic changes an agent or owner must re-learn, newest first. Nobody edits it directly between releases. Instead, each change that alters what an owner or agent sees adds one fragment (`docs/changelog.d/README.md`):

```text
docs/changelog.d/<release>/<issue>-<slug>.md
```

- The first line is a `### <Section>` heading, for example `### Gas` or `### Package trust`. Reuse an existing section name when one fits; `scripts/assemble-changelog.sh` holds the stable section order (`Check these before you update`, `Setup and network connections`, `Setup guidance`, `Package trust`, `Gas`, …). Unknown sections follow alphabetically.
- The rest is `- ` bullets in plain owner and agent words. Entries for agents start "For agents:" by convention and name tools and fields in backticks.
- Write links as they will read from `docs/BEHAVIOR-CHANGELOG.md`, where the text ends up.

At release cut the integrator runs `scripts/assemble-changelog.sh <release>`. It groups fragments by section (within a section, by file name, so issue number first) and prints the result; it changes nothing. The integrator places that text under the dated release heading in `docs/BEHAVIOR-CHANGELOG.md` and deletes the fragments.

Guards that read the changelog: `docs-lint.sh` checks the topmost section for stale domains (and its URLs, pre-tag); `brand_guard` treats everything from its first shipped heading down as history. The changelog ships inside both tarballs, so it is public text.

## Guides stay current

Guides are the shipped skills, `skills/<name>/SKILL.md`, served by `get_guide` and as `orbit://guides/<name>` resources. Their frontmatter carries two version fields under `metadata`:

```yaml
metadata:
  version: 0.1.8
  reviewed_against: 0.1.6
```

- `version` must equal the crate version (`docs-lint.sh` check 2). It is also stamped at packaging (`scripts/stamp-skill-version.py`) and at serve time (`guides::stamp_version`), both rewriting only frontmatter `version:` lines.
- `reviewed_against` is the release the guide was last read against. A change that alters behaviour a guide describes names the affected guide lines in its fragment ("Guides: orbit-billing, plan states"). At release, each guide is read against the release and its `reviewed_against` is set; a guide nobody read keeps the older release, so a stale guide is visible. No test enforces this field; it is a review rule.

## Release workflow

`.github/workflows/release.yml` runs on any pushed tag matching `v*`: `vX.Y.Z` for stable, `vX.Y.Z-rc.N` for a prerelease. Main is fast-forwarded to the tag commit; the release commit is never squashed or rebased. Three jobs run in order.

### 1. `gate`

- The tagged commit must be an ancestor of `origin/main`.
- A `ci` workflow run on the exact tagged SHA must conclude `success`. The step polls at an interval and up to a time limit set in `release.yml`, and distinguishes "cannot read CI" (a permissions failure) from "CI is red".
- `scripts/docs-lint.sh --urls`: versions, links, stale domains, and every URL in shipped docs resolves.
- The public distribution repository is ready: the `DIST_REPO_TOKEN` secret exists, can push, and the repo has a commit on its default branch.

### 2. `build` (matrix)

| Runner | Triple |
| --- | --- |
| `macos-15` | `aarch64-apple-darwin` |
| `ubuntu-24.04` | `x86_64-unknown-linux-gnu` |

Toolchain pinned to the version in `rust-toolchain.toml`. Steps:

1. **Build both variants** with `--locked`: `cargo build --release` (server and `orbit-watchdog`, write feature) and `cargo build --release --no-default-features` (copied to `orbit-mcp-readonly`). `RUSTFLAGS` comes from `scripts/private-dep-remap.sh`, which remaps the private dependency's checkout path so the binaries do not embed it.
2. **`scripts/assert-readonly.sh`** on the shipped read-only binary: no signing code linked.
3. **`scripts/assert-no-acceptance-fixtures.sh`** on all three binaries: the test-only `acceptance-fixtures` feature never ships.
4. **Version check**: each binary's `--version` must equal exactly `orbit-mcp (Dialectic Orbit) <tag version> (<12-char SHA>) [read-write]`, `… [read-only]`, and `orbit-watchdog (Dialectic Orbit) <tag version> (<SHA>)`. A commit of `unknown` is refused, because self-update compares the commit later.
5. **`scripts/release-smoke.sh`** runs the read-only binary: `--version` plus a real `audit_package` call over stdio against the shipped fixture manifest through a `file://` catalog, fully offline (dead-port RPC, fork probe off, no Foundry).
6. **Package** (see below).
7. **`scripts/assert-public-payload.sh`** on both tarballs.
8. **`scripts/skill-surface-guard.sh`** and **`scripts/onboarding-guidance-guard.py`** on both tarballs.
9. **`scripts/install-smoke.sh`** (macOS only): installs each Homebrew formula against the just-built tarball and runs the documented first commands (`orbit-mcp --help`, `orbit-mcp onboard` with and without a config).

### What a tarball contains

Two tarballs per triple:

| Tarball | Contents |
| --- | --- |
| `orbit-mcp-readonly-<triple>.tar.xz` | `orbit-mcp-readonly`, `share/`, `BUILD-INFO` |
| `orbit-mcp-<triple>.tar.xz` | `orbit-mcp`, `orbit-watchdog`, `share/` (plus the staged Base anvil, and on Linux a staged stock anvil), `BUILD-INFO` |

The read-only binary keeps a distinct file name so `tar -tf` tells the variants apart; the formula installs it as `orbit-mcp`. The pinned Base anvil (`scripts/stage-base-anvil.sh`) is staged only after the read-only archive is written, so that variant stays lean. On Linux the write tarball also gets a pinned stock anvil (`scripts/stage-stock-anvil.sh`) so Ethereum and HyperEVM can be simulated without installing Foundry; macOS uses the user's own Foundry.

`share/` holds:

- `example.config.toml`, `README.md`, `watchdog.example.toml`, `BEHAVIOR-CHANGELOG.md`, `package-manifest-schema.md`;
- `share/docs/`: `BEHAVIOR-CHANGELOG.md`, `BRIDGING.md`, `operations.md`, `mandate.md`, `bridge-setup-runbook.md`, `owner-browser-access.md`, `portfolio-read-model.md`, `CANONICAL.md`, `swapper-runbook.md`, `TESTING.md` (the docs the skills cite, so every citation resolves inside the package);
- `share/skills/`, every guide, with `version:` stamped to the tag.

`BUILD-INFO` records `tag`, `version`, `commit`, `variant` and `triple`, so self-update can identify a verified download without running it.

Adding a doc the skills cite means adding it to the `cp` list in the Package step, and to the same list in CI's `skill-surface` job, or the skill-surface guard fails on a dangling path.

### 3. `publish`

1. Exactly four tarballs must be present. One `SHA256SUMS` covers all of them; a top-level `BUILD-INFO` records `commit` and `tag`.
2. **Create release** in the source repository (marked prerelease when the tag contains `-`), uploading with `--clobber` so a re-cut tag never leaves two different binaries under one version. `scripts/gh-release-create.sh` tolerates only an already-existing release.
3. **Publish to the public distribution repository**, which is also the Homebrew tap: the tarballs, `SHA256SUMS` and `BUILD-INFO`. The source repository is private, so this step is what makes `brew install` and `self_update` work for anyone. It fails the release, rather than degrading, when the token is missing or cannot write. Prerelease notes tell macOS users to download the tarball from the release page instead of using Homebrew.
4. **Sync the Homebrew tap**: `packaging/homebrew/sync-tap.sh` renders both formulas from the published checksums, the step fails if an all-zero placeholder checksum survived, and `scripts/check-formula-urls.sh` checks every formula URL is this tag's asset on the public distribution repository. **For a prerelease the job stops here**: the tap follows stable tags only, because `brew upgrade` reads `Formula/` from the tap's default branch. For a stable tag, the formulas are uploaded to the release and committed, with `packaging/homebrew/TAP-README.md` as the tap's README, to the tap's default branch.

Homebrew therefore serves stable releases only, as formulas `orbit-mcp` and `orbit-mcp-readonly` in the `dialecticch/orbit` tap.

### Before publishing

`CONTRIBUTING.md` requires a final instructions review immediately before publication: read the exact extracted release as a new user and as a host agent (install, verify variant and path, initialize, connect MCP, choose wizard or chat), check the bundled skills, current changelog entry, README, release notes, CLI help, setup `next` and missing-page diagnostics together, and run `scripts/onboarding-guidance-guard.py` on both archives. Any later instruction change invalidates that review.

## Self-update

The `self_update` tool (effect class `LocalReplace` in `src/tools/annotations.rs`) and the `orbit-mcp self-update` command run the updater script embedded in the binary (`scripts/self-update.sh`, included by `src/host_ops.rs` as `SELF_UPDATE_SH`). The rules on who may move an install live in `src/update_policy.rs`.

- **Source.** Downloads from the public distribution repository over HTTPS with `curl` only: no GitHub CLI, no credentials. The host is fixed in the script and single-sourced with `DIST_REPO` in `src/host_ops.rs` (a test fails on drift).
- **Which release.** With no `tag`, the newest stable release (from `/releases/latest`); if no stable exists yet, the newest release of any kind. A `tag` must match `vX.Y.Z` or `vX.Y.Z-rc.N` exactly, checked in Rust and again in the script.
- **Forward only for the agent.** The agent surface always passes `--floor`: the agent can move Orbit to the newest release, or to a chosen release newer than the running one. Going back (an older or equal tag, or `rollback`) needs the owner's signature through a signing link (`confirm`), the owner page, or a terminal.
- **Variant-aware.** The artifact is chosen from the installed binary's own `--version` bracket, so a read-only install is never promoted to a signing-capable one; the staged binary's bracket is asserted before the swap.
- **Homebrew-aware.** A Homebrew-managed install refuses with the `brew upgrade <formula>` remedy instead of installing a shadow copy. `--rollback` refuses there too. The tap carries no versioned formulas, so as of 0.1.8 there is no supported way back to an older version on a Homebrew install. The tap follows stable tags only; a release candidate is downloaded from its release page.
- **Verification.** The tarball is checked against `SHA256SUMS` and its `BUILD-INFO` (version, commit, variant) before anything is swapped. A downloaded binary is never run before the swap. Releases without `BUILD-INFO` (before 0.1.3-rc.3) cannot be installed this way.
- **Swap.** Atomic, into `~/.orbit/bin` by default (`ORBIT_BIN_DIR`), keeping the previous binaries as `*.prev` and the previous `share/orbit-mcp` as `share/orbit-mcp.prev`. Orbit's launchd services are restarted. `--rollback` restores `*.prev`.

## Nightly jobs

| Workflow | Schedule (cron in the workflow file) | What it does |
| --- | --- | --- |
| `nightly.yml`, job `makinax-main` | Weekdays | Rewrites the two makinaX dependencies to `branch = "main"` in a temporary copy (`scripts/makinax-on-main.sh`), then runs clippy and the full suite in both variants. Red means a makinaX change Orbit must absorb before the next re-pin; the pinned build is unaffected. |
| `nightly-acceptance.yml`, job `fork-lane` | Daily | Two-chain onboarding e2e, repeated-run compose stability against one anvil fork, mutation red-runs, shipped default catalog resolves. |
| `nightly-acceptance.yml`, job `corridor` | same | The pre-tag corridor walk (`scripts/prerelease-corridor.sh`: isolated `HOME`, Base fork, owner batch applied as the Safe, never posted to the production transaction service) and a first-time-setup walk to a signed perp order on Base and HyperEVM forks, built with `acceptance-fixtures` against a per-run minted curator. |
| `nightly-acceptance.yml`, job `fork-dark` | same | The `#[ignore]`d fork tests in groups `mainnet`, `base`, `setup`, one group at a time against archive-capable public gateways (overridable by repository secrets). |

Each nightly workflow ends with a `report` job that opens one issue per failing job, comments on it on later red nights, and closes it on a green night. Forks run at the current head, not a pinned block, on purpose: a nightly exists to catch a venue changing under Orbit. Fixture packages come from `tests/fixtures/curator`, re-signed with a test key; after a curator key rotation, run `scripts/resign-fixtures.sh`.

See [Build and test](https://docs.orbit.dialectic.com/0.1.9/contributing/build-and-test/) for the per-PR CI jobs and [Guards and wording](https://docs.orbit.dialectic.com/0.1.9/contributing/guards-and-wording/) for what each release check enforces.
