Skip to content

Conversation

@epage
Copy link
Contributor

@epage epage commented Nov 14, 2025

What does this PR try to resolve?

Implementation for #5221, #15491

Use cases:

This seemed like the shortest path to testing the proposed pubtime
index entries (#15491) so we can unblock other work on it like #15973.
While this has some big caveats, the design is straightforward.
In contrast, #15973 has a lot more design questions (is this a
resolver-wide setting or a per-registry setting, what formats are
accepted, etc) that could slow down development and testing pubtime.

How to test and review this PR?

Unresolved questions (deferred to the tracking issues):

  • How do we compensate for the caveats, with one option being to leave
    this perma-unstable?
  • How should we deal with Summary pubtime parse errors?
  • How strict should we be on the Summary pubtime format?
  • Should we offer a convenient way of getting a compatible timestamp?

Future possibilities:

  • Ability to lock to a timestamp with cargo update updating the
    timestamp (could be useful for cargo scripts)

Implementation for rust-lang#5221

Use cases:
- Improved reproduction steps using cargo scripts without including a
  lockfile
- Debugging issues in the past
- Manual stop gap for rust-lang#15973

Unresolved questions:
- How do we compensate for the caveats, with one option being to leave
  this perma-unstable?
- How should we deal with Summary `pubtime` parse errors?
- How strict should we be on the Summary `pubtime` format?
- Should we offer a convenient way of getting a compatible timestamp?

Future possibilities:
- Ability to lock to a timestamp with `cargo update` updating the
  timestamp (could be useful for cargo scripts)

This seemed like the shortest path to testing the proposed `pubtime`
index entries so we can unblock other work on it like rust-lang#15973.
While this has some big caveats, the design is straightforward.
In contrast, rust-lang#15973 has a lot more design questions (is this a
resolver-wide setting or a per-registry setting, what formats are
accepted, etc) that could slow down development and testing `pubtime`.
@rustbot
Copy link
Collaborator

rustbot commented Nov 14, 2025

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-cli Area: Command-line interface, option parsing, etc. A-cli-help Area: built-in command-line help A-dependency-resolution Area: dependency resolution and the resolver A-documenting-cargo-itself Area: Cargo's documentation A-registries Area: registries A-testing-cargo-itself Area: cargo's tests A-workspaces Area: workspaces Command-generate-lockfile Command-package Command-update S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 14, 2025
Copy link
Contributor Author

Choose a reason for hiding this comment

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

While the long value_name makes the format very clear, the length is annoying

Comment on lines +28 to +45
fn datetime_completer(current: &std::ffi::OsStr) -> Vec<CompletionCandidate> {
let mut completions = vec![];
let Some(current) = current.to_str() else {
return completions;
};

if current.is_empty() {
// While not likely what people want, it can at least give them a starting point to edit
let timestamp = jiff::Timestamp::now();
completions.push(CompletionCandidate::new(timestamp.to_string()));
} else if let Ok(date) = current.parse::<jiff::civil::Date>() {
if let Ok(zoned) = jiff::Zoned::default().with().date(date).build() {
let timestamp = zoned.timestamp();
completions.push(CompletionCandidate::new(timestamp.to_string()));
}
}
completions
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't feel like writing my own parser for the sake of handling incomplete date, so I threw this together to at least make it easier to get the format correct so people can modify them from here.

let mut ws = args.workspace(gctx)?;
if let Some(publish_time) = publish_time {
gctx.cli_unstable()
.fail_if_stable_opt("--publish-time", 5221)?;
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to close the original issue and create a new one for tracking?
Benefit of this:

  • Cargo team has full control over the issue. Original author won't delete that accidentally.
  • Sometimes original issue has too many discussion. And we tend to use tracking issue for, well, tracking progress only.

.arg(
clap::Arg::new("publish-time")
.long("publish-time")
.value_name("yyyy-mm-ddThh:mm:ssZ")
Copy link
Member

Choose a reason for hiding this comment

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

mm is ambiguous here 😆.
(no need to change)

self.publish_time = Some(publish_time);
}

/// Sort (and filter) the given vector of summaries in-place
Copy link
Member

Choose a reason for hiding this comment

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

Probably expand this doc comment?


This is a best-effort filter on allowed packages, including:
- packages from unsupported registries are always accepted
- only the latest yank status is respected
Copy link
Member

Choose a reason for hiding this comment

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

I had a hard time understanding this. Do need a test with yanked versions?

/// incorrectly select a new package that uses a new index schema. A
/// workaround is to downgrade any packages that are incompatible with the
/// `--precise` flag of `cargo update`.
pub v: Option<u32>,
Copy link
Member

Choose a reason for hiding this comment

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

We should bump a index version, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

iiuc the index version represents incompatible versions of the schema. This change is forward and backwards compatible so it shouldn't need it bumped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need to check our schema documentation to see if we list unstable fields.

If not, I need to note somewhere that we need to update it when stabilizing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area: Command-line interface, option parsing, etc. A-cli-help Area: built-in command-line help A-dependency-resolution Area: dependency resolution and the resolver A-documenting-cargo-itself Area: Cargo's documentation A-registries Area: registries A-testing-cargo-itself Area: cargo's tests A-workspaces Area: workspaces Command-generate-lockfile Command-package Command-update S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants