Fix model and cacheModle updateOnDuplicate fields#2976
Conversation
WalkthroughReplaces dynamic extraction of update keys from the first data item with the model's full attribute keys for bulkCreate updateOnDuplicate; tests adjusted for optional fields and a new test verifies updates where optional fields are added later. Test mocks now include Changes
Sequence Diagram(s)Old flow (before): updateOnDuplicate derived from first data item keys sequenceDiagram
autonumber
participant Caller
participant Model
Note over Model: Old behavior
Caller->>Model: bulkCreate(data)
rect `#c8e6ff`
Model->>Model: keys = Object.keys(data[0])
Model->>DB: CREATE ... ON DUPLICATE UPDATE <keys>
end
DB-->>Model: result
Model-->>Caller: result
New flow (after): updateOnDuplicate uses model attribute keys sequenceDiagram
autonumber
participant Caller
participant Model
Note over Model: New behavior
Caller->>Model: bulkCreate(data)
rect `#e6ffe6`
Model->>Model: allKeys = Object.keys(model.getAttributes()) as (keyof T)[]
Model->>DB: CREATE ... ON DUPLICATE UPDATE <allKeys>
end
DB-->>Model: result
Model-->>Caller: result
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/node-core/src/indexer/storeModelProvider/model/cacheModel.ts (1)
274-280: AligningCachedModelupsert behavior with full model attributes looks correctUsing
Object.keys(this.model.getAttributes())forupdateOnDuplicatein the non-historical flush fixes the bug where only the first record’s keys were considered and keepsCachedModelconsistent withPlainModel. This should ensure later records with additional fields (including optional ones) are correctly updated on conflict.If you want to avoid drift and recomputing this on every flush, you could optionally factor the
allKeyscomputation into a shared helper or a lazily-initialized instance field reused by bothPlainModelandCachedModel, but that’s not required for correctness here.packages/node-core/src/indexer/storeModelProvider/model/model.test.ts (1)
121-141: New test accurately guards against the previousupdateOnDuplicateregressionThe
"update with optional fields"test neatly captures the original bug: when the first element ofdata2omitsfield1, a naïveObject.keys(data2[0])would prevent{id: '2', field1: 3}from updating correctly. WithupdateOnDuplicatenow driven by all model attributes, this test should continue to pass and will fail if the regression is reintroduced.As an optional enhancement, you could add a similar assertion using
cacheModelplus a flush to the DB (covering theCachedModel.runFlushpath that also usesupdateOnDuplicate), but the current test already validates the core behavior.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/node-core/src/indexer/storeModelProvider/model/cacheModel.ts(1 hunks)packages/node-core/src/indexer/storeModelProvider/model/model.test.ts(2 hunks)packages/node-core/src/indexer/storeModelProvider/model/model.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: code-style
- GitHub Check: Coverage report
🔇 Additional comments (2)
packages/node-core/src/indexer/storeModelProvider/model/model.ts (1)
99-103: Using all model attributes forupdateOnDuplicatecorrectly fixes partial-update bugDeriving
allKeysfromthis.model.getAttributes()and passing it toupdateOnDuplicateensures duplicate-key updates consider the full schema instead of justObject.keys(data[0]). This directly fixes the case where later records introduce additional fields (e.g., makingfield1updatable even if omitted in the first element) and keeps behavior consistent across different input shapes.No blocking issues from this change.
packages/node-core/src/indexer/storeModelProvider/model/model.test.ts (1)
58-59: Optionalfield1typing matches the intended test scenarioSwitching
PlainModelandCachedModelgenerics to{id: string; field1?: number}aligns the TypeScript types with the test model definition wherefield1can be omitted. This is necessary to express the “missing in some records, present in others” scenario you’re testing.Looks good.
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
|---|---|---|---|
| 🟢 | Statements | 87.61% (+17.51% 🔼) |
71020/81060 |
| 🟢 | Branches | 80.35% (+2.06% 🔼) |
3354/4174 |
| 🟡 | Functions | 66.74% (+4.24% 🔼) |
1274/1909 |
| 🟢 | Lines | 87.61% (+17.51% 🔼) |
71020/81060 |
Show new covered files 🐣
St.❔ |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| 🔴 | ... / utils.ts |
46.2% | 74.07% | 35.71% | 46.2% |
| 🔴 | ... / build-manifest.ts |
42.47% | 100% | 25% | 42.47% |
| 🟡 | ... / build.ts |
68.82% | 70% | 75% | 68.82% |
| 🟡 | ... / import-abi.ts |
71.28% | 48% | 75% | 71.28% |
| 🔴 | ... / mcp.ts |
33.33% | 100% | 0% | 33.33% |
| 🟢 | ... / migrate.ts |
81.37% | 30% | 75% | 81.37% |
| 🔴 | ... / add-deployment-boost.ts |
45.54% | 100% | 0% | 45.54% |
| 🔴 | ... / connect-wallet.ts |
50.68% | 100% | 25% | 50.68% |
| 🔴 | ... / create-api-key.ts |
50.68% | 100% | 25% | 50.68% |
| 🔴 | ... / create-deployment.ts |
41.73% | 100% | 0% | 41.73% |
| 🔴 | ... / create-flex-plan.ts |
38.64% | 100% | 25% | 38.64% |
| 🔴 | ... / create-project.ts |
32.35% | 100% | 0% | 32.35% |
| 🔴 | ... / disconnect-wallet.ts |
41.46% | 100% | 25% | 41.46% |
| 🔴 | ... / list-account-boosts.ts |
42.05% | 100% | 25% | 42.05% |
| 🔴 | ... / list-api-keys.ts |
47.95% | 100% | 25% | 47.95% |
| 🔴 | ... / list-deployment-boosts.ts |
42.86% | 100% | 25% | 42.86% |
| 🔴 | ... / list-deployment-indexers.ts |
39.76% | 100% | 25% | 39.76% |
| 🔴 | ... / list-deployments.ts |
42.03% | 100% | 25% | 42.03% |
| 🔴 | ... / list-flex-plans.ts |
37.23% | 100% | 25% | 37.23% |
| 🔴 | ... / list-projects.ts |
42.39% | 100% | 25% | 42.39% |
| 🔴 | ... / remove-api-key.ts |
46.15% | 100% | 25% | 46.15% |
| 🔴 | ... / remove-deployment-boost.ts |
47.47% | 100% | 0% | 47.47% |
| 🔴 | ... / stop-flex-plan.ts |
45.12% | 100% | 25% | 45.12% |
| 🔴 | ... / swap-deployment-boost.ts |
46.85% | 100% | 0% | 46.85% |
| 🔴 | ... / create-deployment.ts |
34.01% | 100% | 25% | 34.01% |
| 🔴 | ... / create-multichain-deployment.ts |
30.99% | 100% | 25% | 30.99% |
| 🔴 | ... / create-project.ts |
52.27% | 100% | 25% | 52.27% |
| 🔴 | ... / delete-deployment.ts |
55.56% | 100% | 25% | 55.56% |
| 🔴 | ... / delete-project.ts |
46.55% | 100% | 25% | 46.55% |
| 🔴 | ... / promote-deployment.ts |
57.58% | 100% | 25% | 57.58% |
| 🟢 | ... / migrate-abis.controller.ts |
95% | 87.5% | 100% | 95% |
| 🟢 | ... / constants.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / index.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / ethereum.ts |
82.72% | 83.33% | 100% | 82.72% |
| 🟢 | ... / migrate-manifest.controller.ts |
88.31% | 73.33% | 88.89% | 88.31% |
| 🟢 | ... / migrate-mapping.controller.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / migrate-controller.ts |
90.63% | 83.33% | 100% | 90.63% |
| 🟢 | ... / migrate.fixtures.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / migrate-schema.controller.ts |
97.23% | 79.22% | 100% | 97.23% |
| 🔴 | ... / types.ts |
0% | 0% | 0% | 0% |
| 🟢 | ... / base-types.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / deployments.generated.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / deploymentsBooster.generated.ts |
100% | 100% | 100% | 100% |
| 🔴 | ... / flexPlan.generated.ts |
0% | 0% | 0% | 0% |
| 🟢 | ... / projects.generated.ts |
100% | 100% | 100% | 100% |
| 🔴 | ... / constants.ts |
40.24% | 100% | 0% | 40.24% |
| 🔴 | ... / client.ts |
29.08% | 100% | 0% | 29.08% |
| 🔴 | ... / consumer-host-service-api.ts |
44.1% | 100% | 0% | 44.1% |
| 🟡 | ... / schemas.ts |
63.93% | 100% | 20% | 63.93% |
| 🔴 | ... / contract-errors.ts |
0% | 0% | 0% | 0% |
| 🔴 | ... / json-file-store.ts |
42.37% | 100% | 0% | 42.37% |
| 🔴 | ... / list-account-boosts.ts |
41.18% | 100% | 0% | 41.18% |
| 🔴 | ... / list-deployment-boosts.ts |
38.33% | 100% | 0% | 38.33% |
| 🔴 | ... / list-deployment-indexers.ts |
46.6% | 100% | 0% | 46.6% |
| 🔴 | ... / list-deployments.ts |
38.33% | 100% | 0% | 38.33% |
| 🔴 | ... / list-flex-plans.ts |
45% | 100% | 0% | 45% |
| 🔴 | ... / list-projects.ts |
46.55% | 100% | 0% | 46.55% |
| 🔴 | ... / utils.ts |
18.18% | 100% | 0% | 18.18% |
| 🔴 | ... / walletconnect-signer.ts |
24.53% | 100% | 0% | 24.53% |
| 🟢 | ... / createProject.fixtures.ts |
95% | 81.82% | 100% | 95% |
| 🟢 | ... / config.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / index.ts |
100% | 100% | 100% | 100% |
| 🟡 | ... / moduleLoader.ts |
60% | 33.33% | 100% | 60% |
| 🟢 | ... / types.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / env.ts |
93.75% | 75% | 100% | 93.75% |
| 🟢 | ... / etherscan.ts |
92.5% | 76.47% | 100% | 92.5% |
| 🟢 | ... / jsonToTable.ts |
93.44% | 90.91% | 100% | 93.44% |
| 🟢 | ... / networkFamily.ts |
92.59% | 88.89% | 100% | 92.59% |
| 🟢 | ... / IPFSHTTPClientLite.ts |
95.59% | 79.17% | 88.89% | 95.59% |
| 🟢 | ... / index.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / utils.ts |
92% | 66.67% | 100% | 92% |
| 🟢 | ... / admin.controller.ts |
98.52% | 96% | 78.57% | 98.52% |
| 🟢 | ... / blockRange.ts |
88.89% | 100% | 80% | 88.89% |
| 🟢 | ... / index.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / blockchain.service.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / SubqueryProject.ts |
96.53% | 83.33% | 83.33% | 96.53% |
| 🟡 | ... / factory.ts |
78.31% | 66.67% | 100% | 78.31% |
| 🟢 | ... / core.module.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / dictionary.fixtures.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / GlobalData.entity.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / monitor.service.ts |
94.4% | 87.21% | 96.97% | 94.4% |
| 🟢 | ... / multiChainRewind.service.ts |
98.02% | 91.67% | 100% | 98.02% |
| 🔴 | ... / sandbox.service.ts |
49.32% | 50% | 33.33% | 49.32% |
| 🟢 | ... / baseCache.service.ts |
94.59% | 91.67% | 83.33% | 94.59% |
| 🟢 | ... / baseStoreModel.service.ts |
93.22% | 84.62% | 100% | 93.22% |
| 🟢 | ... / cacheable.ts |
89.29% | 75% | 100% | 89.29% |
| 🟢 | ... / csvStore.ts |
91.67% | 73.68% | 100% | 91.67% |
| 🟢 | ... / exporter.ts |
91.67% | 71.43% | 71.43% | 91.67% |
| 🟢 | ... / index.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / global.ts |
97.5% | 92.59% | 87.5% | 97.5% |
| 🔴 | ... / index.ts |
0% | 0% | 0% | 0% |
| 🟢 | ... / index.ts |
100% | 100% | 100% | 100% |
| 🟡 | ... / cacheMetadata.ts |
79.57% | 62.5% | 92.86% | 79.57% |
| 🟢 | ... / index.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / metadata.ts |
86.75% | 100% | 66.67% | 86.75% |
| 🟢 | ... / utils.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / cacheModel.ts |
91.84% | 92.22% | 89.47% | 91.84% |
| 🟢 | ... / index.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / model.ts |
95% | 72% | 100% | 95% |
| 🟢 | ... / utils.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / cachePoi.ts |
95.79% | 89.47% | 100% | 95.79% |
| 🟢 | ... / index.ts |
100% | 100% | 100% | 100% |
| 🔴 | ... / poi.ts |
54.46% | 71.43% | 44.44% | 54.46% |
| 🟢 | ... / setValueModel.ts |
85.26% | 80% | 78.57% | 85.26% |
| 🟢 | ... / storeCache.service.ts |
84.18% | 75.76% | 83.33% | 84.18% |
| 🟡 | ... / storeModel.service.ts |
78.02% | 64.29% | 71.43% | 78.02% |
| 🟢 | ... / types.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / utils.ts |
93.33% | 66.67% | 100% | 93.33% |
| 🟢 | ... / worker.core.module.ts |
100% | 100% | 0% | 100% |
| 🔴 | ... / worker.monitor.service.ts |
58.14% | 100% | 0% | 58.14% |
| 🟢 | ... / meta.controller.ts |
86.67% | 100% | 0% | 86.67% |
| 🟡 | ... / meta.module.ts |
60% | 100% | 0% | 60% |
| 🟢 | ... / process.ts |
80.65% | 57.14% | 80% | 80.65% |
| 🔴 | ... / foreceClean.init.ts |
47.62% | 100% | 0% | 47.62% |
| 🔴 | ... / reindex.init.ts |
33.33% | 100% | 0% | 33.33% |
| 🟢 | ... / testing.core.module.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / env.ts |
87.76% | 66.67% | 100% | 87.76% |
| 🟢 | ... / autoQueue.ts |
95.34% | 90.2% | 87.5% | 95.34% |
| 🟢 | ... / index.ts |
100% | 100% | 100% | 100% |
| 🟢 | ... / queue.ts |
87.5% | 92.86% | 83.33% | 87.5% |
| 🟢 | ... / rampQueue.ts |
90.43% | 81.82% | 100% | 90.43% |
| 🟢 | ... / string.ts |
100% | 95.45% | 100% | 100% |
| 🟡 | ... / blockchain.service.ts |
63.13% | 100% | 57.14% | 63.13% |
| 🔴 | ... / datasourceProcessors.ts |
0% | 0% | 0% | 0% |
| 🔴 | ... / index.ts |
0% | 0% | 0% | 0% |
| 🔴 | ... / types.ts |
0% | 0% | 0% | 0% |
| 🔴 | ... / networking.ts |
31.58% | 100% | 0% | 31.58% |
Show files with reduced coverage 🔻
St.❔ |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| 🟡 | ... / index.ts |
71.58% (-20.36% 🔻) |
66.67% (+41.67% 🔼) |
75% (-25% 🔻) |
71.58% (-20.36% 🔻) |
| 🔴 | ... / add.ts |
48.44% (-13.63% 🔻) |
100% | 25% (+25% 🔼) |
48.44% (-13.63% 🔻) |
| 🟢 | ... / publish.ts |
80.49% (-8.85% 🔻) |
53.33% (-3.81% 🔻) |
75% (-25% 🔻) |
80.49% (-8.85% 🔻) |
| 🔴 | ... / add-chain-controller.ts |
40.07% (-0% 🔻) |
66.67% | 30% | 40.07% (-0% 🔻) |
| 🟢 | ... / build-controller.ts |
90% (-1.3% 🔻) |
59.09% (+1.95% 🔼) |
100% | 90% (-1.3% 🔻) |
| 🟢 | ... / codegen-controller.ts |
88.19% (-1.2% 🔻) |
82.05% (+6.47% 🔼) |
100% | 88.19% (-1.2% 🔻) |
| 🔴 | ... / deploy-controller.ts |
54.19% (+16.73% 🔼) |
72.73% (-5.05% 🔻) |
56.25% (+31.25% 🔼) |
54.19% (+16.73% 🔼) |
| 🟢 | ... / generate-controller.ts |
95.66% (-1.99% 🔻) |
90.91% (-3.12% 🔻) |
95.65% (-4.35% 🔻) |
95.66% (-1.99% 🔻) |
| 🟡 | ... / init-controller.ts |
72.46% (+1.98% 🔼) |
54.55% (-13.45% 🔻) |
61.11% (+7.78% 🔼) |
72.46% (+1.98% 🔼) |
| 🟢 | ... / project-controller.ts |
83.13% (-14.13% 🔻) |
42.86% (-17.14% 🔻) |
75% (-25% 🔻) |
83.13% (-14.13% 🔻) |
| 🟢 | ... / publish-controller.ts |
82.63% (+2.38% 🔼) |
67.5% (-3.61% 🔻) |
100% | 82.63% (+2.38% 🔼) |
| 🟢 | ... / http.ts |
90.63% (-2.92% 🔻) |
75% (+8.33% 🔼) |
100% | 90.63% (-2.92% 🔻) |
| 🟡 | ... / utils.ts |
76.15% (-4.93% 🔻) |
82.14% (+1.44% 🔼) |
83.87% (+6.6% 🔼) |
76.15% (-4.93% 🔻) |
| 🟢 | ... / models.ts |
81.11% (-18.33% 🔻) |
94.12% (+1.81% 🔼) |
30.77% (-69.23% 🔻) |
81.11% (-18.33% 🔻) |
| 🟢 | ... / ProjectManifestVersioned.ts |
82.19% (-2.74% 🔻) |
88.89% (-11.11% 🔻) |
61.54% (+3.21% 🔼) |
82.19% (-2.74% 🔻) |
| 🟡 | ... / models.ts |
76.47% (-23.53% 🔻) |
100% | 0% (-100% 🔻) |
76.47% (-23.53% 🔻) |
| 🟡 | ... / load.ts |
64.29% (+5.1% 🔼) |
38.89% (-16.67% 🔻) |
83.33% (+16.67% 🔼) |
64.29% (+5.1% 🔼) |
| 🟢 | ... / local-reader.ts |
100% (+13.95% 🔼) |
100% (+37.5% 🔼) |
83.33% (-16.67% 🔻) |
100% (+13.95% 🔼) |
| 🟢 | ... / reader.ts |
81.58% (-7.89% 🔻) |
50% (-25% 🔻) |
100% | 81.58% (-7.89% 🔻) |
| 🟢 | ... / base.ts |
86.92% (-11.08% 🔻) |
87.5% (-12.5% 🔻) |
44.44% (-35.56% 🔻) |
86.92% (-11.08% 🔻) |
| 🔴 | ... / models.ts |
56.89% (-43.11% 🔻) |
100% | 0% (-100% 🔻) |
56.89% (-43.11% 🔻) |
| 🟢 | ... / NodeConfig.ts |
88.72% (+0.11% 🔼) |
80% (+0.37% 🔼) |
85.19% (-0.86% 🔻) |
88.72% (+0.11% 🔼) |
| 🟢 | ... / ProjectUpgrade.service.ts |
93.29% (+6.22% 🔼) |
90.43% (-0.93% 🔻) |
96% (+4.7% 🔼) |
93.29% (+6.22% 🔼) |
| 🟡 | ... / configure.module.ts |
76.89% (-7.68% 🔻) |
54.76% (-9.24% 🔻) |
100% | 76.89% (-7.68% 🔻) |
| 🟢 | ... / db.module.ts |
89.63% (+1.35% 🔼) |
62.5% (-20.83% 🔻) |
80% | 89.63% (+1.35% 🔼) |
| 🟢 | ... / migration.ts |
86.56% (+4.28% 🔼) |
82.61% (+2.88% 🔼) |
90% (-0.48% 🔻) |
86.56% (+4.28% 🔼) |
| 🟢 | ... / sequelizeUtil.ts |
81.08% (-9.99% 🔻) |
69.23% (-1.14% 🔻) |
62.5% | 81.08% (-9.99% 🔻) |
| 🟢 | ... / StoreOperations.ts |
83.7% (-8.61% 🔻) |
52.94% (-32.06% 🔻) |
100% | 83.7% (-8.61% 🔻) |
| 🟢 | ... / base-block-dispatcher.ts |
84.85% (+37.5% 🔼) |
83.67% (-16.33% 🔻) |
78.26% (+68.26% 🔼) |
84.85% (+37.5% 🔼) |
| 🟢 | ... / worker-block-dispatcher.ts |
92.72% (+42.51% 🔼) |
87.1% (-12.9% 🔻) |
94.12% (+66.84% 🔼) |
92.72% (+42.51% 🔼) |
| 🟢 | ... / coreDictionary.ts |
94.87% (-5.13% 🔻) |
87.5% (-6.94% 🔻) |
87.5% (-12.5% 🔻) |
94.87% (-5.13% 🔻) |
| 🟢 | ... / dictionary.service.ts |
84.18% (-0.96% 🔻) |
80% (-5.71% 🔻) |
90.91% | 84.18% (-0.96% 🔻) |
| 🟢 | ... / utils.ts |
92.59% (-3.7% 🔻) |
69.23% (-24.89% 🔻) |
100% | 92.59% (-3.7% 🔻) |
| 🟢 | ... / dictionaryV1.ts |
88.02% (-5.21% 🔻) |
73.81% (-4.45% 🔻) |
100% | 88.02% (-5.21% 🔻) |
| 🔴 | ... / ds-processor.service.ts |
41.52% (-20.57% 🔻) |
73.33% (-1.67% 🔻) |
63.64% (-23.86% 🔻) |
41.52% (-20.57% 🔻) |
| 🟢 | ... / dynamic-ds.service.ts |
90.85% (+0.65% 🔼) |
63.64% (-3.03% 🔻) |
90% (+4.29% 🔼) |
90.85% (+0.65% 🔼) |
| 🟢 | ... / inMemoryCache.service.ts |
100% | 100% | 75% (-25% 🔻) |
100% |
| 🔴 | ... / indexer.manager.ts |
32.75% (-0.46% 🔻) |
100% | 10% (-2.5% 🔻) |
32.75% (-0.46% 🔻) |
| 🟢 | ... / PoiBlock.ts |
80.65% (-17.74% 🔻) |
57.89% (-38.66% 🔻) |
75% (-25% 🔻) |
80.65% (-17.74% 🔻) |
| 🟡 | ... / poi.service.ts |
68.28% (+44.36% 🔼) |
57.69% (-42.31% 🔻) |
88.89% (+60.32% 🔼) |
68.28% (+44.36% 🔼) |
| 🔴 | ... / store.ts |
45.98% (+13.77% 🔼) |
62.5% (-37.5% 🔻) |
33.33% (+33.33% 🔼) |
45.98% (+13.77% 🔼) |
| 🔴 | ... / testing.service.ts |
27.22% (-1.35% 🔻) |
100% | 0% | 27.22% (-1.35% 🔻) |
| 🟢 | ... / unfinalizedBlocks.service.ts |
84.71% (+0.73% 🔼) |
95% (-1.72% 🔻) |
95.45% (+3.79% 🔼) |
84.71% (+0.73% 🔼) |
| 🟡 | ... / worker.builder.ts |
79.15% (-0.04% 🔻) |
65.38% | 70.59% (-9.41% 🔻) |
79.15% (-0.04% 🔻) |
| 🟢 | ... / worker.service.ts |
93.16% (+48.52% 🔼) |
84.62% (-15.38% 🔻) |
100% (+100% 🔼) |
93.16% (+48.52% 🔼) |
| 🔴 | ... / worker.ts |
42.13% (-0.32% 🔻) |
100% | 0% | 42.13% (-0.32% 🔻) |
| 🟡 | ... / worker.unfinalizedBlocks.service.ts |
64.91% (-35.09% 🔻) |
100% | 0% (-100% 🔻) |
64.91% (-35.09% 🔻) |
| 🔴 | ... / event.listener.ts |
53.54% (-27.27% 🔻) |
100% | 0% (-25% 🔻) |
53.54% (-27.27% 🔻) |
| 🔴 | ... / health.controller.ts |
55.17% | 100% | 0% (-50% 🔻) |
55.17% |
| 🔴 | ... / health.service.ts |
51.32% (-6.22% 🔻) |
100% | 0% (-20% 🔻) |
51.32% (-6.22% 🔻) |
| 🟡 | ... / meta.service.ts |
68.52% (-1.01% 🔻) |
100% (+20% 🔼) |
0% (-40% 🔻) |
68.52% (-1.01% 🔻) |
| 🔴 | ... / ready.controller.ts |
56.52% | 100% | 0% (-50% 🔻) |
56.52% |
| 🟡 | ... / ready.service.ts |
75% (-16.67% 🔻) |
100% | 0% (-66.67% 🔻) |
75% (-16.67% 🔻) |
| 🟡 | ... / blocks.ts |
69.7% (-30.3% 🔻) |
84.62% (-4.27% 🔻) |
75% (-25% 🔻) |
69.7% (-30.3% 🔻) |
| 🟡 | ... / project.ts |
72.94% (-0.44% 🔻) |
75.41% (+0.83% 🔼) |
76.47% (-1.31% 🔻) |
72.94% (-0.44% 🔻) |
| 🟢 | ... / promise.ts |
94.92% (+3.15% 🔼) |
100% (+13.64% 🔼) |
71.43% (-14.29% 🔻) |
94.92% (+3.15% 🔼) |
| 🟡 | ... / reindex.ts |
73.33% (+39.29% 🔼) |
10% (-90% 🔻) |
100% (+100% 🔼) |
73.33% (+39.29% 🔼) |
| 🔴 | ... / yargs.ts |
44.68% (-0.81% 🔻) |
100% | 14.29% | 44.68% (-0.81% 🔻) |
| 🟢 | ... / api.service.ts |
87.2% (+3.69% 🔼) |
81.25% (+9.03% 🔼) |
80% (-6.67% 🔻) |
87.2% (+3.69% 🔼) |
| 🟢 | ... / apiPromise.connection.ts |
80% (+10.92% 🔼) |
61.54% (-18.46% 🔻) |
66.67% (+23.81% 🔼) |
80% (+10.92% 🔼) |
| 🔴 | ... / index.ts |
0% (-100% 🔻) |
0% (-100% 🔻) |
0% (-100% 🔻) |
0% (-100% 🔻) |
| 🟢 | ... / substrateDictionary.service.ts |
93.52% (+2.95% 🔼) |
38.46% (-34.27% 🔻) |
100% (+20% 🔼) |
93.52% (+2.95% 🔼) |
| 🔴 | ... / types.ts |
0% (-100% 🔻) |
0% (-100% 🔻) |
0% (-100% 🔻) |
0% (-100% 🔻) |
| 🟢 | ... / substrateDictionaryV1.ts |
85.33% (-0.15% 🔻) |
78.26% (+8.49% 🔼) |
84.62% (+1.28% 🔼) |
85.33% (-0.15% 🔻) |
| 🟡 | ... / substrateDictionaryV2.ts |
70.79% (-4.72% 🔻) |
50% (-25% 🔻) |
33.33% | 70.79% (-4.72% 🔻) |
| 🔴 | ... / indexer.manager.ts |
47.96% (-9.58% 🔻) |
100% | 16.67% (+7.58% 🔼) |
47.96% (-9.58% 🔻) |
| 🟢 | ... / runtimeService.ts |
95.29% (+3.09% 🔼) |
81.82% (-7.07% 🔻) |
100% (+20% 🔼) |
95.29% (+3.09% 🔼) |
| 🟡 | ... / types.ts |
70.45% (-14.84% 🔻) |
100% | 0% | 70.45% (-14.84% 🔻) |
| 🟢 | ... / project.ts |
88.73% (-0.16% 🔻) |
68.18% | 87.5% | 88.73% (-0.16% 🔻) |
| 🟢 | ... / buffer.ts |
95.12% (-4.88% 🔻) |
95.83% (-4.17% 🔻) |
90.48% (+6.27% 🔼) |
95.12% (-4.88% 🔻) |
| 🟢 | ... / builder.ts |
93.02% (+0.25% 🔼) |
82.14% (-0.62% 🔻) |
100% | 93.02% (+0.25% 🔼) |
| 🟡 | ... / Bytes.ts |
75% (+5% 🔼) |
50% (-50% 🔻) |
100% | 75% (+5% 🔼) |
Test suite run success
702 tests passing in 116 suites.
Report generated by 🧪jest coverage report action from 459b713
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/node-core/src/indexer/storeModelProvider/storeModel.service.spec.ts (1)
40-40: LGTM! Mock addition supports the production code changes.The
getAttributesmock correctly enables the production code to callmodel.getAttributes()without errors. Since this test suite doesn't validateupdateOnDuplicatebehavior, returning an empty object is acceptable.For consistency with
storeCache.service.spec.ts(which returns{id: null, field1: null}), consider returning actual attribute keys if these tests expand to coverbulkCreatescenarios:- getAttributes: jest.fn(() => ({})), + getAttributes: jest.fn(() => ({id: null, field1: null})),packages/node-core/src/indexer/storeModelProvider/model/cacheModel.spec.ts (1)
62-62: LGTM! Mock addition supports the production code changes.The
getAttributesmock is correctly added to prevent errors when production code callsmodel.getAttributes().For consistency with
storeCache.service.spec.tsand better test coverage, consider returning actual attribute keys:- getAttributes: jest.fn(() => ({})), + getAttributes: jest.fn(() => ({id: null, field1: null})),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/node-core/src/indexer/storeModelProvider/model/cacheModel.spec.ts(3 hunks)packages/node-core/src/indexer/storeModelProvider/storeCache.service.spec.ts(1 hunks)packages/node-core/src/indexer/storeModelProvider/storeModel.service.spec.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: code-style
- GitHub Check: Coverage report
🔇 Additional comments (2)
packages/node-core/src/indexer/storeModelProvider/model/cacheModel.spec.ts (1)
201-201: LGTM! Good cleanup of unnecessary linter suppressions.The removed eslint-disable comments are appropriate to remove. The non-null assertions are safe in this test context since the tests explicitly validate that these entities exist, and the tests would fail anyway if they were undefined.
Also applies to: 213-213
packages/node-core/src/indexer/storeModelProvider/storeCache.service.spec.ts (1)
44-44: LGTM! Correctly implements the mock to validate the updateOnDuplicate fix.The
getAttributesmock properly returns all model attribute keys ({id: null, field1: null}), which enables the test at line 241 to validate thatupdateOnDuplicate: ['id', 'field1']includes all fields, not just those from the first entity. This correctly tests the PR's bug fix.
Description
Fixes
updateOnDuplicateonly using the keys of the first entity in the data, this would cause issues of other fields not being updated on subsequent entities. It now uses all the columns on the model.Type of change
Please delete options that are not relevant.
Checklist
Summary by CodeRabbit
Bug Fixes
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.