mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-09-10 03:41:52 +02:00
feat(models): add content-addressed request versions
One table versions HTTP, gRPC and WebSocket requests alike. A version stores the model's editable content — the serialized model minus model/id/timestamps/ workspace/folder/sortPriority — and is addressed by the sha256 of that document, with (model_id, content_hash) unique. Content addressing is what makes the trigger side simple: snapshot_request can be called by a send, a window blur and an idle timer on the same unedited request and leave one row behind, so no caller has to reason about whether anything changed. Dropping bookkeeping keys is what makes it stable — moving a request between folders or re-sorting it rewrites those fields and nothing else, and neither should mint a version or show up in a diff. The same rule covers all three request types because they differ only in content fields. Responses and gRPC/WebSocket connections gain a nullable version_id. Versions are local history, so ModelVersion is deliberately absent from AnyModel: no model-change rows, no frontend store bucket, no sync, no export. Retention keeps anything a response points at, plus the newest 50 per request within 30 days; request and workspace deletes cascade.
This commit is contained in:
@@ -21,6 +21,7 @@ pub mod queries;
|
||||
pub mod query_manager;
|
||||
pub mod render;
|
||||
pub mod util;
|
||||
pub mod versions;
|
||||
|
||||
/// Per-connection setup, applied by every pool on every connection it opens.
|
||||
fn init_connection(conn: &rusqlite::Connection) -> rusqlite::Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user