Skip to content

Conversation

@overtrue
Copy link
Collaborator

@overtrue overtrue commented Nov 29, 2025

Summary

This PR consolidates the separate upload and delete task management systems into a unified architecture, significantly reducing code duplication (~1000 lines removed) while improving maintainability and code reusability.

Related to rustfs/rustfs#938

Changes

Core Refactoring

  • Unified Task Manager: Created a generic TaskManager class (lib/task-manager.ts) that handles both upload and delete operations with a shared queue and concurrency control
  • Task Helpers: Refactored task creation logic into helper functions:
    • lib/upload-task.ts - Upload task helpers
    • lib/delete-task.ts - Delete task helpers
  • Unified Store: Created store/tasks.ts with useTaskManagerStore that manages all tasks (upload and delete) in a single store

Component Consolidation

  • Unified UI Components: Created shared task UI components under components/object/task/:
    • stats.vue - Task statistics and status display
    • panel.vue - Task management panel with tabs
    • list.vue - Task list component
    • item.vue - Individual task item component
  • Removed Duplicate Components: Deleted separate upload/delete specific components

Store Cleanup

  • Removed Unused Compatibility Stores: Deleted store/upload-tasks.ts and store/delete-tasks.ts as they were not being used anywhere in the codebase
  • All code now directly uses the unified useTaskManagerStore

Bug Fixes

  • Removed unused processing-status prop from object-task-stats component usage

Benefits

  1. Reduced Code Duplication: Eliminated ~1000 lines of duplicate code
  2. Improved Maintainability: Single source of truth for task management logic
  3. Better Code Reusability: Shared components and utilities for all task types
  4. Unified Concurrency Control: Shared queue ensures fair resource allocation between upload and delete operations
  5. Easier to Extend: Adding new task types in the future will be simpler

Technical Details

The new architecture follows a plugin-based pattern where TaskManager accepts task handlers for different task types. Each task type has its own lifecycle and handler implementation, while tasks share a common interface (ManagedTask) but can have type-specific properties.

Testing

  • All existing functionality preserved
  • Upload tasks work correctly
  • Delete tasks work correctly
  • Task status updates correctly
  • Task cancellation works
  • Task retry logic works

Files Changed

  • Deleted: 11 files (old task managers, duplicate components, and unused compatibility stores)
  • Created: 5 new files (unified task manager and shared components)
  • Modified: 5 files (component usage updates)

Total: 21 files changed, 1044 insertions(+), 1221 deletions(-)

- Consolidate separate upload and delete task managers into a unified TaskManager
- Create shared task UI components (stats, panel, list, item) under components/object/task/
- Remove unused compatibility layer stores (useDeleteTaskManagerStore, useUploadTaskManagerStore)
- Fix status name inconsistencies in task stores
- Remove unused processing-status prop from object-task-stats component

This refactoring reduces code duplication by ~1000 lines and provides a more maintainable
architecture for task management across upload and delete operations.
@codecov
Copy link

codecov bot commented Nov 29, 2025

Codecov Report

❌ Patch coverage is 0% with 810 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/task-manager.ts 0.00% 207 Missing and 1 partial ⚠️
lib/upload-task.ts 0.00% 165 Missing and 1 partial ⚠️
components/object/task/panel.vue 0.00% 104 Missing and 1 partial ⚠️
components/object/task/stats.vue 0.00% 100 Missing and 1 partial ⚠️
store/tasks.ts 0.00% 90 Missing and 1 partial ⚠️
lib/delete-task.ts 0.00% 54 Missing and 1 partial ⚠️
components/object/task/item.vue 0.00% 50 Missing and 1 partial ⚠️
components/object/list.vue 0.00% 24 Missing ⚠️
components/object/task/list.vue 0.00% 4 Missing ⚠️
components/object/upload/picker.vue 0.00% 3 Missing ⚠️
... and 1 more
Flag Coverage Δ
config-helpers 0.79% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pages/browser/[bucket]/[[key]].vue 0.00% <0.00%> (ø)
components/object/upload/picker.vue 0.00% <0.00%> (ø)
components/object/task/list.vue 0.00% <0.00%> (ø)
components/object/list.vue 0.00% <0.00%> (ø)
components/object/task/item.vue 0.00% <0.00%> (ø)
lib/delete-task.ts 0.00% <0.00%> (ø)
store/tasks.ts 0.00% <0.00%> (ø)
components/object/task/stats.vue 0.00% <0.00%> (ø)
components/object/task/panel.vue 0.00% <0.00%> (ø)
lib/upload-task.ts 0.00% <0.00%> (ø)
... and 1 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

- Add mandatory TypeScript type check (vue-tsc --noEmit) and Prettier format check (prettier --check) as required checks in AGENTS.md
- Update pre-commit-check.sh to explicitly run these checks before lint
- Update node-forge to 1.3.2 to fix security vulnerabilities
- Add node-forge override in package.json to ensure secure version
- Add mandatory lockfile sync check to AGENTS.md
- Update pre-commit hook to enforce lockfile sync before commit
- Fix pnpm-lock.yaml sync issue (node-forge specifier consistency)
- Ensure CI will pass by requiring lockfile sync before commit
- Add pnpm-lock.yaml to .prettierignore (auto-generated file should not be formatted)
- Update AGENTS.md with instructions for installing Git pre-commit hook
- Fixes CI lint failures caused by pnpm-lock.yaml formatting
@overtrue overtrue merged commit c37d557 into main Nov 29, 2025
15 of 16 checks passed
@overtrue overtrue deleted the refactor/unified-task-manager branch November 29, 2025 16:04
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