-
-
Notifications
You must be signed in to change notification settings - Fork 684
Issue2228 #2229
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
Issue2228 #2229
Conversation
WalkthroughFixed handling of PropModifications (add/remove operations) in cloud sync mutations by adding guards in listClientChanges.ts to prevent invalid optimization, added test case for issue Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (3)
addons/dexie-cloud/package.json (1)
89-89: Consider pinning the version for reproducible builds.Using
"*"forkarma-webdriver-launchermay lead to inconsistent test behavior across environments. Given that this dependency is explicitly excluded in the local karma config (as seen inkarma.conf.cjs), this appears intentional for CI/remote testing scenarios, but a pinned version would ensure consistency.addons/dexie-cloud/test/unit/tests-github-issues.ts (2)
16-17: Remove duplicateDBURLdeclaration.The
DBURLconstant is now declared at the top level here, but line 73 in the issue-2185 test still has a local declaration of the same value. Consider removing the local declaration in issue-2185 to avoid redundancy.🔎 Proposed fix in the issue-2185 test
promisedTest('https://github.com/dexie/Dexie.js/issues/2185', async () => { const DBNAME = 'issue2185'; - const DBURL = 'https://zv8n7bwcs.dexie.cloud'; // Shall exist in cloud. const DEMOUSER1 = '[email protected]'; // This user is imported into the cloud database using `npx dexie-cloud import dexie-cloud-import.json`
43-51: Consider verifying the final item state after sync.The test confirms sync operations complete, but doesn't verify the item's final state contains the expected
drinksarray. Given that issue #2228 was about invalid sync mutations, asserting the final data would strengthen the test.🔎 Suggested verification
await db.cloud.sync({purpose: 'push', wait: true }); + const finalItem = await db.items2228.get(itemId); + deepEqual(finalItem?.drinks, ['coffee', 'tea'], 'Item drinks array is correct after add/remove operations'); + ok(true, 'Test completed successfully');
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (5)
addons/dexie-cloud/dexie-cloud-import.json(1 hunks)addons/dexie-cloud/package.json(1 hunks)addons/dexie-cloud/src/sync/listClientChanges.ts(1 hunks)addons/dexie-cloud/test/unit/karma.conf.cjs(1 hunks)addons/dexie-cloud/test/unit/tests-github-issues.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
addons/dexie-cloud/test/unit/tests-github-issues.ts (1)
addons/dexie-cloud/src/dexie-cloud-client.ts (1)
dexieCloud(76-501)
🔇 Additional comments (5)
addons/dexie-cloud/dexie-cloud-import.json (1)
4-5: LGTM!The new demo user entry follows the existing naming convention and aligns with the test case in
tests-github-issues.tsthat uses[email protected]for authentication.addons/dexie-cloud/src/sync/listClientChanges.ts (2)
80-82: LGTM! Good defensive check for PropModification.This correctly prevents PropModification entries from being added to the coverage map, ensuring that add/remove operations are not considered for redundancy optimization.
95-106: LGTM! Proper guards ensure PropModification mutations are preserved.The duplicate PropModification check (lines 98-100) in the filter pass is necessary because mutations not added to the coverage map in the first pass still need to be explicitly retained here. The added null check on line 106 is a good defensive addition that handles edge cases where keyCoverage may not exist.
addons/dexie-cloud/test/unit/tests-github-issues.ts (1)
37-41: Good edge case coverage for non-existing items.Testing add/remove operations on a non-existing item is valuable - this ensures the sync logic handles orphaned mutations gracefully without crashing.
addons/dexie-cloud/test/unit/karma.conf.cjs (1)
24-31: No action needed. The explicit plugins array correctly references karma-mocha-reporter, which is available as a devDependency in the root workspace package.json of this monorepo.
Repro and fix #2228 (discussion #2226)
Summary by CodeRabbit
Bug Fixes
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.