Skip to content

chore(cargo): enforce 14-day min-publish-age for crates.io deps - #258

Merged
storopoli merged 1 commit into
mainfrom
chore/cargo-min-publish-age
Sep 2, 2026
Merged

storopoli merged 1 commit into
mainfrom
chore/cargo-min-publish-age

Conversation

@storopoli

Copy link
Copy Markdown
Member

Description

Adds a 14-day cooldown for crates.io dependencies through Cargo's new min-publish-age setting (RFC 3923), in a root .cargo/config.toml:

[unstable]
min-publish-age = true

[registry]
global-min-publish-age = "14 days"

Dependabot already waits 14 days before proposing a bump. This makes plain cargo add, cargo update, and hand-edited version requirements follow the same rule, so a freshly published (and possibly compromised) release can't slip in through a developer's PR. Versions already in Cargo.lock are left alone. For an urgent fix there is a one-off escape hatch:

CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE=allow cargo update -p <crate>

This repo pins a nightly that already has the feature, so the cooldown is active right away for anyone building with the repo toolchain.

Tracking: STR-3852.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature/Enhancement (non-breaking change which adds functionality or enhances an existing one)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor
  • New or updated tests
  • Dependency Update

Notes to Reviewers

One gap worth knowing about: versions already in Cargo.lock are exempt by design, so a lockfile produced with the override still passes cargo build --locked in CI. If we want CI to catch that, cargo update --dry-run prints a Downgrading line for every locked version that violates the policy and can be turned into a check. That is out of scope for this PR.

The [unstable] table is temporary. Stable cargo ignores it, and nightly cargo needs it until the feature reaches stable in Rust 1.100 (2026-11-12). After that it can be dropped.

Verified locally with cargo update --dry-run --workspace:

Locking 0 packages to latest compatible versions
note: pass `--verbose` to see 252 unchanged dependencies behind latest
warning: not updating lockfile due to dry run

AI disclosure: the change and this PR body were produced with Claude Code and Codex, then reviewed and tested by me.

Is this PR addressing any specification, design doc or external reference document?

  • Yes
  • No

If yes, please add relevant links:

Checklist

  • I have performed a self-review of my code.
  • I have commented my code where necessary.
  • I have updated the documentation if needed.
  • My changes do not introduce new warnings.
  • I have added (where necessary) tests that prove my changes are effective or that my feature works.
  • New and existing tests pass with my changes.
  • I have disclosed my use of AI in the body of this PR.

Related Issues

STR-3852

Cargo excludes crates.io versions published less than 14 days ago unless they are already locked. This matches the organization’s Dependabot cooldown. The [unstable] table is temporary until Rust 1.100.
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

🔒 AI Security Review (claude-opus-5)

✅ No security issues found.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Commit: 960e3f8
SP1 Execution Results

program cycles gas
asm-stf 187,638,746 184,112,468
moho 5,223,688 5,525,436

@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@storopoli
storopoli added this pull request to the merge queue Sep 2, 2026
Merged via the queue into main with commit 39d4d33 Sep 2, 2026
25 checks passed
@storopoli
storopoli deleted the chore/cargo-min-publish-age branch September 2, 2026 11:41
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