Skip to content

refactor(angular): thread FileAction through one command path (remove 5-layer six-action fan-out) #674

Description

@nitrobass24

Context

From a repo-wide over-engineering audit (ponytail-audit). The six file actions (queue, stop, extract, deleteLocal, deleteRemote, validate) are written out longhand across five layers — ~30 near-identical methods differing only by a URL verb, a log noun, or a status guard. Estimated cut: ~150 lines.

Findings

  1. ModelFileService (src/angular/src/app/services/files/model-file.service.ts): 6 methods differing only by URL verb.
  2. ViewFileCommandService (services/files/view-file-command.service.ts): 6 methods differing only by log noun.
  3. ViewFileService (services/files/view-file.service.ts:152-176,207-227): 6 pure pass-through facades + 4 bulk facades.
  4. FileListComponent (pages/files/file-list.component.ts:143-193,230-233): 6 byte-identical onX subscribe blocks + 4 onBulkX.
  5. FileComponent (pages/files/file.component.ts:122-145,168-197): 6 onX handlers + 6 isX guards.

Task

Thread the existing FileAction enum through one command(action: FileAction, file: ViewFile) per layer:

  • One table (per action: URL segment, log noun, capability flag) at the lowest layer that needs each datum.
  • Components call onAction(action, file) / onBulkAction(action); templates pass the enum member.
  • Capability guards (isQueueable etc.) can stay as data lookups against the same table.

Constraints

  • HTTP endpoints, request shapes, and user-visible log/notification text unchanged.
  • Bulk actions keep their forkJoin semantics.
  • Follow the Angular mutating-service contract in CLAUDE.md (mutations inside the returned pipeline via tap, typed WebReaction results — don't regress this).
  • Update specs to the new single entry point; per-action coverage can become a parameterized loop over the 6 actions so no action loses a test.
  • npx ng lint and npx ng test pass (Node ≥22.22.3 required locally).

Acceptance

  • One command path per layer; no per-action method sextuplets remain
  • All 6 actions still covered by tests (parameterized)
  • Lint + unit tests pass; e2e file-action flows unaffected

Workflow: branch refactor/file-action-fanout off develop, PR to develop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    javascriptPull requests that update javascript coderefactorCode refactoring and cleanup

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions