Skip to content

Fix literal backup filename variant grouping#87

Closed
Dj-Shortcut wants to merge 1 commit intoAlanRockefeller:mainfrom
Dj-Shortcut:codex/fix-backup-filename-variant-grouping
Closed

Fix literal backup filename variant grouping#87
Dj-Shortcut wants to merge 1 commit intoAlanRockefeller:mainfrom
Dj-Shortcut:codex/fix-backup-filename-variant-grouping

Conversation

@Dj-Shortcut
Copy link
Copy Markdown

@Dj-Shortcut Dj-Shortcut commented Apr 28, 2026

Fixes an edge case where a file literally named backup.jpg was parsed as a backup variant with an empty group key. Adds a regression test and keeps existing img-backup.jpg behavior intact.

Tested:

  • python -m pytest faststack/tests/test_variants_logic.py -q

Summary by CodeRabbit

  • Bug Fixes

    • Tightened backup file suffix detection patterns to improve accuracy in identifying and correctly mapping variant files within the system, preventing false positives with backup-related filenames.
  • Tests

    • Added test coverage for edge case scenarios involving backup-related filenames to ensure correct variant group mapping and proper handling of backup file paths.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2d1e2a4f-daa9-46f6-8671-79cd04e9e24e

📥 Commits

Reviewing files that changed from the base of the PR and between aa63f27 and 7ed97a8.

📒 Files selected for processing (2)
  • faststack/io/variants.py
  • faststack/tests/test_variants_logic.py

Walkthrough

The backup suffix detection regex pattern _BACKUP_TRAILING_RE was refined to match only file stems ending with -backup or -backupN (where N represents optional digits), narrowing its scope from previous logic. A unit test was added to verify the edge case where a filename is exactly backup.jpg.

Changes

Cohort / File(s) Summary
Backup Regex Pattern Tightening
faststack/io/variants.py
Modified _BACKUP_TRAILING_RE to restrict matches to stems with trailing -backup or -backupN suffix only, eliminating broader match locations from the previous pattern.
Edge Case Test Coverage
faststack/tests/test_variants_logic.py
Added test for the backup.jpg filename edge case, verifying it maps to the "backup" group with correct main_path and empty backup_paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 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 'Fix literal backup filename variant grouping' clearly summarizes the main change: fixing an edge case where files literally named 'backup.jpg' were incorrectly parsed as backup variants with empty group keys.
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.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@AlanRockefeller
Copy link
Copy Markdown
Owner

Suggestions for this pull request merged into #91

Thanks for your help!

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