Skip to content

feat: propagate sha256, md5, and size for direct URL packages#2303

Open
tarun-227 wants to merge 1 commit intoconda:mainfrom
tarun-227:feat/direct-url-package-metadata-742
Open

feat: propagate sha256, md5, and size for direct URL packages#2303
tarun-227 wants to merge 1 commit intoconda:mainfrom
tarun-227:feat/direct-url-package-metadata-742

Conversation

@tarun-227
Copy link
Copy Markdown
Contributor

Summary

  • When packages are installed from direct URLs, the ExtractResult computed during download already contains sha256, md5, and total_size, but these values were previously discarded after hash validation
  • Adds md5 and size fields to CacheMetadata with public getters (sha256(), md5(), size())
  • Captures extract result metadata via shared state in the fetch closure and propagates it to CacheMetadata
  • DirectUrlQuery now uses these computed values when building PackageRecord, instead of passing None for size
  • For local file URLs, reads size from file metadata

Motivation

Closes #742. Direct URL packages had sha256, md5, and size set to None in their PackageRecord even though the values were computed during extraction.

Test plan

  • cargo check -p rattler_cache -p rattler_repodata_gateway compiles cleanly
  • cargo fmt --check passes
  • No breaking changes — new fields are Option types and existing callers are unaffected

When a package is installed from a direct URL, the ExtractResult computed
during download already contains sha256, md5, and total_size. Previously
these values were discarded after hash validation, leaving the
PackageRecord with None for size and potentially missing hashes.

This change:
- Adds md5 and size fields to CacheMetadata with public getters
- Captures ExtractResult metadata via shared state in the fetch closure
- Uses the computed values when building PackageRecord in DirectUrlQuery
- For local file URLs, reads size from file metadata

Closes conda#742
@baszalmstra
Copy link
Copy Markdown
Collaborator

Fill in the PR template correctly. Also as a word of warning this was seems to have been completely AI generated, including the PR text which is against our AI policy.

You are on thin ice here, given your other PR basically does the same thing.

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.

Get sha256, size and md5 from direct url package.

2 participants