Skip to content

fix: apply CodeRabbit findings from PS1 script review#4

Merged
almost486 merged 1 commit into
mainfrom
fix/ps1-coderabbit-findings
May 25, 2026
Merged

fix: apply CodeRabbit findings from PS1 script review#4
almost486 merged 1 commit into
mainfrom
fix/ps1-coderabbit-findings

Conversation

@almost486
Copy link
Copy Markdown
Owner

@almost486 almost486 commented May 25, 2026

Summary

  • Fix -WhatIf crash (critical/major): both scripts called Get-Item $DestinationDir to resolve the drive for free-space checks — throws if destination doesn't exist yet (e.g. on a dry run). Replaced with Split-Path -Qualifier + Get-PSDrive — no filesystem access needed.
  • Fix parallel manifest CompletedAt (minor): parallel path wrote CompletedAt=''; serial path wrote a real timestamp. Both now use Get-Date -Format 'yyyy-MM-ddTHH:mm:ssK'.
  • Fix regex anchoring in Get-FolderNameDefaults (minor): (NC), (W_S|W|L|M|A), (EA), (v…) lacked $ anchors — mid-title tags (e.g. Star Wars (W)) could be silently stripped. Added $ to all four match/replace patterns.

Test plan

  • Compress-ForGameVault.ps1 -WhatIf before GameVault-Ready\ exists — no throw
  • Prepare-GamesForGameVault.ps1 -WhatIf same — no throw
  • Parallel run: verify manifest.csv has populated CompletedAt timestamps
  • Folder Star Wars (W) (2023) parses title as Star Wars, not Star Wars

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Resolved missing timestamps in compression operation records that were previously left blank
    • Enhanced destination path handling to support relative and non-fully-rooted directory specifications
    • Improved parsing and removal of game folder naming convention suffix tags
    • Refined free-space calculation for destination drive selection to ensure accurate capacity checks

Review Change Stack

- Fix -WhatIf crash: derive drive via Split-Path/Get-PSDrive instead of
  Get-Item on a not-yet-existing destination dir (both scripts)
- Fix parallel manifest: populate CompletedAt timestamp instead of empty
  string so parallel and serial paths produce consistent CSV rows
- Fix regex anchoring in Get-FolderNameDefaults: add $ to NC/Type/EA/
  version tag patterns so mid-title parentheticals are not stripped

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@almost486 almost486 merged commit 177fafd into main May 25, 2026
2 checks passed
@almost486 almost486 deleted the fix/ps1-coderabbit-findings branch May 25, 2026 20:30
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f61dd827-92fd-4923-8254-154861b1e4f3

📥 Commits

Reviewing files that changed from the base of the PR and between be21ff9 and 2a37064.

📒 Files selected for processing (2)
  • Compress-ForGameVault.ps1
  • Prepare-GamesForGameVault.ps1

Walkthrough

Two PowerShell scripts improve handling of destination paths and data output: both compute a resolved destRoot path before deriving the destination drive, the compression script now records completion timestamps for successful archives, and the preparation script uses anchored regex patterns for parsing folder name suffix tags.

Changes

Path Resolution and Data Integrity

Layer / File(s) Summary
Destination drive resolution via computed root path
Compress-ForGameVault.ps1, Prepare-GamesForGameVault.ps1
Both scripts now compute destRoot from DestinationDir (handling rooted vs. relative paths) and derive destDrive from that root path instead of using Get-Item $DestinationDir directly, improving support for non-rooted destination directories.
Manifest data population and folder tag parsing
Compress-ForGameVault.ps1, Prepare-GamesForGameVault.ps1
Compression script populates CompletedAt with an ISO-formatted timestamp for OK archive results; preparation script updates suffix tag parsing to use end-anchored regex patterns for (NC), game-type, (EA), and version tags, ensuring only terminal tags are removed from folder names.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ps1-coderabbit-findings

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

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.

1 participant