Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo-credential: change serialization of cache expiration #12622

Merged
merged 2 commits into from
Sep 5, 2023

Conversation

arlosi
Copy link
Contributor

@arlosi arlosi commented Sep 5, 2023

Serde has multiple options for serialization of enum types. The default is to use the field name in a map (for variants with data), or a string (for variants without data). This causes forward compatibility problems when switching between these two cases. To avoid this, all enums within cargo-credential used the "internally tagged" approach, but CacheControl did not.

  • Changes CacheControl to be internally tagged and flattened within CredentialResponse::Get
  • Adds forward compatibility tests to ensure adding additional fields will not break deserialization

Within a credential response, this is the change:

- "cache":{"expires":1684251794},
+ "cache":"expires", "expiration":1684251794,

Other variants, such as "cache":"session" remain the same.

How to review

This PR contains two commits, one for the breaking change for CacheControl serialization, and one non-breaking change that makes several other fields skipped if none/empty.

r? @ehuss

@rustbot rustbot added A-documenting-cargo-itself Area: Cargo's documentation A-registry-authentication Area: registry authentication and authorization (authn authz) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 5, 2023
@ehuss
Copy link
Contributor

ehuss commented Sep 5, 2023

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented Sep 5, 2023

📌 Commit e58b84d has been approved by ehuss

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 5, 2023
@bors
Copy link
Contributor

bors commented Sep 5, 2023

⌛ Testing commit e58b84d with merge 292b0a8...

@bors
Copy link
Contributor

bors commented Sep 5, 2023

☀️ Test successful - checks-actions
Approved by: ehuss
Pushing 292b0a8 to master...

1 similar comment
@bors
Copy link
Contributor

bors commented Sep 5, 2023

☀️ Test successful - checks-actions
Approved by: ehuss
Pushing 292b0a8 to master...

@bors bors merged commit 292b0a8 into rust-lang:master Sep 5, 2023
@bors
Copy link
Contributor

bors commented Sep 5, 2023

👀 Test was successful, but fast-forwarding failed: 422 Changes must be made through a pull request.

@arlosi arlosi deleted the cred-cache branch September 6, 2023 05:16
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 6, 2023
Update cargo

21 commits in 96fe1c9e1aecd8f57063e3753969bb6418fd2fd5..d14c85f4e6e7671673b1a1bc87231ff7164761e1
2023-08-29 20:10:34 +0000 to 2023-09-05 22:28:10 +0000
- fix(resolver): Make resolver behavior independent of package order (rust-lang/cargo#12602)
- cargo-credential: change serialization of cache expiration (rust-lang/cargo#12622)
- Update registry-web-api.md yank/unyank comments (rust-lang/cargo#12619)
- test: new options of debuginfo are no longer unstable (rust-lang/cargo#12618)
- use split_once for cleaner code (rust-lang/cargo#12615)
- stop using lazy_static (rust-lang/cargo#12616)
- doc: adjust all doc headings one level up (rust-lang/cargo#12595)
- chore(deps): update compatible (rust-lang/cargo#12609)
- chore(deps): update rust crate cargo_metadata to 0.17.0 (rust-lang/cargo#12610)
- Prepare for partial-version package specs (rust-lang/cargo#12591)
- refactor: Use more serde_untagged (rust-lang/cargo#12581)
- fix(cli): Help users know possible `--target` values (rust-lang/cargo#12607)
- Tab completion for --target uses rustup but fallsback to rustc (rust-lang/cargo#12606)
- Fewer temporary needless strings (rust-lang/cargo#12604)
- fix(help): Provide better commands heading for styling (rust-lang/cargo#12593)
- fix(update): Clarify meaning of --aggressive as --recursive (rust-lang/cargo#12544)
- docs(changelog): Clarify language for Cargo.lock policy (rust-lang/cargo#12601)
- fix typo: "default branch branch" -> "default branch" (rust-lang/cargo#12598)
- fix: add error for unsupported credential provider version (rust-lang/cargo#12590)
- fix(help): Explain --explain (rust-lang/cargo#12592)
- fix(help): Remove redundant information from new/init (rust-lang/cargo#12594)

r? ghost
bors added a commit that referenced this pull request Sep 7, 2023
Bump cargo-credential-1password to v0.4.0

`cargo-credential` updated to version `0.4.0` in #12622. This updates `cargo-credential-1password` to `0.4.0` as well so it can be published to crates.io.
@ehuss ehuss added this to the 1.74.0 milestone Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation A-registry-authentication Area: registry authentication and authorization (authn authz) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants