You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Drafts accumulate version history with no way to clear it while keeping the latest content. Add “Reset and prune version history” to the history header and draft context menu, sharing one confirmation. Older versions and their blobs are removed, the retained version becomes v1, and the next upload becomes v2. The confirmation explains that versioned links may break or show different content.
The operation preserves the draft, tags, availability and retained content, rejects stale confirmations after concurrent uploads, and reports incomplete blob cleanup. Includes focused database, API and dashboard tests, updated documentation, and the 0.8.0 version bump.
Validated with the offline Rust test suite, all-target build, Clippy with warnings denied, formatting checks, and all 8 dashboard tests using installed Chromium. Prom also confirmed manual testing against a copy of existing data. PostgreSQL execution is left to CI.
Summary by CodeRabbit
New Features
Added an option to reset and prune a draft’s version history. The latest version is kept and renumbered to v1; older versions and their stored files are removed. Future uploads start at v2.
The reset requires confirmation and refreshes if the latest version changes before confirmation.
Documentation
Clarified that resetting history can make old version links unavailable or cause them to show different content. The reset cannot be undone.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 23a55cad-7e88-4855-9251-33cdadf5ead9
📥 Commits
Reviewing files that changed from the base of the PR and between 1115211 and 5095111.
⛔ Files ignored due to path filters (1)
Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
Cargo.toml
crates/keryx-db/src/lib.rs
crates/keryx-db/src/store.rs
crates/keryx-db/src/store_tests.rs
crates/keryx-db/src/types.rs
crates/keryx-render/assets/dashboard.css
crates/keryx-render/assets/dashboard.js
crates/keryx-render/src/lib.rs
crates/keryx-server/src/lib.rs
tests/dashboard/prune.spec.mjs
website/src/content/docs/docs/availability.md
website/src/content/docs/docs/versions.md
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
📝 Walkthrough
📝 Walkthrough
Walkthrough
The change adds version-history pruning for drafts. It retains the confirmed current version, removes older version records and stored blobs where cleanup succeeds, and renumbers the retained version to v1. Dashboard controls, an authenticated API route, tests, and documentation support the reset workflow.
Changes
Version history reset and pruning
Layer / File(s)
Summary
Prune versions in the database crates/keryx-db/src/types.rs, crates/keryx-db/src/lib.rs, crates/keryx-db/src/store.rs, crates/keryx-db/src/store_tests.rs, Cargo.toml
The database API adds prune outcomes and errors. The store checks the expected current version, removes older versions, and renumbers the retained version to v1. Tests cover stale confirmations, repeated pruning, and concurrent uploads. The workspace version changes to 0.8.0.
Expose pruning through the API crates/keryx-server/src/lib.rs
The authenticated prune endpoint validates the expected version ID, calls the store, and attempts blob cleanup. It reports cleanup status and handles missing drafts and stale confirmations.
The dashboard adds reset actions and a confirmation dialog. It handles stale confirmations, refreshes dashboard history, and reports cleanup status. Tests cover cancellation, confirmation, refresh, and upload behavior.
Document reset effects on version links website/src/content/docs/docs/versions.md, website/src/content/docs/docs/availability.md
The documentation describes the reset operation and explains that reused version numbers can change how old version links resolve.
sequenceDiagram
participant Dashboard
participant prune_versions_handler
participant SeaOrmStore
participant BlobStorage
Dashboard->>prune_versions_handler: POST expectedCurrentVersionId
prune_versions_handler->>SeaOrmStore: prune_versions
SeaOrmStore-->>prune_versions_handler: retained ID and removed object keys
prune_versions_handler->>BlobStorage: delete removed blobs
prune_versions_handler-->>Dashboard: prune result and cleanup status
Loading
Merge Risk:⚪ Minimal · up to 50951
The reset workflow has no established issue that needs correction before merge. PostgreSQL validation remains with CI.
Pre-merge checks | 4 | 1
❌ Failed checks (1 warning)
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 31.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 35 functions across 8 files. (4 skipped: …
Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name
Status
Explanation
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely describes the main change: adding reset and prune functionality for draft version history.
Full details: Docstring Coverage
Explanation
Docstring coverage is 31.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 35 functions across 8 files. (4 skipped: 4 unsupported.)
Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
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
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.
Drafts accumulate version history with no way to clear it while keeping the latest content. Add “Reset and prune version history” to the history header and draft context menu, sharing one confirmation. Older versions and their blobs are removed, the retained version becomes v1, and the next upload becomes v2. The confirmation explains that versioned links may break or show different content.
The operation preserves the draft, tags, availability and retained content, rejects stale confirmations after concurrent uploads, and reports incomplete blob cleanup. Includes focused database, API and dashboard tests, updated documentation, and the 0.8.0 version bump.
Validated with the offline Rust test suite, all-target build, Clippy with warnings denied, formatting checks, and all 8 dashboard tests using installed Chromium. Prom also confirmed manual testing against a copy of existing data. PostgreSQL execution is left to CI.
Summary by CodeRabbit