Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class support for v2 conda packages (.conda) by treating them as an outer ZIP that contains pkg-*.tar.zst and info-*.tar.zst, and exposing a merged “tar-like” view via the existing tarReader APIs.
Changes:
- Add a new
.condareader that opens relevant.tar.zstmembers and merges their tar entries into a single browse/extract view. - Register
.condain format detection/opening paths and document support in the README. - Add unit tests covering listing/extracting, hashing the outer archive, and decompression-limit behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents .conda as a supported archive type and describes how it’s presented. |
| conda.go | Implements the .conda reader and member parsing/merging logic. |
| conda_test.go | Adds tests for .conda open/list/extract/hash and size-limit behavior. |
| archives.go | Registers the new conda format in detection and dispatch. |
| archives_test.go | Extends TestDetectFormat to include .conda. |
Suppressed comments (2)
conda.go:51
if files == niltreats an archive with matching members but zero tar entries as if the members were missing, and produces a misleading error. Track whether any pkg-/info- .tar.zst members were found instead of relying on whether any entries were appended.
if files == nil {
return nil, fmt.Errorf("no pkg-*.tar.zst or info-*.tar.zst member in conda package")
}
conda.go:57
- The merged view can contain duplicate paths (e.g., both tarballs containing the same directory entry).
indexkeeps only the first occurrence for Extract, butList/ListDirwill still surface duplicates fromfiles, which is inconsistent for callers. Consider de-duplicatingfilesby path while buildingindex.
index := make(map[string]int, len(files))
for i, f := range files {
if _, seen := index[f.info.Path]; !seen {
index[f.info.Path] = i
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
andrew
force-pushed
the
conda
branch
2 times, most recently
from
August 16, 2026 21:46
642a1d3 to
0588435
Compare
The v2 conda format is an uncompressed zip containing metadata.json, pkg-<name>.tar.zst and info-<name>.tar.zst. Both inner tarballs already store their entries with the paths that appear in the equivalent v1 .tar.bz2 package (info/ is a prefix inside the tar), so the reader opens each .tar.zst member through openTar and concatenates the entries into a single tar view. Hash covers the outer .conda bytes, matching what anaconda.org publishes in repodata.json. Decompressed size is capped cumulatively across all members so a zip with many pkg-*/info-* entries cannot exceed maxDecompressedSize by staying under it per member. Closes #24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #31.
The v2 conda format is an uncompressed zip containing
metadata.json,pkg-<name>.tar.zstandinfo-<name>.tar.zst. Both inner tarballs already store their entries with the paths that appear in the equivalent v1.tar.bz2package (info/is a prefix inside the tar, not something to add), soopenCondaopens each.tar.zstmember throughopenTarand concatenates the entries into a single tar view.Hashcovers the outer.condabytes, matching what anaconda.org publishes inrepodata.json.Decompressed size is capped cumulatively across all members so a zip with many
pkg-*/info-*entries cannot exceedmaxDecompressedSizeby staying under it per member.Verified against
six-1.17.0-pyhd8ed1ab_0.condafrom conda-forge: 25 merged entries,info/index.jsonextracts, andHash("sha256")returns41db0180…matching the repodata digest.Closes #24