Repository navigation
V0-15: Add the versioned Nodepad archive workflow - #35
Merged
Merged
Conversation
Add the V0 versioned archive format: export one Thinking Workspace as deterministic JSON and import a fully validated archive into a fresh Workspace with collision-safe identity remapping. - archive.rs owns the V0 format, deterministic serialization, and full pre-mutation validation (format, version, size, required fields, length bounds, enums, unique source ids, label normalization, relationship endpoints/pairs, synthesis source ids). No SQLite access. - workspace.rs owns the SQL extraction (archive_export_data) and the transactional import (import_archive): one transaction, fresh ids, remapped references, imported Workspace always Manual, name collisions append deterministic ' (2)'/' (3)' suffixes, rollback on any failure. - Reusable durable validators/constants promoted to pub(crate) so the archive and the store share one source of truth for every limit. - Native save/open dialogs with atomic write; cancel is a no-op. - Export excludes provider keys, selected model, cloud consent, active workspace, undo, view state, and paths; durable domain content only. - Pending Syntheses whose sources left the Workspace are not archived; source revision is derived from the preserved Note on import so staleness is correct in the fresh Workspace. Tests: archive format/validation unit tests; Rust round-trip covering Unicode, all Note Types, manual/AI provenance, manual/AI Relationships, Labels (including vocabulary with no Note), pending Synthesis with sources, synthesis history, restart recovery; rollback on injected failure; byte scan for secrets/transient markers; name collision suffixing; malformed-before-mutation. Frontend UI tests for export, import success/cancel/failure. Closes #16.
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.
30AA
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.
Closes #16.
What
Adds the V0 versioned Nodepad archive workflow: export one complete Thinking Workspace as deterministic JSON and import a fully validated archive into a fresh Workspace with collision-safe identity remapping. Validation completes before the transaction begins; import commits all durable data or nothing.
Design (deep modules, no leakage)
archive.rsowns the V0 format, deterministic serialization, and full pre-mutation validation. It is pure — no SQLite, no Tauri. Format/version/schema decisions live here alone.workspace.rsowns the SQL extraction (archive_export_data) and the transactional import (import_archive). One transaction: workspace → labels → notes (+ memberships) → relationships (re-canonicalized) → pending syntheses (+ sources/labels) → synthesis history → FTS refresh → commit. A failure at any point rolls back.pub(crate)so the archive reuses the same durable rules instead of duplicating limits — one source of truth for each bound.Acceptance criteria mapping
exportedAt/applicationVersionvary).(2)/(3)name suffixing).selectedModel,cloudConsent,activeWorkspace,undoableCommands,keychain, or the sentinel model id).Scope fence
No legacy
.nodepadimport, no partial import/merge, no multi-Workspace export, no encryption, no local provider configuration. Archive extension is.nodepad.jsonto avoid the legacy.nodepadformat.Delivery workflow evidence
cargo test --lib: 160 passed (12 archive unit tests + round-trip / rollback / byte-scan / collision / malformed integration tests).npx vitest run(projectsrc/): 143 passed (export, import success/cancel/failure UI tests).npm run typecheck: clean.npm run lint(eslint --max-warnings 0): clean.npm run web:build: green.cargo check: green.npm run test:rust: 160 passed.fallow audit --changed-since main): verdictwarnwith 0 introduced findings (dead-code/complexity/duplication all inherited and pre-existing — out of scope per AGENTS.md).Notes
enrichment_revisionon import so staleness is correct in the fresh Workspace.npm run testdiscovers stale.claude/worktrees/**test files (gitignored leftovers from prior sessions); on a clean CI checkout there are no such worktrees and the gate passes. Projectsrc/tests all pass (143/143).Do not merge without review.