Skip to content

feat(offline): model generated and natural row identities - #44

Merged
rdlabo merged 1 commit into
mainfrom
feat/offline-natural-identity-v2
Jul 27, 2026
Merged

feat(offline): model generated and natural row identities#44
rdlabo merged 1 commit into
mainfrom
feat/offline-natural-identity-v2

Conversation

@rdlabo

@rdlabo rdlabo commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

概要

オフラインレプリカの行identityを、リモートDBの主キー方式に合わせて次の3種類へ再設計します。

  • generatedId('integer' | 'text'): ローカルUUIDを不変キーとし、サーバー生成IDをACK後に追記
  • naturalKey([...]): ユーザー/partition境界と任意個数の自然キー列をSQLite複合PRIMARY KEYとして使用
  • localOnly(): リモートDB行ではないローカルprojection

背景

従来はnatural-key entityにもsynthetic local_idを付与し、Outboxも一律local IDで参照していました。この構造は複合主キーを持つリモートDB行を正確に再現できず、DB設計をオフライン基盤へ合わせる制約になっていました。

変更内容

  • natural-key entityからlocal_idserver_idを除去
  • SQLiteの物理PKをprincipal、必要なpartition、宣言順natural key列から生成
  • Outbox、Pull、tombstone、競合判定をgenerated/natural identity unionへ統一
  • サーバー生成IDをINTEGERとTEXT UUIDの両方へ対応
  • principal IDをnumber/stringで型付きcanonical保存し、7"7"を分離
  • WebとSQLiteのidentity、並び順、一意性、scope削除規則を統一
  • 未リリースの旧core schema互換分岐を除去し、初回schema versionへ畳み込み
  • 任意3列mixed natural key、lost ACK、delete/recreate、再起動、scope境界の回帰テストを追加
  • TEXT identityのbinary equality契約をドキュメント化

検証

  • Offline tests: 279/279
  • Kit full tests: 587/587
  • npm run test:offline-types:nonstrict
  • npm run prebuild
  • npm run lint
  • git diff --check
  • 上長レビュー、第三者受入レビュー: 承認

Open in Devin Review

@netlify

netlify Bot commented Jul 27, 2026

Copy link
Copy Markdown

Deploy Preview for rdlabo-ionic-angular-library ready!

Name Link
🔨 Latest commit 98580e4
🔍 Latest deploy log https://app.netlify.com/projects/rdlabo-ionic-angular-library/deploys/6a675f4f348efe00086fa7b3
😎 Deploy Preview https://deploy-preview-44--rdlabo-ionic-angular-library.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@rdlabo
rdlabo merged commit c8967a0 into main Jul 27, 2026
12 checks passed

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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