WFDASH-WEBAPP/src/lib/server
Dave cefa52c3e3 fix(orders): chunk the fuzzy matcher's quote_items fetch, don't blow the filter length
fuzzyPass built a single `quote = "x" || quote = "y" || ...` OR-chain
across up to FUZZY_CANDIDATE_CAP (200) candidate quotes to fetch their
items. The predecessor in pb-helpers.ts documents exactly why that
doesn't scale: PB's filter expression has a max length, and a naive
OR-chain 400s past roughly 50 ids. There was no try/catch, so
getFullList's rejection propagated straight out of
suggestQuoteForOrder - the matcher failed outright for precisely the
high-volume companies where auto-matching matters most.

Reuse fetchQuoteItemsForQuotesAdmin (now exported from
quotes-service.ts) instead of a third copy of the same chunking logic.
It already does this for the duplicate-quote scan: try PB's `IN (...)`
syntax first, fall back to 80-id chunked OR-chains on rejection.

Adds a regression test that simulates PB rejecting an oversized filter
across 100 candidate quotes and asserts the fetch recovers via
multiple chunked calls rather than rejecting outright. Confirmed it
fails against the pre-fix code (uncaught rejection propagates out of
suggestQuoteForOrder) before verifying it passes against the fix.
2026-08-29 13:32:23 +02:00
..
agent-auth.test.ts
agent-auth.ts
ai-settings-service.ts feat: add AI quote processing pipeline and admin settings UI 2026-08-09 16:17:29 +02:00
ai-system-prompt.ts feat: add AI quote processing pipeline and admin settings UI 2026-08-09 16:17:29 +02:00
attachment-extractor.ts feat: add AI quote processing pipeline and admin settings UI 2026-08-09 16:17:29 +02:00
boss-dashboard-service.test.ts test(boss-dashboard): honour expand in mock + assert customer name in rep activity 2026-08-28 00:02:02 +02:00
boss-dashboard-service.ts fix(boss-dashboard): guard fetch races, surface errors, tighten response type 2026-08-28 00:19:12 +02:00
browser-session.ts feat(orders): show resolved sales rep name on order list and sprint 2026-08-04 08:50:54 +02:00
buyer-tasks-service.test.ts feat(quotes): enhance scoring logic to include price matching 2026-08-24 07:09:39 +02:00
buyer-tasks-service.ts feat(quotes): enhance scoring logic to include price matching 2026-08-24 07:09:39 +02:00
collection-confirm-service.test.ts feat(collection-confirm): update stock item filtering logic in listCollectedItems 2026-08-17 08:27:36 +02:00
collection-confirm-service.ts feat(collection-confirm): update stock item filtering logic in listCollectedItems 2026-08-17 08:27:36 +02:00
collection-confirm-upload.test.ts feat: add new order, invoice, and dashboard management tools 2026-08-05 23:00:54 +02:00
completed-window.test.ts feat(quotes): enhance scoring logic to include price matching 2026-08-24 07:09:39 +02:00
counter-service.ts feat(counter): add standalone counter order PWA 2026-08-13 09:27:20 +02:00
customers-service.test.ts feat(tv): add TV dashboard + refine workflows 2026-08-13 20:55:22 +02:00
customers-service.ts feat(mcp): add walk-in quote creation and enhance customer filtering 2026-08-15 11:50:48 +02:00
dashboard-service.test.ts feat: add new order, invoice, and dashboard management tools 2026-08-05 23:00:54 +02:00
dashboard-service.ts feat: add new order, invoice, and dashboard management tools 2026-08-05 23:00:54 +02:00
deliveries-service.test.ts feat(deliveries): enhance delivery notes management and UI 2026-08-17 01:27:03 +02:00
deliveries-service.ts feat(deliveries): enhance delivery notes management and UI 2026-08-17 01:27:03 +02:00
delivery-notes-service.test.ts feat(orders): enhance order handling with email_message_id deduplication and displayContactName utility 2026-08-21 19:18:02 +02:00
delivery-notes-service.ts feat(orders): enhance order handling with email_message_id deduplication and displayContactName utility 2026-08-21 19:18:02 +02:00
driver-stops.ts feat(delivery-notes): standardize delivery-note letterhead across PDFs 2026-08-18 11:53:25 +02:00
item-history-service.test.ts
item-history-service.ts feat(context): implement getOrderItemContext (5 PB reads, fuzzy fallback) 2026-08-07 02:34:45 +02:00
item-intel-service.ts feat(mcp): implement structured MCP error handling for upstream fetches 2026-08-15 22:32:11 +02:00
management-service.ts
mcp-upstream-fetch.test.ts feat(mcp): implement structured MCP error handling for upstream fetches 2026-08-15 22:32:11 +02:00
mcp-upstream-fetch.ts feat(mcp): implement structured MCP error handling for upstream fetches 2026-08-15 22:32:11 +02:00
order-completion.test.ts
order-completion.ts
order-item-context-service.test.ts test(context): getOrderItemContext unit tests (null, quote, stock low/out, invoiced) 2026-08-07 02:42:57 +02:00
order-item-context-service.ts chore(context): lint + build adjustments 2026-08-07 03:04:28 +02:00
order-item-margin-approval-service.test.ts fix: resolve PO bug, add sku, improve webhooks 2026-08-06 13:13:57 +02:00
order-item-margin-approval-service.ts fix: resolve PO bug, add sku, improve webhooks 2026-08-06 13:13:57 +02:00
order-item-status.test.ts
order-item-status.ts feat(order-items): below-22% margin approval workflow 2026-08-04 00:58:33 +02:00
order-items-service.test.ts feat(order-splitting): enhance order item splitting functionality and error handling 2026-08-17 14:14:27 +02:00
order-items-service.ts feat(order-splitting): enhance order item splitting functionality and error handling 2026-08-17 14:14:27 +02:00
order-quote-link-service.test.ts fix(orders): chunk the fuzzy matcher's quote_items fetch, don't blow the filter length 2026-08-29 13:32:23 +02:00
order-quote-link-service.ts fix(orders): chunk the fuzzy matcher's quote_items fetch, don't blow the filter length 2026-08-29 13:32:23 +02:00
order-quote-match.test.ts fix(orders): parse PocketBase date format explicitly in the matcher 2026-08-29 13:20:40 +02:00
order-quote-match.ts fix(orders): parse PocketBase date format explicitly in the matcher 2026-08-29 13:20:40 +02:00
orders-service-review.test.ts chore(tests): fix ~60 pre-existing TS errors across 11 test files 2026-08-27 04:43:40 +02:00
orders-service.test.ts chore(tests): fix ~60 pre-existing TS errors across 11 test files 2026-08-27 04:43:40 +02:00
orders-service.ts feat(api): enhance order creation with optional email metadata fields 2026-08-28 13:00:31 +02:00
po-email-template.ts
po-number.test.ts feat: add server-side quote search & PO number format update 2026-08-14 11:15:38 +02:00
po-number.ts feat: add server-side quote search & PO number format update 2026-08-14 11:15:38 +02:00
pocketbase-admin.test.ts feat: add new order, invoice, and dashboard management tools 2026-08-05 23:00:54 +02:00
pocketbase-admin.ts feat: add AI quote processing pipeline and admin settings UI 2026-08-09 16:17:29 +02:00
price-list-match.test.ts
price-list-match.ts
price-list-service.test.ts feat(mcp): add price_list.add_items tool for agent-driven catalogue upsert 2026-08-10 12:45:05 +02:00
price-list-service.ts feat(mcp): add price_list.add_items tool for agent-driven catalogue upsert 2026-08-10 12:45:05 +02:00
purchase-order-agent-service.test.ts feat(collection-confirm): add stock item edits 2026-08-14 16:39:46 +02:00
purchase-order-agent-service.ts feat(collection-confirm): add stock item edits 2026-08-14 16:39:46 +02:00
purchase-orders-service.test.ts feat(po): resend purchase order from sent / mail_failed / sending statuses 2026-08-04 20:05:52 +02:00
purchase-orders-service.ts feat(po): resend purchase order from sent / mail_failed / sending statuses 2026-08-04 20:05:52 +02:00
quote-email-template.ts feat(quotes): add approval page and email updates 2026-08-11 16:09:40 +02:00
quote-items-insights-service.test.ts feat: add AI quote processing pipeline and admin settings UI 2026-08-09 16:17:29 +02:00
quote-items-insights-service.ts feat: add AI quote processing pipeline and admin settings UI 2026-08-09 16:17:29 +02:00
quote-items-service.test.ts feat(mcp): add walk-in quote creation and enhance customer filtering 2026-08-15 11:50:48 +02:00
quote-items-service.ts feat(quotes): enhance quotes.submit functionality and error handling 2026-08-15 23:57:51 +02:00
quoted-before-service.test.ts feat(quotes): add quote-level "Quoted before?" panel to the process page 2026-08-29 08:52:19 +02:00
quoted-before-service.ts feat(quotes): add quote-level "Quoted before?" panel to the process page 2026-08-29 08:52:19 +02:00
quotes-ai-processor.ts feat: add AI quote processing pipeline and admin settings UI 2026-08-09 16:17:29 +02:00
quotes-from-email-service.ts feat(quotes): add person_hint for customer resolution in forwarded emails 2026-08-27 11:11:44 +02:00
quotes-search-service.test.ts feat(quotes): enhance search functionality and user experience 2026-08-28 20:13:44 +02:00
quotes-search-service.ts feat(quotes): enhance search functionality and user experience 2026-08-28 20:13:44 +02:00
quotes-service.test.ts feat(quotes): add repeat-request detection service 2026-08-29 08:42:37 +02:00
quotes-service.ts fix(orders): chunk the fuzzy matcher's quote_items fetch, don't blow the filter length 2026-08-29 13:32:23 +02:00
repairs-service.ts fix(repair-details): update file handling and type definitions 2026-08-21 01:13:44 +02:00
stock-booking-service.test.ts feat: add split views, stock picking slips, and invoice viewer 2026-08-09 23:16:55 +02:00
stock-booking-service.ts feat: add split views, stock picking slips, and invoice viewer 2026-08-09 23:16:55 +02:00
stock-cost-service.ts feat: unify buyer task flows by supporting both customer orders and stock purchases in mark-ready API and UI, and fix PDF table layout responsiveness. 2026-08-03 18:52:30 +02:00
stock-items-service.test.ts feat: add split-invoice stock PO workflow and supporting tooling 2026-08-07 00:53:29 +02:00
stock-items-service.ts feat: add split-invoice stock PO workflow and supporting tooling 2026-08-07 00:53:29 +02:00
stock-out.ts
stock-purchase-invoice-matching-service.test.ts feat(mcp): expand stock purchase invoice matching service with 5 phases 2026-08-09 20:23:36 +02:00
stock-purchase-invoice-matching-service.ts feat: add split views, stock picking slips, and invoice viewer 2026-08-09 23:16:55 +02:00
stock-purchase-items-service.test.ts chore(tests): fix ~60 pre-existing TS errors across 11 test files 2026-08-27 04:43:40 +02:00
stock-purchase-items-service.ts feat(collection-confirm): add quantity collection handling and deduplication improvements 2026-08-17 02:17:27 +02:00
stock-purchases-migration.test.ts
stock-purchases-service.attachments.test.ts feat(stock-purchases): add additional_attachments service helpers 2026-08-06 23:20:26 +02:00
stock-purchases-service.test.ts feat: add split views, stock picking slips, and invoice viewer 2026-08-09 23:16:55 +02:00
stock-purchases-service.ts feat: add split views, stock picking slips, and invoice viewer 2026-08-09 23:16:55 +02:00
stock-quick-draft-service.test.ts
stock-quick-draft-service.ts
stock-surplus.test.ts
stock-surplus.ts
tv-dashboard-service.ts feat(tv-dashboard): enhance TV dashboard with driver stops and performance metrics 2026-08-19 10:16:49 +02:00
tv-session.ts feat(tv): add TV dashboard + refine workflows 2026-08-13 20:55:22 +02:00