Skip to content

ci: enforce the versioning invariants the manifests only documented - #1973

Merged
thiras merged 5 commits into
mainfrom
chore/versioning-guards
Sep 10, 2026
Merged

thiras merged 5 commits into
mainfrom
chore/versioning-guards

Conversation

@thiras

@thiras thiras commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

A comparison against a sibling Rust workspace showed both use the same versioning skeleton (resolver 3, [workspace.package] version inherited by every member, cargo-release shared-version + one v{{version}} tag, git-cliff). The difference was enforcement: nothing here checked the invariants the manifests and CLAUDE.md describe. This PR adds the guards and fixes what they found.

Three commits:

  1. chore(release): read 0.0.0 until the first release is cut. The workspace sat at 0.1.1 from a chore(release): v0.1.1 commit that was never tagged, never released, never published. 0.0.0 says "not released" in the manifest; the first cargo release minor --execute makes it 0.1.0. Cargo.lock and the nine internal aliases move with it. Also fixes "twelve crates" → eleven in RELEASING.md and release.yml.

  2. ci: three stdlib-Python guards under .github/scripts/, each with a pytest suite, a repo: local pre-commit hook and a named step in the unconditional packaging job:

    • check_toolchain_pin.py — rust-toolchain.toml, Cargo.toml rust-version and every uses: dtolnay/rust-toolchain@X ref must carry one identical X.Y.Z. rust-version becomes 1.95.0. A Dependabot action-ref bump now stays red until the two TOML sites move in the same PR (dependabot.yml comment updated to say so).
    • check_workspace_manifests.py — every member inherits version/edition/license/rust-version and [lints] workspace = true; publishable members inherit the registry metadata and carry their own description/readme; internal [workspace.dependencies] aliases match the workspace version and exist iff something depends on the member; every crates/*/Cargo.toml is in members.
    • check_crate_edges.py — holds CLAUDE.md's dependency flow as a table over cargo metadata (normal deps only) and keeps decdn-cli's closure free of iroh-blobs/aws-sdk-s3/aws-config (CLI binary-split regression: publisher links cache crate (iroh-blobs/AWS SDK) #578). CLAUDE.md's flow paragraph was stale (missing bao-range on node, bao-range+config-types on cli) and is corrected from the real graph.

    CONTRIBUTING.md's hook list is refreshed (it omitted eight existing hooks) and the reference to a non-existent msrv job removed.

  3. chore(cliff): a ### Breaking section at the top of release notes, with BREAKING CHANGE: footer text nested under the subject; protect_breaking_commits = true so a breaking commit with a malformed prefix is not silently dropped. The [git] block gains comments.

Verification

  • pytest .github/scripts/tests — 101 passed.
  • Each guard run against the repo passes; each fails on a deliberate drift (one action ref bumped to 1.96.0; crates/reputation restating version; decdn-cli gaining a decdn-cache edge — reported both as a forbidden edge and as aws-config ← decdn-cache ← decdn-cli).
  • cargo check --workspace --all-targets --locked and cargo package --workspace --no-verify --locked pass at 0.0.0.
  • git cliff --unreleased renders the Breaking block; no commit appears in two sections.
  • pre-commit run --all-files for the affected hooks passes; pre-commit validate-config passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JAP9seDwFLb8kAb3TA1sPS

thiras and others added 3 commits September 10, 2026 18:21
The workspace version is the one fact `cargo release` moves, and `0.1.1`
claimed a release that does not exist: no `v0.1.1` tag, no GitHub Release,
nothing on crates.io. `0.0.0` says "not released" in the manifest itself.
The first `cargo release minor --execute` makes it `0.1.0`.

The internal `[workspace.dependencies]` aliases and Cargo.lock move with it.
RELEASING.md states the rule, and the tag-vs-manifest check in release.yml
now counts the eleven crates the workspace actually has.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JAP9seDwFLb8kAb3TA1sPS
Three repo-shape invariants were documented and enforced by nobody:

- The Rust version is written in rust-toolchain.toml, Cargo.toml's
  rust-version and twelve dtolnay/rust-toolchain@ refs, each read by a
  different tool. Dependabot bumps only the action refs, so one merged bump
  leaves CI compiling on a different compiler from every developer.
  check_toolchain_pin.py refuses the sites to differ; rust-version becomes
  the three-part `1.95.0` so the strings compare byte-for-byte.
- A member that restates `version` ships its own number, and one without
  `[lints] workspace = true` runs under default lint levels; neither warns.
  check_workspace_manifests.py refuses both, plus an internal alias whose
  version disagrees with the workspace's, an alias nothing depends on, and a
  crates/ directory missing from `members`.
- Cargo enforces acyclicity only. check_crate_edges.py holds the dependency
  flow from CLAUDE.md as a table and keeps decdn-cli's closure free of
  iroh-blobs and the AWS SDK (#578). CLAUDE.md's flow paragraph was stale
  (bao-range and config-types edges) and is corrected from the real graph.

Each is a stdlib-Python guard with a pytest suite, a `repo: local` hook and
a named step in the `packaging` job. CONTRIBUTING.md's hook list is
refreshed and the stale `msrv` job reference removed.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JAP9seDwFLb8kAb3TA1sPS
Release notes open with a `### Breaking` block: every commit marked with
`!` or a `BREAKING CHANGE:` footer, with the footer text nested beneath the
subject. A breaking commit is listed there and nowhere else, so the grouped
sections carry only the non-breaking ones. `protect_breaking_commits` keeps
a breaking commit whose subject fails conventional parsing — pre-launch,
wire- and config-breaking changes are the ones an operator reads first, and
a typo in the prefix must not hide one. The `[git]` block says why each
setting is what it is.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JAP9seDwFLb8kAb3TA1sPS
Copilot AI lite review requested due to automatic review settings September 10, 2026 15:22
@github-actions

Copy link
Copy Markdown

Gas snapshot

No gas changes vs base.

@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Contracts coverage

Line coverage: 89.75% (2575/2869 lines)
▲ +0.00pp vs base (89.75% → 89.75%)
Run: 34498156308

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The toolchain pin enforcement currently ignores .yaml workflows (only matches *.yml), which undermines the stated invariant by allowing drift to bypass the guard.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR tightens release/versioning discipline in the deCDN Rust workspace by resetting the workspace to an explicit “unreleased” version (0.0.0) and adding CI + pre-commit guards (with pytest coverage) that enforce toolchain pinning, workspace manifest invariants, and the crate dependency-flow design.

Changes:

  • Reset workspace + internal crate alias versions to 0.0.0 until the first real release is cut, and align docs/workflows to “eleven crates”.
  • Add three stdlib-Python guard scripts (toolchain pin, workspace manifests, crate edges), with wrappers, pytest suites, and enforcement in the packaging CI job and pre-commit.
  • Update git-cliff templating to surface breaking changes first and ensure breaking commits are not silently dropped.
File summaries
File Description
RELEASING.md Documents the 0.0.0 pre-first-release policy and corrects crate count.
CONTRIBUTING.md Refreshes hook list and documents the new repo-shape guard pattern + toolchain pin enforcement.
cliff.toml Adds a dedicated “Breaking” section and refactors note rendering via a macro.
CLAUDE.md Updates the documented crate dependency flow and states it is enforced by the new guard.
Cargo.toml Sets workspace version to 0.0.0, makes rust-version an exact X.Y.Z, and aligns internal workspace dependency alias versions.
Cargo.lock Propagates workspace version change to member packages in the lockfile.
.pre-commit-config.yaml Adds local hooks for toolchain pin, workspace manifests, and crate edges.
.github/workflows/release.yml Updates release-time version mismatch messaging (“eleven”) and related comments.
.github/workflows/ci.yml Adds guard steps to the packaging job (toolchain pin, workspace manifests, crate edges) and updates MSRV commentary.
.github/scripts/tests/test_check_workspace_manifests.py Introduces regression tests for workspace manifest invariants.
.github/scripts/tests/test_check_toolchain_pin.py Introduces regression tests for toolchain pin consistency checks.
.github/scripts/tests/test_check_crate_edges.py Introduces regression tests for dependency-flow enforcement and CLI closure constraints.
.github/scripts/check-workspace-manifests.sh Adds a thin shell wrapper to run the workspace manifest checker.
.github/scripts/check-toolchain-pin.sh Adds a thin shell wrapper to run the toolchain pin checker.
.github/scripts/check-crate-edges.sh Adds a thin shell wrapper to run the crate edges checker.
.github/scripts/check_workspace_manifests.py Adds the workspace manifest guard enforcing inheritance + alias invariants.
.github/scripts/check_toolchain_pin.py Adds the toolchain pin guard enforcing exact X.Y.Z agreement across all sites.
.github/scripts/check_crate_edges.py Adds the crate dependency-flow guard and decdn-cli closure “must-not-link” enforcement.
.github/dependabot.yml Updates guidance to reflect that CI will keep action-ref bumps red until TOML pins are updated too.
Review details
  • Files reviewed: 18/19 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/scripts/check_toolchain_pin.py Resolved
Comment thread .pre-commit-config.yaml Resolved
@github-actions

github-actions Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

Coverage report

Total: 82.63% (was 82.63%, ▲ +0.01%) — 76025/92001 lines

No Rust files changed in this PR.

History
Commit Total Δ vs base
7e975fd 82.56% ▲ +0.01%
61e2247 82.62% ▼ 0.01%
e372823 (HEAD) 82.63% ▲ +0.01%

thiras and others added 2 commits September 10, 2026 18:32
GitHub Actions reads both spellings, so a workflow added under the other
extension carried a site the guard never read and the hook never ran on.
The scan globs both, the hook's `files:` regex accepts both, and a test
holds it.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JAP9seDwFLb8kAb3TA1sPS
Toolchain pin: a `with: toolchain:` input overrides the `@ref` and is now
the step's value (an expression there is refused, not skipped); quoted
`uses:` values and composite actions under .github/actions/ are sites;
YAML comments are stripped first, so a commented-out step is neither a site
nor enough to satisfy the zero-refs floor.

Workspace manifests: a member reaching a sibling with its own `path` +
`version` bypassed the alias and packaged a version that was never
released; every internal dependency must be `{ workspace = true }`, a
crate's dev-dependency on itself excepted. An alias whose path is not a
member, and a missing workspace version, are named.

Crate edges: metadata is read with `--all-features`, so an optional
dependency cannot hide behind a feature; an empty resolve graph is a
failure, not a clean closure; a table row listing an edge the graph lacks
is rot too; build-dependencies are edges; the forbidden set covers the
whole SDK by prefix (`aws-sdk-*`, `aws-smithy-*`) without catching
`aws-lc-rs`. cargo's stderr passes through so a stale lock says so.

cliff.toml's comment on `protect_breaking_commits` described a rescue the
setting does not perform; it now says what the flag does, and the two
`chore(deps)`/`chore(release)` skip parsers move above `^chore` so they are
reachable. Docs: the guards' "nothing checks this" prose is written as
"without this check", deployment-manifest-mirror is named as bash, the
pytest suites are noted as non-gating, the pre-commit hooks re-run when
their own script changes, and CHANGELOG.md carries the PR's entry.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JAP9seDwFLb8kAb3TA1sPS
@thiras
thiras merged commit 00d9545 into main Sep 10, 2026
27 checks passed
@thiras
thiras deleted the chore/versioning-guards branch September 10, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants