Skip to content

feat: add a shared file operation engine (plan, progress, per-item results) #10

Closed

Description

@nextestudios

Summary

Introduce IFileOperationService: one engine for copy, move, delete and rename that plans the batch, reports progress, asks about conflicts and returns a true per-item result.

Motivation

Every M1 feature needs the same guarantees the extractor already has (no silent overwrite, originals preserved, honest partial results). Building them once avoids four inconsistent implementations.

Requirements

  • Planning step validates source, destination, permissions and incoherent requests (e.g. copying a folder into itself, source == destination).
  • Resolves real file identity (links, junctions, equivalent paths) and never follows reparse points inside source trees by default.
  • Runs off the UI thread through the existing OperationQueue with explicit states (Queued → Planning → Running → Completed/CompletedWithWarnings/Failed/Cancelled).
  • Per-item ItemResult with outcome and error kind; cancellation keeps finished items and removes owned temporaries.
  • Conflict decisions go through a pluggable interaction (same shape as IExtractionInteraction).

Controller UX

No direct controller UX: this is the engine used by the M1 actions. Progress appears in the existing operations center (Menu → Operations).

Technical Notes

Contract in ControlFS.Core/Contracts, implementation in ControlFS.Infrastructure.Windows/FileSystem. Reuse OperationQueue, OperationResult, ConflictInfo/ConflictDecision and UniqueNames. Keep AppController as the only UI-facing orchestrator.

Acceptance Criteria

  • Engine returns Completed / CompletedWithWarnings / Failed / Cancelled with accurate per-item outcomes.
  • Copying or moving a folder into itself is refused during planning.
  • Cancelling mid-batch keeps finished items and leaves no temporaries.

Testing

Unit tests for new branches and for every bug reproduced before a fix (no trivial variations, see AGENTS.md). Integration tests on the Windows runner for locked files, access denied and read-only media.

Dependencies

  • None

Priority: critical · Milestone: 1 · Core File Operations

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: filesystemarea: operationspriority: criticaltype: feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions