Skip to content

fix(aqua): reject unsupported package formats#10409

Merged
jdx merged 1 commit into
jdx:mainfrom
risu729:fix/aqua-unsupported-formats
Jun 13, 2026
Merged

fix(aqua): reject unsupported package formats#10409
jdx merged 1 commit into
jdx:mainfrom
risu729:fix/aqua-unsupported-formats

Conversation

@risu729

@risu729 risu729 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add explicit ExtractionFormat variants for aqua-known unsupported formats such as tar.br, br, tar.lz4, lz4, tar.sz, sz, and rar
  • make those formats parse as non-Raw, then fail with clear unsupported-format errors during extraction/decompression
  • preserve unknown aqua format rejection and the existing GithubArchive omitted-format fallback to TarGz

Tests

  • cargo fmt
  • cargo test unsupported_extraction
  • cargo test effective_extraction_format
  • cargo test github_archive_omitted_format_defaults_to_targz && cargo test test_extraction_format_from_file_name
  • cargo check

Summary by CodeRabbit

  • New Features

    • Added recognition for additional archive and compression formats including tar+brotli, tar+lz4, tar+sz, standalone brotli/lz4/sz, and RAR files.
  • Tests

    • Expanded test coverage for archive format detection and extraction behavior validation.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ffb2d8aa-f64f-4897-b827-6996bba9d83a

📥 Commits

Reviewing files that changed from the base of the PR and between 651130c and 58c793d.

📒 Files selected for processing (2)
  • src/backend/aqua.rs
  • src/file.rs

📝 Walkthrough

Walkthrough

This PR expands archive format support by adding seven new ExtractionFormat variants (TarBr, Br, TarLz4, Lz4, TarSz, Sz, Rar) and updating extraction, decompression, and inspection logic to handle them. Classification helpers are extended, unsupported formats are rejected with clear error messages, and comprehensive tests validate new format mappings and aqua backend integration.

Changes

Archive Format Support Expansion

Layer / File(s) Summary
Format variants and classification helpers
src/file.rs
ExtractionFormat enum now includes tar-based (TarBr, TarLz4, TarSz), single-file compressed (Br, Lz4, Sz), and Rar variants. Classification methods is_archive(), is_tar_archive(), is_compressed_file(), and extension() are updated to recognize and categorize all new types.
Decompression and archive extraction logic
src/file.rs
decompress_file explicitly rejects Br/Lz4/Sz. extract_archive routes tar variants (TarBr, TarLz4, TarSz) into tar extraction but rejects single-file compressed and Rar formats. open_tar fails with "format not supported" for new tar variants and treats single-file compressed/Rar as non-tar formats.
Archive content inspection
src/file.rs
archive_content_files includes new tar variants in the tar-handling branch while explicitly rejecting single-file compressed formats and Rar with clear unsupported-format errors.
ExtractionFormat test coverage
src/file.rs
Tests verify new extension mappings (tar.br, br, tar.lz4, lz4, tar.sz, sz, rar), correct classification by is_archive() and is_compressed_file(), and descriptive error messages when extracting/decompressing unsupported formats.
Aqua backend format integration tests
src/backend/aqua.rs
Tests validate AquaBackend::effective_extraction_format with legacy format aliases, unknown format error handling, and GithubArchive empty-format defaulting to TarGz.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • jdx/mise#10404: Preserves literal aqua archive aliases that the aqua backend tests now validate through effective_extraction_format.
  • jdx/mise#10275: Introduces the TarFormatExtractionFormat rename and aqua migration to use effective_extraction_format with the same extraction-format API this PR extends.

Poem

🐰 Seven formats hop into view,
Tar-brotli, lz4, sz too!
With rar and tests all neat,
Compression becomes complete. ✨
Aqua's extraction flows so true!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: adding explicit rejection of unsupported aqua package formats (tar.br, br, tar.lz4, lz4, tar.sz, sz, rar) rather than treating them as unknown.
Docstring Coverage ✅ Passed Docstring coverage is 90.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR improves error reporting for aqua packages that use compression formats mise cannot handle (Brotli, LZ4, Snappy, and RAR) by adding explicit ExtractionFormat variants for each, so these formats are recognized at parse time and produce format-specific errors at extraction rather than being silently collapsed into Raw or rejected with a generic "unsupported aqua package format" message.

  • Adds TarBr, Br, TarLz4, Lz4, TarSz, Sz, and Rar variants to ExtractionFormat with correct strum serialize aliases; updates every match arm in extract_archive, open_tar, decompress_file, archive_content_files, and the predicate methods (is_archive, is_tar_archive, is_compressed_file, extension).
  • Adjusts effective_extraction_format in the aqua backend so these formats now pass through as their typed variants instead of bailing immediately; the GithubArchive empty-format fallback to TarGz and the unknown-format rejection are both preserved unchanged.
  • Covers all new paths with unit tests: format classification, clear error message assertions, and the GithubArchive default behaviour.

Confidence Score: 5/5

Safe to merge — the change is narrowly scoped to format recognition and error reporting, with no change to any working extraction path.

Every new format variant is exhaustively handled in all match arms across both files, the classification predicates are internally consistent, and no partial side effects occur before unsupported-format errors fire.

No files require special attention.

Important Files Changed

Filename Overview
src/file.rs Adds TarBr, Br, TarLz4, Lz4, TarSz, Sz, and Rar ExtractionFormat variants; wires them into every match/arm in extract_archive, open_tar, decompress_file, archive_content_files, is_archive, is_tar_archive, is_compressed_file, and extension(); all new arms produce clear "X format not supported" errors
src/backend/aqua.rs effective_extraction_format now returns the specific unsupported-format variant (TarBr, Rar, etc.) instead of bailing at parse time; GithubArchive empty-format fallback and truly-unknown format rejection are preserved; three new focused unit tests added

Reviews (1): Last reviewed commit: "fix(aqua): reject unsupported package fo..." | Re-trigger Greptile

@risu729 risu729 marked this pull request as ready for review June 13, 2026 20:34
@jdx jdx merged commit 956765a into jdx:main Jun 13, 2026
33 checks passed
@risu729 risu729 deleted the fix/aqua-unsupported-formats branch June 13, 2026 20:58
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.

2 participants