Skip to content

refactor: cleanup pass — bug fixes, deduplication, dead code removal#10

Merged
JBolanle merged 10 commits into
mainfrom
worktree-refactor-cleanup
May 8, 2026
Merged

refactor: cleanup pass — bug fixes, deduplication, dead code removal#10
JBolanle merged 10 commits into
mainfrom
worktree-refactor-cleanup

Conversation

@JBolanle
Copy link
Copy Markdown
Owner

@JBolanle JBolanle commented May 8, 2026

Summary

  • Bug fix: rename failure in compress_files no longer aborts the entire job batch — it now emits an error event and continues to the next file, matching the existing GS error path
  • Bug fix / consolidation: two independent byte-formatters (formatSize in DetailPanel, formatSavedBytes in notification.ts) merged into a single formatBytes export, eliminating silent divergence risk
  • Dead code: removed check_path_writable_cmd Tauri command (registered but never called from the frontend)
  • Deduplication: extracted revealInFinder, basename, checkAndShowUpdateToast, and strip_v helpers to eliminate copy-pasted logic across components and Rust modules
  • Test coverage: added menu_ids_sync_with_build_menu test to catch future divergence between the MENU_IDS constant and build_menu's map inserts; added missing check-for-update assertion to existing menu test

Test Plan

  • npm test — 88 tests pass
  • cargo test (from src-tauri/) — 39 tests pass
  • Queue multiple files and verify compression completes even if one file's output path is on a read-only filesystem (rename failure no longer kills the batch)

🤖 Generated with Claude Code

JBolanle added 10 commits May 8, 2026 11:20
Replace the `?` operator on fs::rename with a match that:
- Emits an error event with the failure reason
- Removes the temporary file to avoid orphans
- Continues to the next job instead of aborting the batch

This matches the existing GS failure pattern and ensures that
a single file's rename failure doesn't abort all remaining jobs.
- Rename formatSavedBytes → formatBytes in notification.ts
- Update buildNotificationBody to call formatBytes
- Delete formatSize function from DetailPanel.svelte
- Import formatBytes from notification.ts in DetailPanel.svelte
- Replace all 3 formatSize call sites with formatBytes
- Update tests to use formatBytes instead of formatSavedBytes

Uses the Math.round version from notification.ts (more idiomatic
than .toFixed(0)) as the canonical implementation.
The #[tauri::command] wrapper function check_path_writable_cmd was never
called from any frontend TypeScript/Svelte code. Remove the wrapper and its
entry in generate_handler! while keeping the underlying pub fn check_path_writable
which is used by unit tests.

Tests: all 38 tests pass
@JBolanle JBolanle merged commit 0a42323 into main May 8, 2026
6 checks passed
@JBolanle JBolanle deleted the worktree-refactor-cleanup branch May 8, 2026 20:10
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