Skip to content

fix(offline): lock replica schema and adopt server identities - #29

Merged
rdlabo merged 1 commit into
mainfrom
feat/offline-text-server-id
Jul 22, 2026
Merged

fix(offline): lock replica schema and adopt server identities#29
rdlabo merged 1 commit into
mainfrom
feat/offline-text-server-id

Conversation

@rdlabo

@rdlabo rdlabo commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep the standard offline replica limited to positive numeric server identifiers
  • normalize primitive literal unions while retaining exact required/nullable schema checks
  • allow enqueue to adopt a known numeric serverId before the first pull
  • reject duplicate serverId mappings consistently in the sync service and web repository
  • safely discard adopted rows that have no confirmed baseline

Compatibility

Existing enqueue callers can omit serverId unchanged. serverId() remains numeric-only, and existing SQLite DDL and schema fingerprints are unchanged. Offline replica schema consumers are required to compile with strictNullChecks: true; the feature is not yet released, so no legacy null-checking compatibility layer is included.

Verification

  • kit: 33 files / 415 tests passed
  • npm run lint
  • npm run prebuild:kit
  • kit lib/spec TypeScript checks
  • git diff --check

@netlify

netlify Bot commented Jul 22, 2026

Copy link
Copy Markdown

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

Name Link
🔨 Latest commit 99e7046
🔍 Latest deploy log https://app.netlify.com/projects/rdlabo-ionic-angular-library/deploys/6a6142e76179c20008f40010
😎 Deploy Preview https://deploy-preview-29--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 marked this pull request as ready for review July 22, 2026 16:12

@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 found 1 potential issue.

Open in Devin Review

Comment on lines +4 to +7
/** Server acknowledgement used to reconcile one optimistic local mutation. */
export interface OfflineCommandResult {
/** AUTO_INCREMENT id returned by a successful create. */
serverId?: number;
export type OfflineServerId = number | string;

export interface OfflineCommandResult<TServerId extends OfflineServerId = number> {

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.

🟡 新しい公開型の説明が取り違えられドキュメント必須ルールに違反

サーバー確認結果を表す型の説明コメントが新規追加された別の型へ付け替えられ (projects/kit/offline/src/lib/offline-command-executor.ts:4-7)、その結果として確認結果型からは説明コメントが失われている。
Impact: リポジトリ規約が求める「すべての公開型に説明コメントを付ける」要件に反し、公開APIのドキュメントが誤った内容・欠落状態になる。

コメント付け替えの詳細

変更前は /** Server acknowledgement used to reconcile one optimistic local mutation. */OfflineCommandResult の説明だった。今回 OfflineServerId 型を直前に挿入した際、このコメントが OfflineServerId(単なる number | string 別名)に付いてしまい説明として不正確になり、OfflineCommandResultprojects/kit/offline/src/lib/offline-command-executor.ts:7)は説明コメントを持たない状態になった。AGENTS.md の「Every public class, function, and type must have a JSDoc comment.」に違反する。

Suggested change
/** Server acknowledgement used to reconcile one optimistic local mutation. */
export interface OfflineCommandResult {
/** AUTO_INCREMENT id returned by a successful create. */
serverId?: number;
export type OfflineServerId = number | string;
export interface OfflineCommandResult<TServerId extends OfflineServerId = number> {
/** Numeric or text server identifier persisted for a replica row and returned by a successful create. */
export type OfflineServerId = number | string;
/** Server acknowledgement used to reconcile one optimistic local mutation. */
export interface OfflineCommandResult<TServerId extends OfflineServerId = number> {
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@rdlabo
rdlabo force-pushed the feat/offline-text-server-id branch from cea9f46 to 810cc4e Compare July 22, 2026 22:02
@rdlabo rdlabo changed the title feat: support text offline server ids fix(offline): lock replica schema and adopt server identities Jul 22, 2026
@rdlabo
rdlabo force-pushed the feat/offline-text-server-id branch 2 times, most recently from 41874a4 to 7b27353 Compare July 22, 2026 22:20
@rdlabo
rdlabo force-pushed the feat/offline-text-server-id branch from 7b27353 to 99e7046 Compare July 22, 2026 22:23
@rdlabo
rdlabo merged commit 925f7bf into main Jul 22, 2026
12 checks passed
@rdlabo
rdlabo deleted the feat/offline-text-server-id branch July 22, 2026 22:46
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