You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(V2): address bugbot review of CSV batch staging
Fix two findings flagged by Cursor Bugbot on the CSV batch upload
consolidation path:
1. Keep the staging row's uuid column in sync with the entity PK when
stageConsolidatedCsvRecord updates an existing pending row. The
staging convention is uuid === entity PK, and downstream commit
logic uses it as the datalayer changelist key; a stale uuid from a
prior staging row (e.g. one written by a different code path) would
produce the wrong changelist entry.
2. Collapse the per-CSV-row staging scans from three to one.
buildPendingCsvMergeBase now issues a single query covering DELETE,
INSERT, and UPDATE actions and buckets results client-side. The
INSERT/UPDATE rows are passed through to stageConsolidatedCsvRecord
via a new pendingRows option so it no longer re-scans the staging
table. For N CSV rows with M pending staging records this drops the
work from O(3*N*M) full scans + JSON parses to O(N*M).
Also add regression assertions to the existing "merge CSV updates into
an already-staged ... update" integration tests that verify the
staging row's uuid column equals the entity PK after consolidation,
so a silent revert of the uuid fix would fail CI.
0 commit comments