Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Non-blocking findings from the auto code review of PR #607 (hotfix(imports): flush new Products before staging items (FK violation from #606)) — captured for batch cleanup rather than blocking the PR.
Commit
46fdcb1· https://github.com/Gambit-Inc/gambit/pull/607SHOULD-FIX:
backend/app/services/import_stage.py:271: the fix relies on a baredb.flush()before the items are added. That works only because the newProductrows are already pending in the session whenstage_rowsreaches the end. If_find_product_for_batch_itemorBatchProductCacheever flushes or commits internally, or if aProductinsert fails, the failure surfaces at this line. The ordering is undocumented and easy to break. A regression test that asserts the insert order and the FK enforcement also exists (the SQLite FK pragma), but only in the three test files touched here. Other test modules that callstage_rowson SQLite still run with FKs off, so they cannot catch this class of bug.backend/app/services/import_stage.py:263:itemsgrows to hold everyIntakeBatchItemfor the whole call. This is an 8k-row commit, so the objects are held either way and there is no real regression. But ifstage_rowsis ever called with far larger row lists, you now hold both the list and the session identity map. This is only worth noting; no action is needed now.NITS:
none
Filed from a Claude Code session