diff --git a/src/lib/server/orders-service.test.ts b/src/lib/server/orders-service.test.ts index 3146072..bfb4059 100644 --- a/src/lib/server/orders-service.test.ts +++ b/src/lib/server/orders-service.test.ts @@ -2962,13 +2962,13 @@ describe("createOrder quote auto-detection", () => { expect(r.order.id).toBeDefined(); // Proves the catch fired AND ran the inline fallback — without // the call assertion the test would pass on the spy alone even - // if `void runQuoteMatch()` was deleted. + // if `void runPostCreateMatchers()` was deleted. expect(suggestQuoteForOrder).toHaveBeenCalledWith(r.order.id); // The fallback logs its engagement so a silent switch to // fire-and-forget is impossible to miss in production logs. expect(consoleErrorSpy).toHaveBeenCalledWith( expect.stringContaining( - "[createOrder] after() unavailable, running quote match inline", + "[createOrder] after() unavailable, running post-create matchers inline", ), expect.anything(), ); diff --git a/src/lib/server/orders-service.ts b/src/lib/server/orders-service.ts index d8bbdf8..70dfa3b 100644 --- a/src/lib/server/orders-service.ts +++ b/src/lib/server/orders-service.ts @@ -2254,16 +2254,15 @@ export async function createOrder(input: CreateOrderInput): Promise { + // Writes only soft suggestions (quote, delivery-note, order-number + // duplicate, order-item duplicate). Promoting any of them to a + // hard link stays a deliberate human click. + const runPostCreateMatchers = async () => { try { await suggestQuoteForOrder(order.id); } catch (err) { @@ -2298,7 +2297,7 @@ export async function createOrder(input: CreateOrderInput): Promise