From 316968b5659b8f6ec2eec215595fb67c121943bc Mon Sep 17 00:00:00 2001 From: Aditya Mukhopadhyay Date: Tue, 1 Dec 2026 07:51:31 +0530 Subject: [PATCH 1/2] docs: describe binding release routing and recovery (#960) Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01H2a7QkSTdhquSfwFKL6Y4o --- CONTRIBUTING.md | 8 + ...26-11-30-binding-release-routing-design.md | 166 ++++++++++++++++++ 2 files changed, 174 insertions(+) create mode 100644 docs/superpowers/specs/2026-11-30-binding-release-routing-design.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 69b9173d88..80febebe46 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -137,6 +137,14 @@ Release uses cargo-dist's `local-artifacts-jobs` hook to run Release Gate. Faile Release Cascade must be installed on the default branch (`main`), even when the tag is created from `v3`. For recovery after a partial binding release, run `gh workflow run cascade.yml --ref main -f tag=v3.0.0-alpha` with the published tag. This re-dispatches all seven bindings; it requires a successful official Release run for the tag's current commit and passing CI. The dispatch contract remains `core-release` with `client_payload.version` set to the full tag. +The cascade waits for the exact unyanked crate in the Cargo sparse index again before dispatching. It sends the seven requests sequentially and stops on an error; a green cascade confirms dispatch, not downstream publication. Check every binding's release and exact-version registry consumer results before declaring the release complete. + +Binding recovery follows the [binding release routing design](docs/superpowers/specs/2026-11-30-binding-release-routing-design.md). After #937, the default-branch workflow routes 3.x to `main` and 2.x to `v2.x`, with no fallback. To retry just one binding, run `gh workflow run release.yml --ref main -f version=` in that binding's repository. Do not dispatch its maintenance-branch workflow or delete a tag to retry. + +An existing binding source tag (Swift: `source-`) selects the original tested prepared commit, even if the source branch has advanced. Recovery requires that commit to remain in the selected line and retain the exact core dependency and provenance. It authenticates the original run's retained evidence and artifact digests, accepts matching published files, and uploads only missing original bytes (or a byte-identical rebuild). Swift also retains its generated SemVer tag and the original zip checksum. A conflicting digest, unavailable original evidence, or a tag without the evidence pointer fails closed; investigate the conflict without deleting or moving public tags or replacing published files. The binding workflows request 90-day evidence retention, subject to repository policy; preserve those runs and artifacts throughout recovery. If nothing has been published and no binding source tag exists, the retry prepares and tests from the current source head again. + +Repeating the cascade is safe for bindings that already finished: each resumes at the same tested identity, uploads nothing, repairs channels or release classification when needed, and re-runs its exact-version registry consumer. It is not a blind skip of an existing version. Recovery succeeds only after that verification passes; publication, verification and resume failures retain `release-broken` reporting. + ## Code of Conduct This project follows the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). By participating, you agree to uphold it. diff --git a/docs/superpowers/specs/2026-11-30-binding-release-routing-design.md b/docs/superpowers/specs/2026-11-30-binding-release-routing-design.md new file mode 100644 index 0000000000..0332ffcc7b --- /dev/null +++ b/docs/superpowers/specs/2026-11-30-binding-release-routing-design.md @@ -0,0 +1,166 @@ +# Spec — 010-binding-release-routing: binding release workflows for the 3.0.0-alpha (python#24, node#29, wasm#28, swift#24, android#23, c#21, java#30, binding-template#6; core #960 "Before tagging") + +**Mission Type:** code (GitHub Actions release/CI workflows, small helper scripts with tests, consumer tests, READMEs) plus a rehearsal evidence record, across 9 repositories. No core library, API, file-format or binary-size change. + +**Base branches and deliverables (PRs):** +1. **Each of the 7 publishers (python, node, wasm, swift, android, c, java), `v3`** (becomes `main` at #937; merge commit): routing by major, exact registry conversion with provenance checks, version spellings and channels, identity-safe recovery, rehearsal mode, both-line compatibility of the default-branch CI/package/verify workflows, both-line CI triggers, README/doc updates. +2. **Each of the 7 publishers, current `main`** (becomes `v2.x` at #937; squash): the pre-move guard (this branch's release accepts only 2.x), the production entry-point guard (§4 AC4), CI triggers that include `v2.x`, and any fix `v2.x`'s own CI needs (for example the WASM WASI core reference). **Java:** the same on its existing `v2.x` instead (Java's `main` is a stale 2.0.2 line that #937 replaces; it gets only the pre-move guard). +3. **binding-template, `v3` and `main`:** CI triggers for both lines and release guidance for new bindings (the template has no release.yml). +4. **Re-pin, `v3` of all 7 publishers and the template:** one common final core `v3` SHA, CI green on the exact tips (may be folded into PR 1 if the core head no longer moves; the end state is what counts). +5. **Core `v3` doc PR:** a copy of this spec at `docs/superpowers/specs/2026-11-30-binding-release-routing-design.md` and the CONTRIBUTING release-recovery text (doc-only, merge right away). +6. **Rehearsal record:** the 14-path ledger plus negative runs, posted on core #960 and kept in `TandemKit/010-binding-release-routing/Assets/`. + +## 1. User Intent + +> Mission: binding release workflows for the 3.0.0-alpha (item 7 of the alpha work order in memory: v3-alpha-sequence). It is the only TandemKit item left before #937 (branch move) and #929 (version bump + tag v3.0.0-alpha). +> +> Issues in scope (read all of them, with comments): python#24, node#29, wasm#28, swift#24, android#23, c#21, java#30 ("release: publish a 3.0.0-alpha prerelease from the v3 branch"), and binding-template#6. Core #960 (in the v3.0.0 milestone): its "Before tagging" checklist is an acceptance criterion for this mission. Rehearse 7 bindings × 2 source lines (alpha from the future main, a representative 2.x patch from v2.x) with the proposed default-branch workflow definitions, with branch/tag writes and registry publishing disabled. Record per path: the prepared commit, the source and write-target branch, the artifact version, the dependency source (exact candidate core commit, then exact registry resolution with features preserved in the lockfile) and the consumer test. Reject unsupported majors and missing branches without falling back to another source or target. Its "After approved publication" half belongs to #929, not this mission. +> +> Decided (#928, core and docs issues; don't relitigate): The version is 3.0.0-alpha, then -beta, -rc1..rc9. PyPI 3.0.0a0/b0/rcN. npm dist-tag `next` (never `latest` for a prerelease). Prerelease GitHub releases. The Swift version regex must accept the prerelease. Maven/Android: 3.0.0-alpha. Every binding, Tier 2 included, publishes every core release in lock-step. A binding that can't publish blocks the release. At the alpha, the branch move (#937) happens before the tag: core and the 8 binding repos go v3 → main and main → v2.x. Java keeps its existing v2.x; Swift's swift-releases branch stays. After the move, repository_dispatch runs the new default branch's workflow even for v2.x source, so each release selects the source/write branch from the dispatched major. Core side (merged, #954/#955): Release Cascade … sends `core-release` with client_payload.version = the full tag (e.g. v3.0.0-alpha) to the seven binding repos. Recovery: `gh workflow run cascade.yml --ref main -f tag=`. Keep that payload contract. Known per-binding gaps from the 2026-11-29 audit: release checks out main; the pin sed misses v3's git/rev dependency table; the tag job fast-forwards main; python wheel-name check vs PEP 440; node/wasm publish without --tag; swift regex rejects prereleases; java v.x selection falls back to main. After the workflows land, re-pin every binding's v3 to the final core v3 head with CI green. The pin already includes node#30 and c#22, which merged 2026-11-30. +> +> Process: no closing keywords for umbrella issues; v3 PRs get merge commits, main PRs squash; doc-only PRs merge right away; code/CI PRs merge once green and reviewed. Coordinate with #937 for the branch layout and with #929 for the tag; this mission authorizes no publication. + +User answers during planning (2026-11-30): +- **Rehearsal writes:** throwaway rehearsal refs are allowed (the prepared commit is pushed to a throwaway `rehearsal/…` branch and deleted at the end). `main`, `v2.x`, `v3`, tags, `swift-releases`, registries, GitHub releases, issues and labels stay untouched. +- **Timing:** the full 14-path rehearsal runs before #937 against a labelled simulation of the post-move layout; this is the mission's acceptance. After the #937 rename and before the tag, #937 re-runs a routing-only rehearsal on the real branches. +- **Recovery:** identity-safe resume. A retry reuses the tested release identity, uploads only what is missing, accepts what is already published, repairs channels, and fails on any conflict, never deleting or overwriting anything public. +- **README stamping:** a 3.x prerelease stamps its version on the 3.x line's README (Swift with `exact:`); a later stable release restores the normal form. +- **npm channels:** build the full rule now, including the `v2` maintenance tag for 2.x patches after 3.0.0 stable. + +## 2. Goal + +Every `core-release` dispatch, and every manual recovery, makes each of the seven publishers build the right source line for the dispatched major. It converts the core dependency to the exact registry crate with features intact and proves that resolution before building. It publishes correctly spelled, correctly channelled artifacts and updates only the branch it built from. Before the branch move this is shown by a no-publish rehearsal of 7 bindings × 2 lines, run with the workflow definitions that will be the default branch's. The alpha (#929) can then be tagged with the binding side ready, and a partial failure can be resumed without touching anything already public. + +## 3. Context & Investigation Findings + +Sources: Claude-01 and Codex-01 (both in `Planner-Discussion/`; Codex-01 has per-line evidence for every finding below). References are `origin/` of each repo. State on 2026-11-30: core `v3` `cbce893a6`, core `main` `83467700b`; publisher `v3` tips include node#30 and c#22. `v2.x` exists only in minigraf-java (`0d631ef1`); `swift-releases` exists in minigraf-swift. + +### Definitions +- **Line:** the 3.x line (`v3` today, `main` after #937) or the 2.x line (`main` today, `v2.x` after #937; Java's 2.x line is `v2.x` both before and after). +- **Production run:** a release run started by `core-release` or by a manual dispatch without rehearsal. **Rehearsal run:** a run explicitly started as a rehearsal by a manual dispatch. +- **Source commit:** the line head the run starts from. **Prepared commit:** the source commit plus the release pin (manifest, lockfile, stamped READMEs). **Write target:** the branch that the tag push fast-forwards. +- **Release identity:** dispatched tag; source and prepared commits; the dependency resolution (core package source, version, checksum or Git SHA, enabled features); and the artifacts' names and digests. +- **Supported versions:** `vMAJOR.MINOR.PATCH` with MAJOR 2 or 3, optionally followed by exactly one of `-alpha`, `-alphaN`, `-beta`, `-betaN` (N 2–9) or `-rcN` (N 1–9). Everything else is unsupported, including `rc10`, which SemVer sorts below `rc2`. +- **Spellings:** the Git tag keeps the `v`. Cargo, npm, Maven, SwiftPM and the GitHub release use the unprefixed SemVer (`3.0.0-alpha`). PyPI uses PEP 440: `-alpha`→`a0`, `-alphaN`→`aN`, `-beta`→`b0`, `-betaN`→`bN`, `-rcN`→`rcN` (Codex verified this with `packaging.version`). + +### Core contract (merged #954/#955; keep it) +`core@v3:.github/workflows/cascade.yml` and `.github/release/release.sh:9-12,121-129`: the dispatch carries only `client_payload.version` = full tag, to the 7 publishers (the template isn't dispatched). Each binding must validate the payload itself. Core's candidate `Cargo.toml` still says `2.0.5`; #929 bumps it. + +### Shared release skeleton: gaps in all 7 (`release.yml` on `v3`, the same on `main` except Java) +- `prepare` checks out the default branch with no selection (python `:22-24`; c/swift `:24-26`; android `:21-23`). Java's selection (`:32-57`) tries `v.x` and falls back to `main`; its guard reads only a string pin, so with a Git pin it fails open. +- No version validation (Swift's regex `:32` rejects prereleases). +- Pin `sed`s (python `:51-54`, swift `:57` string-only) leave every `v3` manifest unchanged (Codex ran them), so the Git dependency survives; the following `cargo update --precise ` can't be relied on to turn it into the exact registry dependency. Nothing asserts the resulting `Cargo.lock`. The build steps can still change the lockfile (Codex-01 lists them). +- `prepare` force-pushes `release/` (`:61-73`); the tag job hard-codes `refs/heads/main` (`:104-116`); recovery means deleting the tag. +- `test` calls `./.github/workflows/ci.yml` with `ref: `. Reusable workflows come from the caller's commit, so after #937 the 3.x line's ci/package/verify definitions run against 2.x source. +- `verify-published.yml` opens `release-broken` issues and labels on failure, which are writes. +- The crates.io wait (all 7, bounded) polls the crates.io API, which doesn't prove that Cargo can resolve the exact, unyanked version from the index (AC7 covers that). + +### Per binding +| Binding | Findings | +|---|---| +| python | `package.yml:58-84` wheel-name check and `consumer-test/run.sh:58-59` metadata check compare against the SemVer spelling, so both fail for `3.0.0a0`. The registry install and PyPI JSON URL need the PEP 440 spelling. No partial-upload reconciliation (`release.yml:131-146`). Glibc ≥2.34 and no sdist (#9) must be in the alpha notes. | +| node | 5 tarballs (`minigraf` + 4 platform packages) published with no dist-tag; the skip-if-exists check (`:156`) checks only that a version exists. `ci.yml:58-59` `test:types` doesn't exist on 2.x source. `scripts/stamp-version.js` stamps the 5 packages correctly; keep it. | +| wasm | `@minigraf/browser` + `@minigraf/wasi`, same publish gaps as Node. WASI is built from a core **source checkout** (`package.yml:80-93`, `core-ref`), not from crates.io: the release passes `v`; the CI defaults are `v3` (on `v3`) and `main` (on `main`), and both go wrong at the move. `ci.yml:82` OPFS readme-sync file is absent on 2.x. The `v3` CI labels Firefox/WebKit legs, but 2.x's consumer always runs Chromium (false coverage). `package.yml:54` stamps "IndexedDB or OPFS" whatever the source. The `browser` feature must survive the conversion. | +| swift | The regex rejects prereleases. The README stamp uses `from:`. `gh release create` (`:249-254`) has no prerelease flag. The `source-` tag sits on the source commit; the SemVer tag sits on a `swift-releases` commit with the URL, checksum and generated sources. `:202-221` treats any fetch failure as "no branch" (orphan) and force-pushes; both lines share the branch. `ci.yml:59-83` compiles `Tests/swift/main.swift`, absent on 2.x. | +| android | `package.yml:89` asserts the 3.x class namespace (2.x has `uniffi/minigraf_ffi`). The README stamps `minigraf-android:`. `consumer-test/run.sh:50-55` checks only the requested coordinate: a version requested as `3.0.0-alpha` but resolved `-> 3.0.0-beta` still passes (Codex reproduced this). Publish always re-runs Central publication. The Kotlin namespace change (`io.github.project_minigraf.minigraf`) must be in the alpha notes. | +| c | No prerelease flag (`:129-133`). Assets are uploaded with `--clobber` and no byte comparison (`:153-155`). `ci.yml:37-53` ETL smoke test file is absent on 2.x. The archive names accept a suffix already. | +| java | Fail-open selection (above). `v2.x`'s own `release.yml` is an older, weaker pipeline: no routing, it pushes `main`, publishes a 4-native build after tagging, and has no verify step. A manual `--ref v2.x` run can start it. `ci.yml:171-201` already packages and consumer-tests `v2.x` with the PR's workflows, but only for PRs to `main`. The consumer has the same requested-vs-resolved weakness as Android. `v3` pins core `353bd58be`, not `b6245cc2c`. | +| template | No release.yml; README `:34-36,60-68` guidance lacks routing, channels, PEP 440, rehearsal and identity-safe recovery. `ci.yml:5` triggers only on `main` pushes (on both branches). The placeholder registry mode deliberately fails; keep that. | + +### CI triggers +python/node/wasm push+PR and c/swift/android push are `[main, v3]` on `v3` (`[main]`-ish on `main`); java `[main, v3, 'v*.x']`; template `[main]`. After #937, `v2.x` would get no CI except in Java. + +### Docs that describe this process +core `CONTRIBUTING.md:130-138` (release steps, cascade recovery); minigraf-java `README.md` "Cascade release" (`:83+`); template `README.md:34-68`; python/android READMEs mention the "pinned, unreleased v3 core (commit …)", which the re-pin must keep accurate. Project memory note `constraint_cascade_monitoring` describes tag-deletion recovery (Planner/user update it after the mission; not a deliverable). + +## 4. Acceptance Criteria + +Unless a criterion names one, each applies to all 7 publishers. "Fails" means the run stops with an error that names the offending value (version, branch, file, package), before any later step that writes or publishes. + +**A. Validation and routing** +1. A production run validates the dispatched version before anything else. It fails on an unsupported version (§3 Definitions), a missing or empty version, or a value with characters outside the grammar. Tests cover `v3.0.0-alpha`, `-alpha2`, `-beta`, `-beta2`, `-rc1`, `-rc9`, `v3.1.0`, `v2.0.13` (accepted) and `v3.0.0-rc10`, `v3.0.0-alpha.1`, `v3.0.0-gamma`, `v4.0.0`, `v1.9.0`, `3.0.0`, an empty string and shell metacharacters (rejected). +2. In the post-move layout, major 3 builds from and writes to `main`, and major 2 builds from and writes to `v2.x`. The write target is always the source branch. A missing intended branch fails, with no fallback to another branch. Java's fail-open `v.x`/`main` heuristic is gone. +3. **Pre-move guard:** until #937, the release workflow on each current default branch (current `main`; for Java its current `main`) accepts only major 2 and fails on a 3.x dispatch with a message saying the 3.x release needs the #937 move. A 2.x release from those branches behaves as today, apart from this guard and AC4. +4. **One production entry point:** a production run proceeds only from the repository's default-branch workflow definition. A production dispatch of any other branch's `release.yml` (for example `--ref v2.x` after the move, or Java's current `v2.x` copy) fails before writing. Rehearsal runs are exempt (AC24). +5. Runs for the same tag in one repository never overlap. A second concurrent run waits or fails; it never interleaves with the first. Every run that updates `swift-releases`, of either line, is serialized. + +**B. Dependency conversion and provenance** +6. The prepared commit's manifest depends on `minigraf = "="` from crates.io, with no `git`/`rev`/`branch`/`tag`/`path` left. Every other key on that dependency (`features`, `default-features`, `optional`, …) is unchanged. This holds for every form in use: string, version table, version table + `features` (wasm), Git/rev table, and Git/rev table + `features`. A missing, duplicated or unparseable `minigraf` dependency fails. +7. Before any artifact is built in a production run, the resolved graph is checked: `Cargo.lock` has exactly one `minigraf` package, from the crates.io registry, at exactly ``. Separately, the features that `minigraf` is resolved with, taken from the resolved build graph rather than from the lockfile (a lockfile doesn't record features), are the closure the declaration intends for the built configuration. Cargo's semantics apply: core declares `default = []`, so with default features left on, `default` is legitimately in the resolved set (`["default"]` for most bindings, `["browser", "default"]` for wasm), and features implied by requested ones aren't "extra". `browser` must be present where requested (wasm); a feature that neither the declaration nor its closure explains, or a requested feature that's missing, fails. Don't change the bindings' `default-features` settings just to satisfy the check. Any later build step that would change the lockfile fails instead. The failure cases are wrong version, Git or path source, stale lockfile, a lost requested feature and an unexplained feature; the empty-default case is among the accepted examples. +8. WASM's WASI package records the exact core source SHA it was built from, and that SHA is the commit of the core tag `v` in production (the candidate SHA in rehearsal). Push and PR CI on each line derive the WASI core from that line's pinned core (the tag of a registry pin, the rev of a Git pin), never from a moving core branch name. +9. The conversion (AC6) and provenance check (AC7) have automated tests over fixture manifests and lockfiles covering every form and failure case in AC6–AC7. They run in each publisher's CI on both lines. + +**C. Versions, channels, release metadata** +10. **Python:** the wheels' filenames and installed metadata use the PEP 440 spelling. The package check, the local consumer test and the registry consumer test (`pip install minigraf==3.0.0a0`) compare against that spelling. Git refs and the core dependency keep the SemVer spelling. Errors that involve both spellings name both. +11. **npm (Node: `minigraf` + 4 platform packages; WASM: `@minigraf/browser`, `@minigraf/wasi`):** each publish names its dist-tag explicitly. The decision is made once per release for the repo's whole package set, then applied to every package in it. A prerelease goes to `next`. A stable release whose major is below the highest major that any package in the set has on `latest` goes to `v` (for example `v2`). Any other stable release goes to `latest`. No channel on any package ever moves to a lower version than it points at, so a package whose channel is already ahead keeps it, and the run summary reports any packages in the set whose channels disagree. Channel changes in one repo are serialized across all release runs, different versions included, and each one re-reads the current channels before deciding. A test covers the decisions: a 2.x patch before 3.0.0 stable (→ `latest`), after it (→ `v2`), after a partial 3.0.0 that moved `latest` on only some packages (→ `v2` for all, root not moved backwards), a repeat of an older prerelease while `next` is newer (unchanged), the first stable 3.0.0 (→ `latest`), and two different-version runs competing for `next`/`latest`. +12. **GitHub releases (C, Swift):** a prerelease is created as a prerelease. A stable release whose major is below the highest released stable major is not marked Latest. A release that already exists is checked for the same classification and corrected, without changing its assets. +13. **Swift:** prerelease tags are accepted in the version check, the `source-` tag, the xcframework zip name, the release asset URL and Package.swift. The SemVer tag always points at the generated `swift-releases` commit with the right URL and checksum, never at the source commit. +14. **README stamping (Android, Java, Swift):** a 3.x prerelease stamps its exact version on the line it was built from. Swift uses `exact: ""` for a prerelease and `from: ""` for a stable release, and either form is rewritten correctly whatever the README held before. README sync with the consumer test still passes. +15. **Maven (Java, Android):** `3.0.0-alpha` is published as is, with unchanged coordinates and JNA metadata. The consumer test fails unless the **resolved** version equals the version under test; a request resolved to another version, such as `3.0.0-alpha -> 3.0.0-beta`, fails, and a test covers that case. + +**D. Both lines under one set of workflows** +16. Run from the 3.x line's workflow files (the post-move default), the full release test path (ci, package, consumer, readme-sync, and verify-published's consumer test) passes on 2.x source and on 3.x source. Which checks run is decided from the checked-out source tree, not from the artifact version label (CI uses placeholder versions such as `0.0.0-ci` and `0.0.0.dev0`). +17. The 3.x-only checks still run, and must pass, on 3.x source: Node `test:types`, WASM OPFS readme-sync and the browser engines, Swift `Tests/swift/main.swift`, C ETL smoke test (ASan), Android/Java new-namespace assertions. Removing one of them from 3.x source fails CI; it is never skipped silently. The 2.x checks assert the 2.x namespaces and contracts. Checks both lines support keep running on both, for example Java's musl/Alpine runtime and consumer legs: Java's `v2.x` detects musl (`java/build.gradle.kts:120-122`), and the `ci.yml` comment saying v2.x predates musl is stale. +18. WASM: each run reports the browser engines it actually ran, and labels match. On 2.x source the package description doesn't advertise OPFS. +19. CI runs on pushes and PRs (where the repo has PR triggers today) to `main` and to `v2.x`, on both lines' copies of `ci.yml`, in all 7 publishers and the template, so the triggers keep working after the rename. (Keeping `v3` in the filters until the move is fine.) + +**E. Identity-safe recovery (production)** +20. If the binding tag for the dispatched version already exists, the run uses the tagged commit as the prepared commit and doesn't re-prepare from the branch head. It fails if that commit doesn't pin exactly the dispatched version (AC6–AC7) or isn't contained in the line's branch. A tag is never deleted or moved. (Swift: the `source-` tag and the SemVer tag, as today.) +21. A retry establishes the original tested release identity (AC20's tag, plus the artifacts and evidence that the original run tested) and reconciles against it. A file or package already published under this version is never re-uploaded or replaced; it is checked against the original tested artifact's digest where the registry exposes one (PyPI, npm, GitHub release assets, Maven checksums). Missing items are uploaded only from the original tested artifacts, or from a rebuild whose digest equals them (Android/Java's reproducible rebuild-and-compare qualifies). A rebuilt artifact with a different digest never substitutes, whatever a consumer test says. That covers individual wheels, individual npm packages, individual C archives, the Swift zip (it must match the checksum in the public SemVer tag's Package.swift) and a Maven deployment that was never published (a deployment pending or already published on Central is recognized, not resubmitted). A conflicting digest, or original artifacts or evidence that can't be found, fails with a recovery-conflict error naming the item; nothing public changes. How the tested artifacts and evidence are kept and found again is the Generator's choice; it must survive long enough to cover a retry during a release (state the retention in the docs). Tests cover a published item with a conflicting digest, unavailable original artifacts, and a Swift SemVer tag whose matching zip was never uploaded. +22. A retry repairs channels and release metadata to AC11/AC12 even when nothing is uploaded (for example an npm version already published without `next`). +23. Every retry ends with the exact-version consumer test against the registry (verify-published). A partial or skipped publish is never reported as success without it. On a production failure, `release-broken` reporting still works. + +**F. Rehearsal (core #960 "Before tagging")** +24. A rehearsal run starts only from a manual dispatch that explicitly asks for a rehearsal; `core-release` can never start one. It runs the same workflow files and the same routing, conversion, provenance, package and consumer steps as production, with these differences only: + - it may push the prepared commit to a throwaway `rehearsal/…` branch, deleted when the run ends, on success or failure; + - it never creates, moves or deletes `main`, `v2.x`, `v3`, `swift-releases` or any tag, never publishes to a registry, never changes dist-tags or GitHub releases or assets, never opens issues, labels or comments, and never dispatches other workflows; + - it doesn't take the AC20 resume path (it always prepares from the source head), but reports which decision production would take for that tag; + - before #937 it can map each line to its current physical branch through a rehearsal-only, labelled alias (3.x → `v3`, 2.x → current `main`; Java 2.x → its real `v2.x`). The alias is shown in the run summary and can't be used by a production run; + - for the 3.x line it builds against an explicitly given candidate core commit (Git dependency at that exact SHA, features kept), recorded as candidate, never as registry resolution. For the 2.x line it uses the real registry conversion and the AC7 check against a published 2.x crate. +25. Each rehearsal run's summary records: workflow commit W; source branch (physical, plus the alias), source SHA and prepared SHA; write target; dispatched tag and ecosystem version (plus the PyPI spelling); dependency source (candidate core SHA, or registry version + checksum + lockfile source line) and resolved features; WASI core SHA (wasm); artifact names and digests; the consumer test legs and results; and a statement that no protected ref, tag, registry, release or issue changed. It also lists the refs it pushed and confirms they were deleted. +26. **The ledger:** 14 green rows, 7 publishers × {`v3.0.0-alpha` on the 3.x line with the candidate core = the final core `v3` SHA of AC28; `v2.0.12` on the 2.x line with live registry resolution of `minigraf 2.0.12`}. Plus, per publisher, failing rehearsals showing that an unsupported major (`v4.0.0`) and a missing intended branch both fail before any build. Every row was run with the same W per repo, and W's workflow files are identical to those on the merged `v3` at the end of the mission. The ledger is posted on core #960 (the "Before tagging" boxes ticked except the post-move routing check, which is #937's) and kept in `Assets/`. +27. Rehearsal-safety evidence: for at least one publisher per publish mechanism (PyPI, npm, GitHub release, Maven, SwiftPM), the run log shows the publish, tag and issue steps skipped, and the repository's refs, tags, releases and registry versions are the same before and after the run. + +**G. Re-pin, template, docs** +28. After the workflow PRs merge, every publisher's `v3` and the template's `v3` pin the same core `v3` SHA (the core `v3` head at that time, re-read then), with CI green on each exact tip. README text naming the pinned core commit is updated. The handoff to #937 names the pinned and rehearsed core SHA. If core `v3` moves after that, a change that can affect binding builds, dependencies or behaviour (anything under `src/`, `Cargo.toml`, features, build scripts) needs updated pins, green CI and the affected rehearsal rows again before #937 relies on the handoff. A change that demonstrably can't (documentation, core-only CI) is reconciled explicitly in the handoff note, listing the commits, without claiming the old evidence ran on the new SHA. The #937 post-move routing check records the core SHA it ran with. +29. binding-template: CI triggers for both lines on both branches; the README's release guidance covers routing by major, conversion and the provenance check, version spellings, channels, rehearsal and identity-safe recovery. Existing template tests, clippy, fmt and the placeholder package and consumer checks pass. Its registry pin to the published alpha is handed to #929 (#6 stays open). +30. Docs updated in the same PRs: Java README "Cascade release"; each publisher README wherever it describes releasing; core `CONTRIBUTING.md` release section (binding retries resume at the tested identity, and a repeated cascade is safe for bindings that already finished); the spec copy (deliverable 5). No issue is closed by a closing keyword: python#24 … java#30, #960 and #6 are closed or updated by hand after verification. The handoff notes for #937 (post-move routing check, Java's stale `main`, `swift-releases` kept) and #929 (production publication record, npm/GitHub channel checks) are posted on those issues. + +## 5. Edge Cases & Boundaries +- `main` exists before and after the move but holds a different line; nothing may infer the line from the branch name alone. Pre-move, AC3 protects; post-move, AC2. +- Manual recovery `gh workflow run release.yml -f version=v2.0.13` after the move must route exactly like the dispatch (default-branch file, 2.x → `v2.x`). +- A 2.x and a 3.x release at the same time (different tags) may run in parallel, except their `swift-releases` updates (AC5). A transient fetch failure on `swift-releases` is an error, never "the branch is absent" (the branch exists and must keep its history). +- The core tag exists but the crate isn't yet resolvable (index lag, yank): the run waits within a bound, then fails without switching source or channel. A registry error isn't evidence that a version is absent; a recovery decision needs a definite answer. +- The branch advanced after a successful tag: a retry uses the tag (AC20). The branch advanced before any tag existed: nothing is public, so the run prepares again and tests again. +- An npm version published by an earlier run without the right dist-tag; `next` already points at a newer prerelease (AC11: no backward move). +- The alpha's Python spelling vs the Git tag: never `v3.0.0a0` as a tag, never `3.0.0-alpha` as a wheel version. +- The candidate core manifest still says `2.0.5` until #929; rehearsal records the real candidate version next to the artifact label `3.0.0-alpha`. +- CI's placeholder versions (`0.0.0-ci`, `0.0.0.dev0`) still package and consumer-test on both lines. +- The WASI package is an in-memory REPL, Python needs glibc ≥2.34 with no sdist, and universal macOS slices are only checked for presence. These are existing limits: don't expand them and don't claim more. +- Java: its current `main` (stale 2.0.2) is not a source line for anything; #937 replaces it with `v3`. Its `v2.x` keeps its history. + +## 6. Key Decisions +- **Major → branch map, fail closed** (3 → `main`, 2 → `v2.x`). Rejected: Java's "maintenance branch if present, else `main`", which falls through silently. Rejected: adding a branch to the core payload, which would tie core to binding layout and break the agreed contract. +- **The default branch's workflow files run both lines.** That's what GitHub does for `repository_dispatch` after the move, and what #960 requires to be tested. Which checks run is decided from the source tree. +- **Candidate core for the 3.x rehearsal, live registry for the 2.x rehearsal, fixtures for conversion.** Requiring the unpublished alpha crate before tagging is circular. `v2.0.12` is the representative 2.x patch because it's published, so the real registry path and lockfile check run for real. Nothing is published, and no tag is touched. +- **Throwaway rehearsal refs** (user): the rehearsal follows the same prepare → push → test path as production instead of a separate transport. +- **Pre-move simulation plus a post-move routing check** (user): the mission finishes before #937; #937 confirms on the real branches before the tag. +- **Identity-safe resume** (user): #960's "retry only missing work at the same tested identity" needs workflow support, and deleting public tags isn't acceptable once packages exist. +- **npm rule built now, including `v2`** (user), so 3.0.0 final needs no workflow change. +- **README stamping on the line** (user): the 3.x README shows the 3.x prerelease; Swift uses `exact:`. +- **Keep packaging ownership:** `package.yml` still builds every artifact; Android/Java keep the rebuild-and-compare before Central. No new publisher tooling. +- **Pre-move guard on the current default branches** instead of a held release window: even if the order of #937 and #929 slipped, a 3.x dispatch could never build 2.x source. + +## 7. Out of Scope +- Tagging, publishing, the #929 bump, the #937 renames, protections and default-branch changes, and #960's "After approved publication" half. +- Core `release.yml` (cargo-dist generated), cascade.yml and release.sh, beyond the CONTRIBUTING text. +- Python glibc/sdist (#9), new platform matrices, a WASI GitHub release, replacing the Maven tooling, any binding API change. +- Template #6's post-publication registry pin and its API review against 3.x (they need a published 3.x; #6 stays open). +- Core nightly/bench branch remapping (#937). + +## 8. Possible Directions & Ideas (non-binding) +- One small helper (validate version → major, line, PEP 440 spelling, npm tag, GitHub-latest decision; convert manifest; check provenance) copied into each repo like `consumer-test/readme_sync.py`, with fixture tests, would keep 7 repos consistent. Keep it runnable from the default-branch workflow even when a 2.x source is checked out (the helper comes from W, not from the source). +- Java's `ci.yml:171-201` (package and consumer-test `v2.x` with the PR's workflows) is a model for continuous both-line coverage. Before the move it could target the current 2.x branch. +- `cargo metadata --locked` and `cargo tree -e features -i minigraf` both report resolved features. +- Whether `workflow_dispatch --ref ` takes its inputs from that branch's copy of the file needs checking empirically before relying on it. +- Worth reading: core `docs/superpowers/specs/2026-10-20-binding-consumer-tests-design.md` and `.github/release/test_release.py` (the cascade's fixture-test style). From a0051f8a4c9670622b36a31a3d62cbde50804908 Mon Sep 17 00:00:00 2001 From: Aditya Mukhopadhyay Date: Tue, 1 Dec 2026 08:01:30 +0530 Subject: [PATCH 2/2] docs: record binding release routing amendments (#960) Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01H2a7QkSTdhquSfwFKL6Y4o --- CONTRIBUTING.md | 2 +- .../specs/2026-11-30-binding-release-routing-design.md | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 80febebe46..c95077cc91 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -123,7 +123,7 @@ Releases are managed by the project maintainer. The process is documented in iss `docs/superpowers/specs/` design files. For each release: 1. All prerequisite issue PRs merged and CI green -2. Version bumped consistently across all manifests (`Cargo.toml`, `package.json`, `pyproject.toml`, `build.gradle.kts`, `Package.swift`) +2. Core version bumped in its release manifests. Binding workflows derive their package versions and core dependency pins from the dispatched tag after core publication, using each ecosystem's spelling. 3. `cargo check --workspace` passes cleanly 4. All affected docs synced (see `CLAUDE.md` — "Keep documentation synchronized") 5. From a clean checkout of the final candidate commit, run `cargo publish --dry-run --locked` before creating the tag. Record the commit SHA and result in the release issue; a failure must be resolved before tagging. `Cargo.lock` is currently untracked, so this check does not establish that CI and publishing used the same dependency resolution. diff --git a/docs/superpowers/specs/2026-11-30-binding-release-routing-design.md b/docs/superpowers/specs/2026-11-30-binding-release-routing-design.md index 0332ffcc7b..271d8d5feb 100644 --- a/docs/superpowers/specs/2026-11-30-binding-release-routing-design.md +++ b/docs/superpowers/specs/2026-11-30-binding-release-routing-design.md @@ -2,6 +2,15 @@ **Mission Type:** code (GitHub Actions release/CI workflows, small helper scripts with tests, consumer tests, READMEs) plus a rehearsal evidence record, across 9 repositories. No core library, API, file-format or binary-size change. +## Implementation amendments + +- **npm maintenance channel (§1, AC11, §6):** Node and WASM use `maintenance-v` (for example, `maintenance-v2`), as approved by the maintainer. npm rejects `v2` because it parses as a SemVer range; see [npm's tag restrictions](https://docs.npmjs.com/cli/v11/commands/npm-dist-tag/#caveats). +- **npm holding tag (AC11):** when a missing package's selected channel already points to a newer version, publish the original tested package under `release-` (unprefixed SemVer), leaving that channel unchanged. The holding tag is retained; existing packages still undergo digest reconciliation and forward-only channel repair. +- **Prepared-commit transport (§1, AC24–25, §6):** all seven publishers use Git bundles in both production and rehearsal. No `rehearsal/…` branch is pushed or needs cleanup; rehearsal evidence records empty pushed/deleted-ref lists. +- **Python lockfile enforcement (AC7):** direct Cargo and Maturin commands use `--locked`, but Maturin's nested UniFFI Cargo invocation does not propagate it. The adapter compares the lockfile digest after each command and fails on a change before accepting or uploading artifacts. +- **Publication serialization (§5):** C serializes release-history reads, asset reconciliation and metadata writes across versions, in addition to the specified npm channel and Swift publication locks. +- **Pending runs (AC5):** concurrency groups disable cancellation of running work but retain GitHub's default single-pending behavior: a new arrival can cancel an older pending run or job. A superseded release must be dispatched again if still needed; see [GitHub's concurrency rules](https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-workflow-concurrency). + **Base branches and deliverables (PRs):** 1. **Each of the 7 publishers (python, node, wasm, swift, android, c, java), `v3`** (becomes `main` at #937; merge commit): routing by major, exact registry conversion with provenance checks, version spellings and channels, identity-safe recovery, rehearsal mode, both-line compatibility of the default-branch CI/package/verify workflows, both-line CI triggers, README/doc updates. 2. **Each of the 7 publishers, current `main`** (becomes `v2.x` at #937; squash): the pre-move guard (this branch's release accepts only 2.x), the production entry-point guard (§4 AC4), CI triggers that include `v2.x`, and any fix `v2.x`'s own CI needs (for example the WASM WASI core reference). **Java:** the same on its existing `v2.x` instead (Java's `main` is a stale 2.0.2 line that #937 replaces; it gets only the pre-move guard).