Skip to content

feat(lockfiles): Cargo enforces the cooldown and waitHours on what it newly locks - #301

Merged
sweepies merged 2 commits into
mainfrom
feat/cargo-cooldown-env
Nov 13, 2026
Merged

sweepies merged 2 commits into
mainfrom
feat/cargo-cooldown-env

Conversation

@sweepies

@sweepies sweepies commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Every Cargo invocation the lockfile runner makes — a --precise update,
the boundary path, lockfile maintenance — now gets
CARGO_REGISTRY_GLOBAL_MIN_PUBLISH_AGE and
CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE in its environment. The age is
the longer of the directory's committed .cargo/config.toml cooldown,
passed verbatim in Cargo's grammar, and the job's effective waitHours,
so the transitive crates and maintenance re-resolves that lookup never
dated wait like the releases it did. An explicit 0 both disables the
check where nothing applies and stops a cooldown configured above the
runner's own directories — a parent checkout or an operator's Cargo
setup — from leaking into a run.

A security fix inside the committed window keeps its cooldown marker
end to end (transitive fixes mark only when the catalog dates the
target inside it, and a batch carries the reported marker through), so
its job alone runs resolver.incompatible-publish-age = "allow" while
the branch's other jobs stay deny. An unread committed cooldown fails
the directory's jobs, maintenance included, as its lookups already
fail; a Rust older than 1.100 still gets the floor on direct targets,
with a warning that its Cargo ignores the keys and transitive crates do
not wait.

Behaviour change: waitHours is passed to Cargo for every Rust
repository, so crates a resolve newly locks wait as long as the updates
that triggered it; security fixes are allowed through the
incompatible-publish-age check; a cooldown in a parent directory's
.cargo/config.toml no longer applies.

