Skip to content

feat(file): support tbz extraction format alias#10403

Merged
jdx merged 1 commit into
jdx:mainfrom
risu729:feat/extraction-format-tbz-alias
Jun 13, 2026
Merged

feat(file): support tbz extraction format alias#10403
jdx merged 1 commit into
jdx:mainfrom
risu729:feat/extraction-format-tbz-alias

Conversation

@risu729

@risu729 risu729 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add tbz as an alias for ExtractionFormat::TarBz2
  • restore coverage for foo.tbz filename detection and from_ext("tbz")

Context

This is the first follow-up after #10275. That PR stayed as a pure rename refactor; this PR carries the separate behavior change for the tbz tar.bz2 shorthand.

Branched from latest upstream/main.

Test plan

  • mise x cargo -- cargo test file::tests::test_extraction_format_from_file_name
  • mise x cargo -- cargo fmt --all -- --check

Summary by CodeRabbit

  • New Features

    • Introduced .tbz as an additional recognized file extension for TarBz2 compressed archives, providing users with an extra shorthand option alongside the existing .tar.bz2 and .tbz2 extensions.
  • Tests

    • Expanded test coverage to validate proper recognition and handling of .tbz files.

@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: 42950ef8-4703-4a6b-b347-88eb77ba98c6

📥 Commits

Reviewing files that changed from the base of the PR and between 4085a1d and 39eb273.

📒 Files selected for processing (1)
  • src/file.rs

📝 Walkthrough

Walkthrough

This PR adds tbz as a strum serialization alias for the ExtractionFormat::TarBz2 enum variant, enabling the parser to recognize .tbz as a shorthand for tar bzip2 files. A unit test assertion validates the new alias mapping.

Changes

TarBz2 extension alias support

Layer / File(s) Summary
TarBz2 strum alias and test validation
src/file.rs
ExtractionFormat::TarBz2 gains serialize = "tbz" alias attribute alongside existing tar.bz2 and tbz2 aliases. Unit test test_extraction_format_from_file_name includes assertion that "foo.tbz" resolves to ExtractionFormat::TarBz2.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐰 A fluffy alias hops in place,
tbz joins the extraction race,
Where bz2 bundles find their home,
Through parsing paths and code we roam,
Tests confirm what users seek!

🚥 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 clearly and specifically describes the main change: adding tbz as an extraction format alias, which is directly reflected in the changeset modifications to ExtractionFormat::TarBz2.
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 adds tbz as an alias for ExtractionFormat::TarBz2 by appending a third #[strum(serialize = "tbz")] attribute to the variant, and adds corresponding test coverage.

  • The alias follows the same pattern already used for tgz (TarGz), txz (TarXz), and tzst (TarZst), so the approach is consistent with the codebase.
  • from_file_name("foo.tbz") works correctly because the .tbz extension is extracted by Path::new(...).extension() and passed to from_ext, which relies on strum::EnumString's serialize-driven parse() — now able to resolve "tbz" to TarBz2. Display output is unaffected since strum::Display uses the first serialize value ("tar.bz2").

Confidence Score: 5/5

Safe to merge — the change is a one-line additive alias with no modifications to existing behavior.

Adding a third serialize attribute to a single enum variant is purely additive. Existing "tar.bz2" and "tbz2" parsing and the display representation are untouched. The two new assertions directly cover the changed code path, and the pattern mirrors the established tgz/txz/tzst aliases.

No files require special attention.

Important Files Changed

Filename Overview
src/file.rs Adds tbz as a strum serialize alias for ExtractionFormat::TarBz2 and adds two test assertions covering both from_file_name("foo.tbz") and from_ext("tbz").

Reviews (1): Last reviewed commit: "feat(file): support tbz extraction forma..." | Re-trigger Greptile

@risu729 risu729 marked this pull request as ready for review June 13, 2026 16:09
@jdx jdx merged commit 72613ba into jdx:main Jun 13, 2026
33 checks passed
@risu729 risu729 deleted the feat/extraction-format-tbz-alias branch June 13, 2026 16:41
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