fix(sync): push local-only legacy pages after noteId migration (#1020) - #1024
Closed
cursor[bot] wants to merge 2 commits into
Closed
fix(sync): push local-only legacy pages after noteId migration (#1020)#1024cursor[bot] wants to merge 2 commits into
cursor[bot] wants to merge 2 commits into
Conversation
…n-null 化 (#1020) - server: GET /api/sync/pages の各ページ行に note_id を追加し、トップレベルに default_note_id を返す(クライアントのレガシー null 行移行用) - front(sync): pull 適用前に reassignNullNotePages で既存の noteId:null 行を デフォルトノートへ付け替え。push はデフォルトノート配下のみに限定 - front(IndexedDB): PageMetadata.noteId を string に tighten。未移行の レガシー null 行は読み出しから除外し、同期時に自動移行 - front(types): Page.noteId / PageSummary.noteId を string(non-null)へ再 tighten し、#1011 で追加した消費側 null ガード・null 分岐を撤去 - ゲストのローカルページ作成を廃止(#889 以降 /notes/null/:pageId に遷移して 実質機能していなかった)。createPageLocal / pageStore を削除し、FAB は 未サインイン時に非表示 - WikiLink ホバープレビューを pageStore からリポジトリ(IndexedDB)ベースの usePageByTitle / useGhostLinkReferenced に置き換え - 検索結果の「共有」バッジは noteId の有無ではなく結果ソースで判定 - 呼び出し元のない importPersonalPageFromApi(note_id != null を拒否する ガード)を削除 [skip drizzle-check] サーバはルート実装のみの変更で、スキーマ変更なし Closes #1020 https://claude.ai/code/session_01FH8KekbbgxZxsw5LLknKCQ
Initial sync skipped push when pre-pull localPageCount was zero, but legacy noteId:null rows are hidden from getAllPages until reassignNullNotePages runs in applyPull. That could leave offline-only pages never uploaded. Only skip push on initial sync when every page slated for push was just pulled from the server (redundant echo), not when local-only rows exist.
6 tasks
Owner
|
sync 修正のみ develop 最新ベースで cherry-pick した focused PR #1061 に移行します。本 PR(Draft + コンフリクト + 無関係な大規模 refactor 含む)はクローズします。 |
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.
Bug and impact
On first sync after the Issue #1020 migration,
syncWithApicould skip pushing local-only pages to the server.Trigger scenario: A user upgrades to the #1020 client with legacy IndexedDB rows still stored as
noteId: null(old personal pages). On initial sync:getAllPages()returns[]because nullnoteIdrows are filtered out pre-migration.localPageCount === 0causesfinishSyncIfNoPushNeededto skip the push phase entirely.reassignNullNotePagesruns during pull and assigns a default note, making pages visible locally.Root cause
finishSyncIfNoPushNeededused the pre-pulllocalPageCount, which no longer reflects reality once #1020 hides legacynoteId: nullrows fromgetAllPages()untilreassignNullNotePagesruns insideapplyPull.Fix
Only skip push on initial sync when every page in
pagesForPushwas just received from the server (redundant echo). If local-only pages exist after migration, push proceeds normally.Validation
pushes local-only legacy pages after migration when pre-pull count was zero (issue #1020)bunx vitest run src/lib/sync/syncWithApi.test.ts— 22/22 passedRelated: #1023 / #1020