Skip to content

feat: reset and prune draft version history - #19

Merged
prom3theu5 merged 2 commits into
mainfrom
feature/prune
Oct 11, 2026
Merged

prom3theu5 merged 2 commits into
mainfrom
feature/prune

Conversation

@prom3theu5

@prom3theu5 prom3theu5 commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

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.

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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.
Add dashboard reset controls
crates/keryx-render/src/lib.rs, crates/keryx-render/assets/dashboard.js, crates/keryx-render/assets/dashboard.css, tests/dashboard/prune.spec.mjs
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.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

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 | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@prom3theu5
prom3theu5 merged commit 3c27fa3 into main Oct 11, 2026
5 checks passed
@prom3theu5
prom3theu5 deleted the feature/prune branch October 11, 2026 17:01
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