Skip to content

feat(backend): add delete-file action node#25

Open
LukasHirt wants to merge 2 commits into
mainfrom
feat/action-delete-file
Open

feat(backend): add delete-file action node#25
LukasHirt wants to merge 2 commits into
mainfrom
feat/action-delete-file

Conversation

@LukasHirt

Copy link
Copy Markdown
Collaborator

Summary

Adds a new "Delete File" action node, end to end. Move/copy/rename already exist as file-operation actions; delete was the one basic operation conspicuously missing — the natural terminal step for cleanup workflows like "if a temp file is older than N days, delete it."

  • Backend: new delete action type issues a WebDAV DELETE against the current resource path.
    • webdavfile.Client.Delete (mirrors copyOrMove's auth-header handling, minus the Destination header).
    • FileClient interface in executor.go gains Delete.
    • runAction's new case "delete" sets result.Output to the deleted path and resets currentPath to "", so any later file-needing action in the same chain fails with the existing "no target file" error shape (same pattern tag/comment/move/copy already use).
    • Note: oCIS's WebDAV DELETE typically moves the resource to the space's trash rather than hard-deleting it — platform behavior, not something this action implements or overclaims.
  • Frontend: new action-delete entry in NODE_TYPES under ACTION_CATEGORY (icon delete-bin), 'delete' added to the ActionType union. It's a no-config action like tag/comment (no destination/newName param) — NodeDetailsPanel.vue needed no changes since none of its actionType branches match delete, so only the generic "Run only if" condition field renders.

Test plan

  • Backend: new TestRunDeleteAction in backend/pkg/executor/executor_test.go — asserts Delete is called with the correct path, result.Output is the deleted path, and a chained tag action after delete fails because currentPath is now empty. Written first, confirmed it failed for the right reason (missing Delete call), then implemented.
  • cd backend && go build ./... && go vet ./... && go test ./... — all pass.
  • Frontend: tests/unit/nodeTypes.spec.ts (new) — asserts action-delete exists under ACTION_CATEGORY and is discoverable via findNodeTypeForNode.
  • Frontend: tests/unit/NodeDetailsPanel.spec.ts and tests/unit/ActionNode.spec.ts (new, first component-mount tests in this package) — assert the delete action renders its label/icon with zero action-specific fields, contrasted against tag (one field) and move (destination field).
  • cd frontend && npm run test:unit — 5 files / 11 tests pass.
  • cd frontend && npm run check:types — clean.
  • cd frontend && npm run lint — clean.

🤖 Generated with Claude Code

@LukasHirt
LukasHirt requested a review from a team as a code owner July 24, 2026 16:15
@LukasHirt LukasHirt self-assigned this Jul 24, 2026
LukasHirt and others added 2 commits July 24, 2026 22:52
Adds a `delete` action type that issues a WebDAV DELETE against the
current resource path — the natural terminal step for cleanup
workflows (e.g. removing files older than N days). Mirrors move/copy's
existing shape: FileClient gains a Delete method, webdavfile.Client
implements it against the same DAV endpoint used by copyOrMove, and
runAction's new "delete" case sets result.Output to the deleted path
and resets currentPath to "" so any subsequent file-needing action
fails with the same "no target file" error tag/comment/move/copy
already produce.

Note: oCIS's WebDAV DELETE typically moves the resource to the
space's trash rather than hard-deleting it (platform behavior).

Covered by a new executor test asserting Delete is called with the
right path, result.Output is set, and a chained action after delete
fails because currentPath is now empty.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Lukas Hirt <info@hirt.cz>
Registers a new "Delete File" entry under the Actions picker category
(actionType: 'delete', icon: delete-bin). Like tag/comment, it's a
no-config action — it operates implicitly on the current file, so it
needs no destination/newName param the way move/copy/rename do.
NodeDetailsPanel already renders a no-config action correctly with no
extra changes needed: none of its actionType branches match 'delete',
so only the generic "Run only if" condition field shows.

Adds Vitest coverage: nodeTypes.spec.ts asserts the action-delete
entry exists under ACTION_CATEGORY and is discoverable via
findNodeTypeForNode; NodeDetailsPanel.spec.ts and ActionNode.spec.ts
add the first component-mount tests in this package, asserting the
delete action renders its label/icon with zero action-specific fields
(contrasted against tag's one field and move's destination field).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Lukas Hirt <info@hirt.cz>
@LukasHirt
LukasHirt force-pushed the feat/action-delete-file branch from 71bbc01 to d89c340 Compare July 24, 2026 20:54
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