Add file deletion and accidental-deletion recovery - #709
Conversation
添加简短功能需求,说明个人端及管理后台需要删除按钮与误删恢复。 Co-Authored-By: Hugo <shen.lan123@gmail.com>
|
补充一个可运行、可审查的参考实现,供讨论时直接查看代码。这个 PR 仍保持简短需求文档,不要求直接合入实现。 包括个人端和管理后台的回收站、软删除/恢复、当前权限检查,以及导航和迟到响应的回归测试。该提交基于 本地通过核心相关测试 233 项、个人端 27 项、管理端 99 项和真实 Postgres 文件存储测试 8 项;还通过真实核心与插件的 HTTP 接口检查了删除、重启后恢复及内容一致性。这些不是上游 CI 结果,完整验证边界见说明。 仍有一个明确的审计 P2: 文件状态更新与审计写入不是同一事务,异常时可能更新成功但缺失审计事件,重复同一请求不会补写。说明中记录了复现条件;因此这份代码作为参考,不声称已满足完整审计保证或可直接合并。已下载内容和既存 workspace / sandbox 副本也不会因软删除被撤回。 |
|
之前注明的文件生命周期审计 P2 已修复,参考分支已更新: 删除/恢复现在使用单条 PostgreSQL CTE 更新文件状态并插入审计事件;审计失败则整体回滚,接口返回失败,重试只记录实际变更。复用完整的现有审计 schema 和旧记录迁移,无新增表、字段或队列。 修复前的失败测试已复现;修复后核心相关测试 234 项、真实 Postgres 文件存储与审计测试 13 项通过,类型检查和 lint 通过。本机 HTTP 故障注入验证了个人/管理员 DELETE 与 restore:故障时 500 且状态不变,解除故障后重试 200、事件不重复,内容不变。两名独立审查者未发现新的 P1/P2。这些不是上游 CI 结果。 修复只覆盖授权后的文件删除/恢复,不自动补齐已遗漏的历史事件,也不改变其他动作的通用异步审计。该 PR 仍是需求讨论,代码作为参考提供。 |
Use concise English wording for the upstream feature request. Co-Authored-By: Hugo <shen.lan123@gmail.com>
|
I have updated the request text and PR description in English for the maintainers. The feature request remains intentionally short. The implementation reference and its test notes are linked in the earlier comments; this update only changes the language and does not expand the requested scope. |
Please add a delete button to both the personal files page and the admin files page.
There also needs to be a way to recover a file after an accidental deletion.
The same request is recorded in
adrs/file-trash-restore_20260828.md. A reference implementation is linked in the comments for maintainers who want to inspect it.