v0.5.0: Trash (soft-delete) + Keep folder

Delete now moves an artifact to a recoverable Trash instead of hard-removing.

- Model: Artifact.deleted_at (nullable, indexed) = in Trash.
- Soft-delete everywhere: DELETE /api/artifacts/{id} sets deleted_at
  (idempotent 204); session POST /a/{id}/delete for the feed's hover Delete
  icon; POST /a/{id}/undelete restores; POST /feed/empty-trash purges.
- Trashed artifacts are off-quota (deleting frees quota) and eviction-protected
  (never evicted early); hidden from feed, sources, counts, and all API reads
  (list/detail/raw).
- Sidebar: "Deleted" and "Keep" system folders at the bottom (counts, hidden
  when empty); ?folder=deleted / ?folder=keep views reuse the row rendering.
  Deleted view has hover Undelete + an Empty Trash button. Keep = view over
  is_kept. Live-poll disabled in folder views.
- Docs (api.md delete section, CLAUDE.md), 10 new/updated tests. 150 passing;
  API soft-delete lifecycle verified live.

Purge is manual (Empty Trash) this release; auto purge-on-delete (background,
~3-day retention) is the planned fast-follow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
peter 2026-09-07 12:48:43 +01:00
parent 6c1823e65e
commit 4254164bef
14 changed files with 438 additions and 43 deletions

View file

@ -1055,6 +1055,57 @@ kbd {
animation: agentfeed-row-arrive 1.5s ease-out;
}
/* Hover/focus row actions (delete in the feed, undelete in Trash) */
.artifact-row {
position: relative;
}
.row-action {
position: absolute;
right: 0.5rem;
top: 50%;
transform: translateY(-50%);
opacity: 0;
cursor: pointer;
font-size: 0.95rem;
line-height: 1;
padding: 0.15rem 0.3rem;
border-radius: 4px;
background: var(--surface);
color: var(--muted);
}
.artifact-row:hover .row-action,
.artifact-row:focus-within .row-action {
opacity: 1;
}
.row-action:hover {
background: var(--surface-alt);
color: var(--text);
}
.row-delete:hover {
color: var(--danger-text-plain);
}
/* System folders (Keep / Deleted) at the bottom of the sidebar */
.source-folders {
border-top: 1px solid var(--grid-line);
margin-top: 0.4rem;
padding-top: 0.4rem;
}
.empty-trash-button {
background: var(--danger-bg);
border: 1px solid var(--danger-text);
border-radius: 6px;
color: var(--danger-text);
cursor: pointer;
font-size: 0.78rem;
padding: 0.2rem 0.55rem;
}
.api-key-create {
align-items: end;
display: flex;