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

Release Engineering

Overview

Releases are automated via scripts/release-manager.sh with GitHub Actions for publishing. The system uses:

  • Structured logging with JSON output for CI debugging
  • Exit-code validation (no fragile grep patterns)
  • Rollback automation for failed releases
  • Version sync across Cargo.toml and wasm/package.json

Release Manager

# Validate all gates (tests, clippy, fmt, LOC, dry-run)
scripts/release-manager.sh validate

# Prepare release (version bump, changelog, sync)
scripts/release-manager.sh prepare 0.2.0

# Publish (creates git tag, pushes - triggers GitHub release via CI)
scripts/release-manager.sh publish 0.2.0

# Full pipeline (validate + prepare + publish)
scripts/release-manager.sh full 0.2.0

# CI mode (non-interactive)
scripts/release-manager.sh full 0.2.0 --yes --log release.log

# Dry run (simulate without side effects)
scripts/release-manager.sh full 0.2.0 --dry-run

Validation Gates

The validate command checks:

GateMethod
Clean workspacegit diff --quiet
Correct branchMust be main
Compilationcargo check --all-targets --all-features
Formattingcargo fmt --check
Lintingcargo clippy -- -D warnings
Testscargo test --all-features
Documentationcargo doc --no-deps
Publish dry-runcargo publish --dry-run
LOC limitsAll src/*.rs ≤ 500 lines
WASM targetcargo check --target wasm32-unknown-unknown
Security auditcargo audit (if installed)

Documentation Sync

The prepare command automatically updates version references across all documentation:

FileUpdates
Cargo.tomlversion = "X.Y.Z"
wasm/package.json"version": "X.Y.Z"
Cargo.lockRegenerated via cargo check
README.mdStatus table + install examples
SECURITY.mdSupported versions table
book/src/getting-started.mdInstall examples
wasm/README.mdnpm install examples
llms.txt, llms-full.txtRegenerated via scripts/gen-llms-txt.sh
CHANGELOG.md[Unreleased] → [X.Y.Z]
AGENTS.mdVersion references (if present)

CI Workflows

Release (release.yml)

Triggered by successful completion of the CI workflow on main (and by a fail-closed manual dispatch). It uses the completed workflow’s head_sha, not the SHA of a later workflow run:

  1. validate — Extract version from Cargo.toml, verify CI + gate for the target SHA, ensure the tag exists, validate package assembly
  2. build-artifacts — Build release binary + WASM, create tarballs
  3. create-github-release — Upload artifacts, extract changelog notes
  4. publish-crates — Exchange a GitHub OIDC token for a short-lived crates.io token and publish the nine crates in dependency order
  5. verify-release — Probe all nine crates.io index paths, both npm packages and every expected release asset
  6. notify — Report the release verdict with per-job status

release.yml holds no crates.io credential: the token is minted per run by rust-lang/crates-io-auth-action and expires with it. The publish job lives in this file because the nine crates.io trusted-publisher configs name release.yml, and crates.io matches the JWT’s workflow filename against that config (ADR-0107) — the separate publish-crates.yml that ADR-0104 introduced existed only because this workflow used to be workflow_run-triggered, an event crates.io refuses. verify-release still probes the nine index paths independently, so a release whose publish failed or never ran stays red.

npm distribution

The npm package is published by the npm distribution job owned by the release workflow; there is no separate npm-publish.yml workflow:

  • Builds the WASM package via scripts/build-wasm.sh release-web (the same script and mode CI smoke-tests)
  • Publishes @d-o-hub/chaotic_semantic_memory to npm
  • Includes npm provenance (--provenance)

crates.io (publish-crates, a job in release.yml)

The job runs inside the crates.io environment and mints a short-lived token through crates.io OIDC Trusted Publishing (rust-lang/crates-io-auth-action, no repository secret). It confirms every crate in the workspace declares the releasing version, publishes the seven members, then chaotic_semantic_memory, then csm-duckdb, and finally re-probes the sparse index for all nine and reds the run on any gap. Publishing is idempotent: a crate already in the index at that version is skipped, so re-dispatching finishes a partial run.

It lives in this file because the nine crates.io trusted-publisher configs name release.yml, and crates.io matches the JWT’s workflow filename against that config — a job in another file is answered with 400 ... Expected workflow filenames: release.yml. See ADR-0107 for the move and ADR-0104 for the OIDC mechanism, the 30-minute token lifetime the 25-minute job bound sits under, and the environment choice.

Two ways in, and the difference matters:

gh workflow run release.yml -f tag=v0.3.9   # recovery: publishes for real, idempotently
gh workflow run release.yml                 # dry run: exchange + packaging, nothing uploaded

The untagged dispatch is the sensor: it performs the OIDC exchange (the only thing that can prove the configs match) and runs cargo publish --dry-run for every crate, uploading nothing. A real release omits the dry-run flag.

GitHub Pages (pages.yml)

Triggered by push to main (book/ changes):

  • Builds mdBook documentation
  • Generates API docs via cargo doc
  • Deploys to GitHub Pages

Commit Conventions

TypeVersion BumpExample
featMinorfeat(cli): add export command
fixPatchfix(reservoir): correct spectral radius
perfPatchperf(hyperdim): optimize bundle
feat!:Majorfeat!: redesign API
docs, chore, test, ciNo release—

Rollback

If a release has issues:

# Automated rollback (deletes tag + GitHub release)
scripts/release-manager.sh rollback 0.2.0

# If already published to crates.io, yank manually:
cargo yank --version 0.2.0 chaotic_semantic_memory

Security

  • No long-lived API tokens — crates.io publishes over OIDC Trusted Publishing from the publish-crates job in release.yml; no workflow reads a CARGO_REGISTRY_TOKEN secret (ADR-0104, ADR-0107)
  • Concurrency control — Release and publish workflows use cancel-in-progress: false
  • Minimal permissions — release.yml declares contents: read at the top level, each publishing job widens it only where it must, and publish-crates asks for exactly contents: read + id-token: write
  • Branch protection — main branch requires PR with passing CI
  • Provenance — npm packages include build provenance attestation
  • Audit — cargo audit runs as part of validation (when installed)

Architecture Decision Records

  • ADR-0039 — Release engineering strategy
  • ADR-0042 — Release automation and v0.1.0 readiness
  • ADR-0104 — crates.io OIDC trusted publishing