PR 3 of 3 for Cargo cooldowns (#297 fixture, #299 floor).

Details

  • The value Cargo gets: the committed cooldown verbatim when it's the longer, else "<n> hours" from the job's effective waitHours, else "0". For unnamed crates (those a --precise resolve walks past, and everything maintenance re-resolves), the wait is Evaluator::lockfile_wait_hours: the strictest active effective waitHours the rules give the repository's crates.io dependencies.
  • Security fixes: a fix's job runs under security.apply's wait, none by default, so Cargo never refuses a fresh fix that lookup proposed. Inside a committed cooldown the job also gets allow. A batch's rebuilt update now carries its proposal's fixes and cooldown marker, so a batched fix keeps both. The batch commit message still ignores fixes, as before.
  • From the feat(cargo): a committed Cargo cooldown is a floor on the release age #299 review: transitive fixes are marked only when the target is dated inside the window. A batch carries the marker. A huge committed value saturates and holds everything instead of overflowing.
  • Report: a Rust older than 1.100 adds a per-directory warning.
  • State versions: extract/files → 5, config/config-files/catalog/catalog-controls → 4. These are unreleased beyond feat(cargo): a committed Cargo cooldown is a floor on the release age #299.

Proof

Real Cargo through the sparse registry (test:tools, 32 passed):

  • A parent-directory cooldown no longer applies.
  • A committed cooldown and waitHours hold too-new transitive releases in updates and maintenance.
  • allow applies only to the fix's job.
  • A forged too-new job is refused, with the text pinned.
  • An unread cooldown fails the job.
  • Rust 1.99.1 warns.

Offline tests cover the batch paths, including a batched fix with no committed cooldown at wait 0 and a routine batched update at 24 hours, plus the overflow clamp. test:unit, clippy and fmt pass on the project VM. Corpus proposals are unchanged.

Docs: guide/lockfiles.md, guide/lookup-policy.md, the compatibility row, and a new departure (#cargo-transitive-wait).

Follow-ups

  • Per-registry values (one number per run today).
  • Parent-directory config leaks beyond this key.

View guided diff Turn on auto-fix

Review fixes (second commit)

  • A vulnerable lockfile-only crate gets only its fix. PR 3 reads a catalog for such crates to date the fix, and that catalog had also sent them through routine evaluation. Under the default config that meant major branches that can never lock, and a grouped branch where that failure blocked the fix. evaluate_with now refuses transitive dependencies outright.
  • A transitive fix waits out security.apply's wait. It is held with its eligibility date, instead of being proposed and then refused by Cargo.
  • A batched routine update waits for its own kind. It used to wait for the strictest kind.
  • Batch PR bodies list the advisories their fixes resolve. SecurityMergeWithoutDelivery can now fire on a batch.
  • An unreadable .cargo/config.toml in an unrelated workspace member no longer fails the whole workspace. Readable values still count toward the floor.
  • Docs: a crossing --workspace refusal reads "did not resolve … to requested version"; one job's wait covers everything its resolve newly locks; maintenance holds to the strictest active waitHours.
  • Corpus: 654 rust/uv/Cargo.lock rows lose routine proposals. The corpus harness gives every dependency a catalog, so those rows always showed proposals. In production, transitive crates never got a catalog, so production behaviour changes only for vulnerable ones.

test:unit, test:tools (32), clippy and fmt pass on the project VM.

Follow-ups (from the re-check)

  • A transitive fix held for security.apply's wait can't be sped up from the dashboard; a direct fix can.
  • A fix's own new transitive dependencies can still be too new for Cargo's deny (Cargo resolves in one pass).
  • A held transitive fix inside a committed cooldown doesn't show the cooldown on its held-back row.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
count-patchula 7f15540 Commit Preview URL

Branch Preview URL
Nov 13 2026, 09:58 PM

sweepies and others added 2 commits November 13, 2026 21:47
… newly locks

Every Cargo invocation the lockfile runner makes — a --precise update,
the boundary path, lockfile maintenance — now gets
CARGO_REGISTRY_GLOBAL_MIN_PUBLISH_AGE and
CARGO_RESOLVER_INCOMPATIBLE_PUBLISH_AGE in its environment. The age is
the longer of the directory's committed .cargo/config.toml cooldown,
passed verbatim in Cargo's grammar, and the job's effective waitHours,
so the transitive crates and maintenance re-resolves that lookup never
dated wait like the releases it did. An explicit 0 both disables the
check where nothing applies and stops a cooldown configured above the
runner's own directories — a parent checkout or an operator's Cargo
setup — from leaking into a run.

A security fix inside the committed window keeps its cooldown marker
end to end (transitive fixes mark only when the catalog dates the
target inside it, and a batch carries the reported marker through), so
its job alone runs resolver.incompatible-publish-age = "allow" while
the branch's other jobs stay deny. An unread committed cooldown fails
the directory's jobs, maintenance included, as its lookups already
fail; a Rust older than 1.100 still gets the floor on direct targets,
with a warning that its Cargo ignores the keys and transitive crates do
not wait.

Behaviour change: waitHours is passed to Cargo for every Rust
repository, so crates a resolve newly locks wait as long as the updates
that triggered it; security fixes are allowed through the
incompatible-publish-age check; a cooldown in a parent directory's
.cargo/config.toml no longer applies.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…til it may be locked

A catalog fetched to date a transitive advisory target no longer reaches
routine evaluation: evaluate_with returns an empty Evaluation for
lockfile-only packages, so a vulnerable transitive crate proposes exactly
its fix — no patch/minor/major rows, held-back noise or Major branch, and
a grouped branch carrying the fix contains only the fix.

transitive_fix applies the same release-age gate as the direct path: a
fix younger than security.apply's wait is reported held back with
publishedAt/eligibleAt instead of proposed for Cargo to refuse each run,
with or without a committed cooldown underneath it.

Rebuilt batch jobs take the effective wait for the update's own kind — a
batched minor waits as a minor, not the strictest wait any kind carries —
as security_wait_hours already answers for fixes.

Rebuilt batch items also inherit the reported dependency's advisory
records, not an empty slice: batch PR bodies now list the advisories a
batched fix resolves, and SecurityMergeWithoutDelivery can see a batch
that holds a fix.

An unreadable or include-bearing .cargo/config.toml in a sibling
workspace member no longer fails every member: fail-closed covers only
the configurations Cargo could read for the manifest (its directory's
ancestors, and so the workspace root's ancestors inside the repository);
readable sibling values still count toward the maximum.

Docs: a crossing --workspace job's refusal reads "did not resolve … to
requested version"; one job's wait covers everything its one resolve
newly locks; maintenance holds to the strictest active waitHours across
the repository's crates.io dependencies.
@sweepies
sweepies force-pushed the feat/cargo-cooldown-env branch from c02d1d3 to 7f15540 Compare November 13, 2026 21:57
@sweepies
sweepies merged commit e189ff1 into main Nov 13, 2026
13 checks passed
@sweepies
sweepies deleted the feat/cargo-cooldown-env branch November 13, 2026 22:24
@sweepies-ops sweepies-ops Bot mentioned this pull request Nov 13, 2026
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.

1 participant