Repository navigation
Batch D (P2): collection pagination (#1430) + transactional bulk_delete (#1433) + bulk_update merge (#1434) - #1459
Conversation
|
REQUEST CHANGES Solid work on #1433 and #1434 — but the headline #1430 fix is built on a method that doesn't do what the PR claims, and it introduces an unbounded full-table scan on every collection query. Blocker — #1430:
Net effect: the collection branch sets Required fix (one of):
Either way, add a test that fails under the current implementation — e.g. create Looks correct:
Community impact: all changes are shared-core data layer (not Pro-gated). #1433/#1434 are behavior-preserving; the #1430 change alters shared query behavior and adds the unbounded-scan regression above — resolve before it lands in the community build. Nit: the "re-intersect defensively" comment ( CI: no checks on the branch; the local suite is exactly what masks the #1430 scope bug. |
…ge (closes #1430, closes #1433, closes #1434) Three P2 bulk/query data-integrity fixes. is filtered in memory AFTER the query, so offset paginated the wrong (unfiltered) set and a fixed 1000 over-fetch dropped members outside the newest 1000 rows. Scope the query to the collection's members via NodeFilter::with_ids (bounded) and apply offset/limit in memory after the membership filter; short-circuit empty collections. store.delete_node (each its own autocommit), so the Nth failing left the first N-1 committed. Add a transactional store.bulk_delete (single tx, FK cascade, one Deleted event per node post-commit) and route the service through it. and wholesale-REPLACED (un-normalized) properties, diverging from single-update and silently no-opping property-change automation. Normalize + deep-merge like update_node, validate the merged candidate, persist the merged value, and emit the real changed_properties (compute_property_changes). Tests: collection pagination over members vs global set; transactional multi-delete; bulk_update merge + non-empty changed_properties. Updated the existing partial-fields test to the new merge+normalize contract. Full core suite green; free-users 7/7. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The previous `with_ids` was a no-op — `NodeQuery` had no `ids` field, the NodeFilter→NodeQuery conversion dropped the plural `ids`, and `query_nodes` built no `id IN (…)` clause. Combined with dropping the SQL limit for the collection case, that made a collection-scoped query a `SELECT * FROM node` full-table scan (correct only because of the in-memory membership filter) — a regression versus the old bounded over-fetch. Honor ids end to end: - add `ids: Option<Vec<String>>` to `NodeQuery`; - carry `NodeFilter.ids` through the NodeFilter→NodeQuery conversion; - build a chunked `id IN (?, …)` clause in `query_nodes` (chunked at 900 to stay under SQLite's bound-parameter ceiling; order_by + limit/offset are applied in memory by the caller, so per-chunk order is irrelevant). The collection query is now bounded by the member set, not the whole table. Corrected the misleading "(bounded)" / "re-intersect defensively" comments (the in-memory intersect is now a genuine defensive double-check). New test `test_collection_query_returns_members_despite_many_newer_nonmembers` asserts members are still returned with 25 newer non-members present — it fails under a capped-global-limit approach and the old fixed-1000 over-fetch. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Review addressed — you were exactly right on #1430. Fixed end-to-end:
The collection query is now bounded by the member set, not the whole table. Corrected the misleading "(bounded)"/"defensively" comments. New test Rebased onto current main (your #1453/#1457/#1458 landed). Verified: core lib 964, event_emission 11 (both collection tests), clippy --tests -D warnings + fmt clean. #1433/#1434 unchanged. Ready for re-review. |
|
APPROVE (re-review @ 888fe68) The #1430 blocker is fully resolved — you took Option 1 and wired real id-scoping end-to-end. Verified:
And the test gap is closed with the exact regression I asked for: #1433 (transactional |
Summary
Phase 1 bug-sweep Batch D (P2), core bulk/query fixes.
#1430— collection pagination paginated the wrong setCollection-filtered queries pushed
offset/limitto SQL, but membership is filtered in memory after the query — sooffset>0paged the unfiltered set and a fixed 1000 over-fetch silently dropped members outside the newest 1000 rows.Fix: scope the query to the collection's members (
NodeFilter::with_ids, bounded) and applyoffset/limitin memory after the membership filter; short-circuit empty collections.#1433— bulk_delete was not transactionalDocumented all-or-nothing, but looped
store.delete_node(each its own autocommit) → the Nth failing left the first N-1 committed.Fix: new transactional
store.bulk_delete(single tx, FK cascade, oneDeletedevent per node post-commit); service routes through it.#1434— bulk_update empty changed_properties + wholesale replaceEmitted
NodeUpdatedwith hardcoded emptychanged_propertiesand wholesale-replaced (un-normalized) properties, diverging from single-update and no-opping property-change automation.Fix: normalize + deep-merge like
update_node, validate the merged candidate, persist the merged value, emit the realchanged_properties.Tests
partial_fields_preserves_unspecifiedtest to the new merge+normalize contract (it encoded the old wholesale-replace behavior [bug]bulk_updateemitsNodeUpdatedwith emptychanged_propertiesand replaces (not merges) properties #1434 fixes).clippy --tests -D warnings/fmtclean;test:free-users7/7.Free/community impact
Community-build fixes (core data layer) — additive correctness; free-users green.
Closes #1430, closes #1433, closes #1434.