feat(data): add note metadata DataApi and cache schemas for v2 migration#13312
Open
feat(data): add note metadata DataApi and cache schemas for v2 migration#13312
Conversation
Add the data API layer for notes management: - SQLite `note` table with path-based primary key, isStarred, timestamps - CRUD API endpoints: GET/PATCH/DELETE /notes/:path, GET /notes - NoteService with upsert semantics for metadata management - PersistCache keys for notes UI state (active_file_path, expanded_paths) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…igration Reads starredPaths from Redux note slice and inserts them into the note table with isStarred=true. Registered in migration pipeline with order=5 (after chat migrator). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
Author
Replace path-only primary key with UUID id + unique path column. Path varies across devices; id serves as stable cross-device identifier for future cloud sync scenarios. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…restore - Add relativePath column (relative to notesRoot, forward-slash normalized) - NoteService computes relativePath via path.relative() from preference - NoteMigrator reads notesPath from Redux to compute relativePath during migration - Enables Mac→Win backup-restore by matching notes via relativePath Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
path can always be computed at runtime as notesRoot + relativePath. Keeping only relativePath avoids data redundancy and makes cross-platform backup-restore work without path fixup. Co-Authored-By: Claude Opus 4.6 <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.
What this PR does
Before this PR:
Note starred paths were stored in Redux (
store/note.ts) with no database persistence. UI state like active file path and expanded paths had no v2 data layer support.After this PR:
noteSQLite table for note metadata (path, isStarred, timestamps), extensible for future fields (AI tags, etc.)GET /notes,GET/PATCH/DELETE /notes/:path) with NoteServicenotes.active_file_path,notes.expanded_paths) for UI stateWhy we need it and why it was done in this way
This is the data API layer (Phase 2) for migrating
store/note.tsto the v2 architecture. Thenotetable uses file path as primary key since notes are filesystem-based. It is designed to be extensible —isStarredis the first metadata field, with future fields (AI features, tags) planned under the same table.The following tradeoffs were made:
getByPathauto-creates metadata entries (upsert) — avoids requiring explicit creation before useThe following alternatives were considered:
note_starredtable with only path+createdAt — rejected because the notes domain will grow with more metadata fieldsBreaking changes
None.
Special notes for your reviewer
preferenceSchemas.tsandPreferencesMappings.tsin a previous commit.Checklist
Release note