Skip to content

feat(library): add bulk rename tool and e2e coverage#124

Merged
neonsolstice merged 4 commits into
bookorbit:mainfrom
chrismansell26:BO-121-bulk-rename-books
May 28, 2026
Merged

feat(library): add bulk rename tool and e2e coverage#124
neonsolstice merged 4 commits into
bookorbit:mainfrom
chrismansell26:BO-121-bulk-rename-books

Conversation

@chrismansell26

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds a full bulk file rename workflow for libraries that have file rename enabled, including preview, execution, status tracking, and coverage tests.

This PR includes:

  • New backend bulk-rename service and repository to compute rename previews and execute renames across a library.
  • New library endpoints for bulk rename:
    • GET /api/v1/libraries/:id/bulk-rename/preview
    • GET /api/v1/libraries/:id/bulk-rename/status
    • POST /api/v1/libraries/:id/bulk-rename/execute (SSE progress stream)
  • New client Tools experience for Bulk Rename (library selection, preview table/cards, status filters, pagination, execution/cancel flow).
  • Shared types and enums updates for bulk rename preview/progress payloads, notifications, and audit actions.
  • New tests:
    • Server unit tests for bulk rename and rename utils behavior
    • End-to-end suite for bulk rename permutations and edge cases
    • Client unit tests for the new bulk rename composable and components
  • Small compatibility fix in the UI code path (replaceAll replaced with regex-based replace).

Closes #121

How did you test this?

  • git push -u origin BO-121-bulk-rename-books
    • Triggered pre-push pnpm run verify:fast
    • Result: passed (lint:check + typecheck)
  • pnpm --filter server test -- src/modules/library/bulk-rename.service.test.ts src/modules/file-write/file-rename.service.test.ts
    • In this environment, Vitest resolved to the full server suite.
    • Result: 458 passed test files, 5428 passed tests.
  • pnpm --filter client test:unit --run src/features/tools/composables/__tests__/useBulkRename.spec.ts src/features/tools/bulk-rename/components/__tests__/BulkRenameConfirmDialog.spec.ts src/features/tools/bulk-rename/components/__tests__/BulkRenameStatusBadge.spec.ts
    • Result: 3 passed test files, 35 passed tests.

Anything non-obvious in the diff?

  • Bulk rename preview is cached per library for 60 seconds and invalidated before execution.
  • Collision detection handles both:
    • Multiple books resolving to the same generated path, and
    • Generated paths already owned by a different book in storage metadata.
  • Only one bulk rename run can execute per library at a time (runningLibraries guard).
  • For watched libraries, the file watcher is stopped before execution and restarted after completion/failure to avoid event races.
  • Execution progress is streamed via SSE; cancellation is handled on client abort/disconnect.

Checklist

  • I've read through my own diff
  • This PR was discussed in an issue and has maintainer approval (for new features)
  • Lint and tests pass locally
  • No unintended files included (build artifacts, .env, personal configs)

Provides a way to rename all books in a library according to the user's
configured file naming template without requiring manual metadata edits.
Includes a streaming endpoint to report progress back to the frontend.

Closes bookorbit#121
Introduce a comprehensive E2E test suite for the bulk rename functionality to verify behavior across different library modes (book per file, book per folder) and handle edge cases like naming collisions or special characters.

Additionally fix a TypeScript compilation error in BulkRenameView.vue by replacing `replaceAll` with a regex-based `replace` for broader target compatibility.
@github-actions github-actions Bot added ci Changes to CI/CD workflows, automation, or developer tooling. server Changes affecting server-side code, APIs, or backend behavior. client Changes affecting the client application or frontend behavior. packages labels May 28, 2026
@neonsolstice
neonsolstice merged commit acc8a19 into bookorbit:main May 28, 2026
21 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.7.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions Bot added the released Issue or PR is included in a released version. label May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Changes to CI/CD workflows, automation, or developer tooling. client Changes affecting the client application or frontend behavior. packages released Issue or PR is included in a released version. server Changes affecting server-side code, APIs, or backend behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Bulk Rename Books after settings change

2 participants