Repository navigation
feat(docs): archive deleted pages with 30-day retention (#37) - #39
Merged
Merged
Conversation
Deleting a page now moves it and its whole subtree to an archive. Editors (not only owners) can delete, preview and restore; owners can delete permanently. An hourly job purges archive roots older than KNOT_ARCHIVE_RETENTION_DAYS (default 30), deleting S3 objects first. Fixes #37: the sidebar offered Delete to editors but the server required owner, and deleting a folder left its subpages behind at the top level. - migration: archived_by, archive_root_id, purge_requested_at; backfill of earlier soft-deletes (fresh clock, live children detached) - archived docs are read-only for editors+, invisible to viewers; every write path answers 409 doc.archived; share links act revoked; search, My Tasks and export skip them - restore locks the parent first; purge is fenced against restore while S3 deletes run, and retried by the job if they fail - web: Move to archive, Archive page, archived banner, the page stays open when access changes but is still readable, keyboard-usable row menu Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #37.
Why
Issue #37 reports that a folder in the sidebar can't be deleted. There were two causes:
DELETE /api/docs/{id}required the owner role. Editors got a bare "Delete failed".This PR fixes both and replaces the soft delete with an archive. Deleted pages can be restored for a retention period and are then deleted permanently. Some content must sometimes be removed immediately, so owners can also delete permanently ahead of time.
Design:
docs/superpowers/specs/2026-10-13-document-archive-retention-design.mdPlan:
docs/superpowers/plans/2026-10-13-document-archive-retention.mdWhat changes for users
409 doc.archived.KNOT_ARCHIVE_RETENTION_DAYS(default 30; Helm valuearchive.retentionDays), an hourly job deletes the page for good.Notes for review
archive_root_id= the page the user deleted. Restore and purge act on that set; reads stay simple column checks.require_doc_role_mwnow getsDocAccess { role, archived }from the ACL cache. For archived docs it returns 404 for viewers and 409 for any non-GET request, except the restore and purge routes. Routes outside that middleware usearchive::refuse_if_archived: shares, task checkbox, blobs, boards, and import into a parent.FOR SHARE.purge_requested_atis committed before any S3 delete. For the Postgres blob backend there is no separate delete at all; the bytes cascade inside the purge transaction.Testing
cargo test --workspace: 441 passed. New coverage:archive.spec.ts, plus the existing suite (86 passed, without the OIDC and ws-reconnect specs, which need Dex and toxiproxy).cargo clippy --all-features -D warnings,cargo fmt,tsc,eslintandhelm lintare clean.contributors_integration::revoked_editor_is_closed_with_4403_and_its_edits_are_droppedfailed once under full-suite load withConnectionReset(the test sends right after revoking). It passed 10 out of 10 in isolation and in the next full run. This PR doesn't touch that code path.🤖 Generated with Claude Code