Thanks to visit codestin.com
Credit goes to github.com

Skip to content

refactor(aqua): stop canonicalizing archive format aliases#10404

Merged
jdx merged 1 commit into
jdx:mainfrom
risu729:refactor/aqua-format-aliases
Jun 13, 2026
Merged

refactor(aqua): stop canonicalizing archive format aliases#10404
jdx merged 1 commit into
jdx:mainfrom
risu729:refactor/aqua-format-aliases

Conversation

@risu729

@risu729 risu729 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • preserve literal aqua archive format aliases such as tgz, txz, tbz, and tbz2
  • stop canonicalizing detected aliases to tar.* strings inside aqua-registry
  • add focused tests for detected and explicit alias formats

Context

This is PR 3 from the aqua extraction cleanup plan. ExtractionFormat::from_ext already understands the supported aliases at extraction time, so aqua-registry does not need to rewrite aqua's literal format strings before returning them.

PR #10104 is stacked on this branch locally. Target branch remains main.

Tests

  • cargo fmt --check
  • mise x cargo -- cargo test -p aqua-registry test_format_detects_literal_aqua_aliases
  • mise x cargo -- cargo test -p aqua-registry test_format_preserves_explicit_aqua_aliases

Summary by CodeRabbit

  • Bug Fixes

    • Archive format aliases (tgz, txz, tbz, tbz2) are now preserved as configured instead of being normalized to canonical formats.
  • Tests

    • Added tests to verify archive format alias handling for both detected and explicitly configured formats.

@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: ffb05cb6-98c6-43d0-8249-599ff60e7f4e

📥 Commits

Reviewing files that changed from the base of the PR and between 72613ba and f320ca3.

📒 Files selected for processing (1)
  • crates/aqua-registry/src/types.rs

📝 Walkthrough

Walkthrough

AquaPackage::detect_format and AquaPackage::format methods now preserve archive format aliases (tgz, txz, tbz, tbz2) as-is instead of normalizing them to canonical tar.* forms. Unit tests verify that both detected filenames and explicitly configured format values preserve their original aliases.

Changes

Archive format alias preservation

Layer / File(s) Summary
Format detection and preservation
crates/aqua-registry/src/types.rs
detect_format returns detected archive suffix aliases directly without rewriting to tar.* canonical forms. AquaPackage::format method preserves explicitly configured format aliases instead of normalizing them. Tests verify that both literal template-detected aliases and explicit format aliases are preserved through the detection and property accessor paths.

Possibly related PRs

  • jdx/mise#10403: Adjusts filename/template "tbz" (and related shorthand) handling for format detection by changing how aliases are parsed/returned rather than normalized to canonical tar.* forms.
  • jdx/mise#10167: Modifies crates/aqua-registry/src/types.rs within AquaPackage's format/extension handling around detected formats and appending behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through tar and tgz,
"No more translations!" they loudly say,
Aliases now stay as they be,
No normalization gets in the way,
Aqua formats hop, preserved and free! 🐰📦

🚥 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 accurately summarizes the main change: stopping canonicalization of archive format aliases in the aqua registry, which is the core refactoring objective.
Docstring Coverage ✅ Passed Docstring coverage is 100.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 removes the redundant alias-to-canonical rewriting (tgztar.gz, txztar.xz, tbz/tbz2tar.bz2) from two sites in crates/aqua-registry/src/types.rs. The transformation is unnecessary because ExtractionFormat::from_ext in src/file.rs already recognises these aliases through strum serialize attributes and maps them to the correct enum variants at extraction time.

  • detect_format: the five-arm match is replaced with a direct return format, letting the caller's ExtractionFormat::from_ext handle alias resolution.
  • format(): the explicit-format match block is replaced with &self.format, preserving the aqua-registry literal string all the way to effective_extraction_format, which correctly calls from_ext.
  • Two new unit tests (test_format_detects_literal_aqua_aliases, test_format_preserves_explicit_aqua_aliases) document and lock in the expected pass-through behaviour.

Confidence Score: 5/5

Safe to merge — the deleted code was purely redundant; ExtractionFormat::from_ext handles the aliases identically downstream.

The deleted match arms and their replacements are functionally equivalent end-to-end. The strum serialize attributes on ExtractionFormat (tgz → TarGz, txz → TarXz, tbz/tbz2 → TarBz2) were already the canonical mapping path used by every other caller of from_ext, so removing the pre-normalization in types.rs changes nothing observable. The two new tests directly verify both the detected and explicit-format paths.

No files require special attention.

Important Files Changed

Filename Overview
crates/aqua-registry/src/types.rs Removes redundant alias-to-canonical rewriting in both detect_format and format(); adds two focused regression tests for the preserved alias strings. The invariant holds: ExtractionFormat::from_ext already recognises tgz/txz/tbz/tbz2 via strum serialize attributes.

Reviews (1): Last reviewed commit: "refactor(aqua): stop canonicalizing arch..." | Re-trigger Greptile

@risu729 risu729 marked this pull request as ready for review June 13, 2026 17:09
@jdx jdx merged commit 66bbdd8 into jdx:main Jun 13, 2026
33 checks passed
@risu729 risu729 deleted the refactor/aqua-format-aliases branch June 13, 2026 17:34
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