Skip to content

✅ Add regression guard tests for bsdtar update @ and create -C-only#2923

Merged
ChanTsune merged 1 commit into
mainfrom
tests/bsdtar-regression-guards
Apr 4, 2026
Merged

✅ Add regression guard tests for bsdtar update @ and create -C-only#2923
ChanTsune merged 1 commit into
mainfrom
tests/bsdtar-regression-guards

Conversation

@ChanTsune
Copy link
Copy Markdown
Owner

@ChanTsune ChanTsune commented Apr 4, 2026

  • archive_inclusion: verify update mode treats @-prefixed operands as filesystem paths (not archive inclusion)
  • missing_file: verify create mode rejects -C without real input files

Summary by CodeRabbit

  • Tests
    • Added a test verifying that filenames beginning with "@" are treated as literal filesystem paths during archive update operations (not interpreted as inclusion syntax).
    • Added a test ensuring archive creation fails when only directory-change arguments are provided with no actual file inputs, preventing accidental empty archives.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f9c9f21c-4a28-4eee-a796-30a76bcff05a

📥 Commits

Reviewing files that changed from the base of the PR and between da46bf4 and b158315.

📒 Files selected for processing (2)
  • cli/tests/cli/stdio/archive_inclusion.rs
  • cli/tests/cli/stdio/missing_file.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • cli/tests/cli/stdio/missing_file.rs
  • cli/tests/cli/stdio/archive_inclusion.rs

📝 Walkthrough

Walkthrough

Adds two CLI integration tests: one ensures an @-prefixed filename is treated as a filesystem path during compat/bsdtar update, and the other ensures create mode errors when only -C directory changes are provided with no file operands.

Changes

Cohort / File(s) Summary
Archive Inclusion Test
cli/tests/cli/stdio/archive_inclusion.rs
Adds stdio_update_treats_at_prefix_as_filesystem_path integration test that creates an archive with original.txt, adds a filesystem file named @data.txt, runs pna in compat/bsdtar update mode (-uf with -C), and asserts the archive contains original.txt and @data.txt (not canary.txt) with exactly two entries.
Missing File Test
cli/tests/cli/stdio/missing_file.rs
Adds imports (std::fs, std::path::PathBuf) and stdio_create_with_only_directory_changes_fails test that creates a base directory and asserts pna compat bsdtar --unstable -cf <base>/out.pna -C <base> fails when no file operands are supplied.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

cli

Poem

🐰 Hopping through the test-bed bright,
I tuck an @ into plain sight,
Directories alone must fail—oh dear—
Archives keep only files held near,
A tiny hop, a passing cheer 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 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 addition of two regression guard tests for bsdtar update @ and create -C-only functionality, directly aligning with the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tests/bsdtar-regression-guards

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces two new integration tests for the bsdtar compatibility layer. The first test ensures that files with a leading '@' symbol are treated as literal filesystem paths rather than archive inclusion markers during update operations. The second test verifies that the command correctly fails when directory change flags are provided without any actual file operands. Feedback was provided to improve the test assertions by checking the list of archive entries directly instead of using a HashSet, which prevents the accidental masking of duplicate entries.

Comment thread cli/tests/cli/stdio/archive_inclusion.rs
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cli/tests/cli/stdio/archive_inclusion.rs`:
- Around line 765-775: The test currently converts
get_archive_entry_names(&archive_path) into a HashSet (entry_names) which hides
duplicate entries and can make the "exactly 2 entries" check pass wrongly;
change the test to use the Vec returned by get_archive_entry_names directly (or
assert both Vec.len() == 2 and that
Vec.into_iter().collect::<HashSet<_>>().len() == 2) so duplicates are
detected—locate the usage of get_archive_entry_names, the entry_names binding,
and the three assertions (contains "original.txt", contains "@data.txt", and the
len check) and update them to assert cardinality against the Vec rather than the
HashSet (or add the extra dedupe-vs-raw length comparison) to prevent
regressions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 24423b4a-bdeb-40eb-8aee-c520941ec4d4

📥 Commits

Reviewing files that changed from the base of the PR and between afe8606 and da46bf4.

📒 Files selected for processing (2)
  • cli/tests/cli/stdio/archive_inclusion.rs
  • cli/tests/cli/stdio/missing_file.rs

Comment thread cli/tests/cli/stdio/archive_inclusion.rs
- archive_inclusion: verify update mode treats @-prefixed operands as
  filesystem paths (not archive inclusion)
- missing_file: verify create mode rejects -C without real input files

Both tests pass on main, proving these are pre-existing correct behaviors.
They guard against regressions when the -C pipeline is changed.
@ChanTsune ChanTsune force-pushed the tests/bsdtar-regression-guards branch from da46bf4 to b158315 Compare April 4, 2026 07:13
@github-actions github-actions Bot added the cli This issue is about cli application label Apr 4, 2026
@ChanTsune ChanTsune merged commit 08afabc into main Apr 4, 2026
103 checks passed
@ChanTsune ChanTsune deleted the tests/bsdtar-regression-guards branch April 4, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli This issue is about cli application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant