-
Notifications
You must be signed in to change notification settings - Fork 1
feat(offline): replace aggregate intent chains atomically #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 連鎖置換で一度消してから作り直したはずの関連データが消えたままになる
集約チェーンの置換をまとめて書き込む際、後続intentが復活させたはずの関連行が先行intentの削除指示によって上書き削除されます(
#commitMaterializedEnqueuesのremoveRows生成、projects/kit/offline/src/lib/offline-sync.service.ts:660)。Impact: 置換後に本来残るはずのローカルデータが消え、画面表示や後続同期が実際の意図と食い違います。
putRows→removeRows の適用順とチェーン内重複キー許可の組み合わせ
replacePreparedAggregateは#assertDistinctBatchFootprints(materializations, retained, true)(projects/kit/offline/src/lib/offline-sync.service.ts:354)でallowOneAggregate = trueを渡すため、チェーン内の同一 replica キー重複チェック(同ファイル 622-625 行)が無効化されます。その結果、entry0 の companion がafter = null(削除)、entry1 の同じ companion がafter = row(再作成)というチェーンが許容されます。しかし
#commitMaterializedEnqueuesは全 entry の put をputRowsに、全 entry の削除をremoveRowsにフラットに集約します(同ファイル 656-660 行)。両リポジトリ実装とも putRows を全件適用した後に removeRows を適用するため(projects/kit/offline/src/lib/offline-repository.ts:686-698、projects/kit/offline/src/lib/sqlite-offline-repository.ts:411-420)、entry1 が書いた行が entry0 の削除で消え、チェーン最終状態と一致しません。ベース行は putRows のみなので順序勝ちで正しく、影響は companion 行に限られます。enqueuePreparedBatch経路では重複 footprint が例外になるため、この経路は本 PR で新規に生じたものです。Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.