Skip to content

Deserialize cache keys and Git patterns directly - #2888

Closed
ww-oai wants to merge 2 commits into
mainfrom
codex/size-cache-key
Closed

ww-oai wants to merge 2 commits into
mainfrom
codex/size-cache-key

Conversation

@ww-oai

@ww-oai ww-oai commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Dispatch cache keys by string or table key and Git patterns by boolean, table, or sequence, avoiding untagged-enum buffering and retries. Keep strict rejection of unknown or extra fields, sequence length checks, the existing generic diagnostics, and the same JSON schema.

A focused release executable containing the actual decoder definitions shrank from 521,576 to 516,064 bytes: 5,512 bytes. For 1,200 parses of 42 mixed cache keys, median time fell from 34.15 ms to 17.90 ms across 20 measured alternating pairs. String-only and Git-table cases were also faster. These are focused probe results, not a measured full-uv reduction.

Test Plan

  • Rustfmt and cargo clippy --locked --offline -p uv-cache-info --all-targets --all-features -- -D warnings.
  • cargo test --locked --offline -p uv-cache-info --lib --all-features (10 passed).
  • Compatibility snapshots cover all documented forms, sequence-form Git settings, extra fields, invalid nested values, and unknown Git fields.
  • Compared 21 accepted/rejected fixtures between the release probes, including empty, partial, complete, overlong, and invalid Git sequences.
  • cargo --locked dev generate-json-schema --mode check: uv.schema.json is unchanged.

The probes use Rust 1.99.0, opt-level 3, one codegen unit, fat LTO, panic=abort, and stripped symbols on Linux x86_64. Full-uv and production PGO size measurements remain outstanding.

@ww-oai
ww-oai deployed to automations October 19, 2026 14:41 — with GitHub Actions Active
@astral-automations-bot astral-automations-bot Bot added internal A refactor or improvement that is not user-facing performance labels Oct 19, 2026
@ww-oai
ww-oai deployed to automations October 19, 2026 14:46 — with GitHub Actions Active
Comment on lines +469 to +470
deserializer
.deserialize_any(GitPatternVisitor)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[P2] Preserve sequence-form Git patterns during direct dispatch

The former untagged Set(GitSet) decoder accepts cache-keys = [{ git = [true, false] }] through Serde’s sequence representation of structs; shipped uv 0.13.1 also accepts this input. Although undocumented, this form now fails because the visitor has no visit_seq. For a local dependency, CacheInfo::from_directory silently replaces failed configuration with default keys, so subsequent Git-only changes stop invalidating cached wheels. Add visit_seq forwarding to GitSet::deserialize through SeqAccessDeserializer, with a focused compatibility snapshot, to keep this optimization behavior-preserving.

@ww-oai
ww-oai deployed to automations October 19, 2026 15:01 — with GitHub Actions Active
@woodruffw
woodruffw marked this pull request as ready for review October 19, 2026 21:44
@astral-automations-bot

Copy link
Copy Markdown

Promoted to #22749.

This branch was successfully deployed

1 active deployment
automations — cddfdd9a Deployed Oct 19, 2026 by ww-oai via review-code-quality / code quality review #11065
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal A refactor or improvement that is not user-facing performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant