WFDASH-WEBAPP/src/lib
Dave acaec3f5c7 fix(stock): compensate the ledger row when the quantity write fails
The write service puts the stock_ledger row first and then patches
current_qty. When that second write failed, the ledger row was left
behind: the ledger sat one change ahead of the quantity, and a retry
wrote a second row for the same change, so SUM(change_qty) no longer
rebuilt current_qty — the premise a drift-repair job rests on.

The failed write is now compensated with a ledger row for the same
item carrying the opposite change_qty, stamped with the same actor
and noted as a reversal of the adjustment. If the compensation itself
fails, the row is still reported as failed with a message that says
the ledger could not be reversed. The failed row's message says when
the ledger was compensated, so a retry is safe.

The ledger-first ordering is unchanged — it is what makes a crash
between the two writes leave the audit trail ahead of the cached
total.
2026-11-05 22:25:03 +02:00
..
pdf fix(pdf): add the missing email_to to the quote fixtures 2026-11-05 00:40:47 +02:00
reports
scan
server fix(stock): compensate the ledger row when the quantity write fails 2026-11-05 22:25:03 +02:00
audit-fetch.test.ts
audit-fetch.ts
audit-format.test.ts
audit-format.ts
collection-ai-card.test.ts fix(pos): never sell or list an item at R0; customer lines go to the price list 2026-10-31 09:56:03 +02:00
collection-ai-card.ts fix(pos): never sell or list an item at R0; customer lines go to the price list 2026-10-31 09:56:03 +02:00
collection-ai-ticks.test.ts feat(collection-confirm): check printed prices on delivery notes; show AI reading notes 2026-10-19 13:50:27 +02:00
collection-ai-ticks.ts feat(collection-confirm): check printed prices on delivery notes; show AI reading notes 2026-10-19 13:50:27 +02:00
collection-driver-verdict.test.ts feat(driver): read-only invoice check endpoint for the driver app 2026-10-21 19:38:38 +02:00
collection-driver-verdict.ts feat(driver): read-only invoice check endpoint for the driver app 2026-10-21 19:38:38 +02:00
company-letterhead.test.ts Lock quote letterheads to customer companies 2026-10-31 10:20:23 +02:00
company-letterhead.ts Lock quote letterheads to customer companies 2026-10-31 10:20:23 +02:00
currency.ts feat: add item supplier payments and approvals queue 2026-11-03 01:27:07 +02:00
delivery-note-stage.test.ts
delivery-note-stage.ts
delivery-pool.test.ts feat(delivery-pool): assign invoiced deliveries to drivers, close with the signed copy 2026-10-31 09:55:35 +02:00
delivery-pool.ts Lock quote letterheads to customer companies 2026-10-31 10:20:23 +02:00
dev-identity.test.ts
dev-identity.ts
file-fields.test.ts
file-fields.ts
geo.test.ts
geo.ts
giellie-image.ts
giellie-sse.test.ts
giellie-sse.ts
giellie-types.ts
item-match-text.ts feat(pos-match): one size-aware shortlist for the whole app 2026-10-24 22:52:48 +02:00
item-size.test.ts fix(pos-match): our size check backs the AI's "exact"; rank fixes from the live POS 2026-10-24 23:22:47 +02:00
item-size.ts fix(pos-match): our size check backs the AI's "exact"; rank fixes from the live POS 2026-10-24 23:22:47 +02:00
item-status-ui.settled.test.ts feat(manager): a mobile orders board for the managers at /manager 2026-10-26 23:09:01 +02:00
item-status-ui.test.ts
item-status-ui.ts feat(manager): a mobile orders board for the managers at /manager 2026-10-26 23:09:01 +02:00
letterhead.test.ts
letterhead.ts
note-feed.test.ts feat(collection-pool): back-to-pending, collection date, and a safe notes feed 2026-10-16 00:44:49 +02:00
note-feed.ts feat(collection-pool): back-to-pending, collection date, and a safe notes feed 2026-10-16 00:44:49 +02:00
order-age.test.ts
order-age.ts
order-ai-match-tint.test.ts feat(orders): tint New-tab cards by the AI quote match 2026-10-24 20:52:59 +02:00
order-ai-match-tint.ts feat(orders): tint New-tab cards by the AI quote match 2026-10-24 20:52:59 +02:00
order-assistant-review.test.ts feat(orders): purple review for AI-filled order lines 2026-10-24 14:25:11 +02:00
order-assistant-review.ts feat(orders): purple review for AI-filled order lines 2026-10-24 14:25:11 +02:00
order-assistant-save.test.ts feat(orders): purple review for AI-filled order lines 2026-10-24 14:25:11 +02:00
order-assistant-save.ts feat(orders): purple review for AI-filled order lines 2026-10-24 14:25:11 +02:00
order-color.test.ts
order-color.ts
order-invoices.test.ts
order-invoices.ts
order-item-qty.test.ts
order-item-qty.ts
order-payment-client.ts feat: add item supplier payments and approvals queue 2026-11-03 01:27:07 +02:00
order-payments.ts feat: add item supplier payments and approvals queue 2026-11-03 01:27:07 +02:00
order-rep.test.ts
order-rep.ts
pb-helpers-duplicate.test.ts
pb-helpers.ts fix: number customer POs one at a time (duplicate PO numbers) 2026-10-19 15:08:12 +02:00
pin-model.test.ts
placeholder-customers.ts
po-reference.ts feat(collection-confirm): spot a photo on the wrong PO and move it 2026-10-19 14:08:47 +02:00
pocketbase.ts
pos-cart-quantity.test.ts fix(pos): dead discount toggle + stale discount figure, lift dark palette 2026-10-12 23:17:57 +02:00
pos-inline-handlers.test.ts
pos-search.test.ts feat(pos): tiered catalog search — word order, plurals, glued SKUs 2026-10-06 23:36:12 +02:00
price-check.test.ts feat(price-check): say whether the POS item is exact or only closest 2026-10-24 23:05:09 +02:00
price-check.ts feat(price-check): say whether the POS item is exact or only closest 2026-10-24 23:05:09 +02:00
price-list-search.ts
quote-assistant-counts-client.test.ts feat(quote-assistant): AI x/y badge on quotes board 2026-10-16 20:01:43 +02:00
quote-assistant-counts-client.ts feat(quote-assistant): AI x/y badge on quotes board 2026-10-16 20:01:43 +02:00
quote-assistant-merge.test.ts fix(quote-assistant): AI fill on Process page keeps unsaved typing 2026-10-16 23:29:04 +02:00
quote-assistant-merge.ts fix(quote-assistant): AI fill on Process page keeps unsaved typing 2026-10-16 23:29:04 +02:00
quote-assistant-review.test.ts fix(quote-assistant): review minors (templates, forced order, bounds, UI) 2026-10-16 23:41:28 +02:00
quote-assistant-review.ts fix(quote-assistant): review minors (templates, forced order, bounds, UI) 2026-10-16 23:41:28 +02:00
quote-assistant-save.test.ts feat(quote-assistant): purple AI lines on process and quote pages 2026-10-16 19:56:02 +02:00
quote-assistant-save.ts feat(quote-assistant): purple AI lines on process and quote pages 2026-10-16 19:56:02 +02:00
quote-pricing.test.ts feat(delivery-notes): lock the cost price, markup stays the only input 2026-10-15 15:44:24 +02:00
quote-pricing.ts feat(delivery-notes): lock the cost price, markup stays the only input 2026-10-15 15:44:24 +02:00
quote-status.test.ts
quote-status.ts feat(theme): the picker reads the real palette, not a hand-kept copy 2026-11-05 00:40:40 +02:00
release-notes.test.ts refactor(release-notes): drop the date field from the release registry 2026-11-05 01:19:50 +02:00
release-notes.ts docs(whats-new): reword the release 6 bullet 2026-11-05 01:34:42 +02:00
rep-visibility.test.ts
rep-visibility.ts
repair-document-stage.test.ts
repair-document-stage.ts
safe-next-path.ts
short-collection.test.ts feat(collection): split short pickups on confirm, stop re-billing 2026-10-22 04:04:50 +02:00
short-collection.ts feat(collection): split short pickups on confirm, stop re-billing 2026-10-22 04:04:50 +02:00
sops.ts
stock-fulfillment.test.ts
stock-fulfillment.ts
stock-low-stock.ts
stock-match.ts
stock-status.test.ts
stock-status.ts
supplier-color.test.ts
supplier-color.ts
theme-types.ts feat(theme): the picker reads the real palette, not a hand-kept copy 2026-11-05 00:40:40 +02:00
themes.ts feat(theme): the picker reads the real palette, not a hand-kept copy 2026-11-05 00:40:40 +02:00
tracker-parsing.test.ts
tracker-parsing.ts
types.ts feat: add item supplier payments and approvals queue 2026-11-03 01:27:07 +02:00
use-boolean-preference.ts
use-split-ratio.test.ts
use-split-ratio.ts
use-theme-id.ts feat(theme): the picker reads the real palette, not a hand-kept copy 2026-11-05 00:40:40 +02:00
user-color.ts
utils.test.ts
utils.ts
visit-matching.test.ts
visit-matching.ts
visit-stops.test.ts
visit-stops.ts
working-days.ts