Skip to content

Commit 8c65e50

Browse files
committed
test(dogfood): the persona matrix hangs its invoice lines off an unpaid invoice
The admin payload control created a showcase_invoice_line under firstId('showcase_invoice'), whichever invoice a limit-1 read returned. With random ids that is a different invoice on every boot, and several seeded invoices are paid. Since the showcase locks a paid invoice's lines (its showcase_guard_paid_invoice_line_* hooks), the control answered 400 "This invoice is paid, so its lines are locked" on some boots and not others. The seeded parent is now chosen by the state the lock reads (status not paid), the way the account above it is chosen by its rule. Every line the file creates under a seeded invoice hangs off this one parent. The lock is unchanged. Claude-Session: https://claude.ai/code/session_01LmjU2x1faLZ39DVTFyVca6 Co-authored-by: Claude <noreply@anthropic.com>
1 parent ab98901 commit 8c65e50

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎packages/qa/dogfood/test/showcase-crud-persona-matrix.dogfood.test.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,19 @@ describe('showcase: persona × CRUD-cell matrix (#9481)', () => {
324324
);
325325
seed.productId = await firstId('showcase_product');
326326
seed.projectId = await firstId('showcase_project');
327-
seed.invoiceId = await firstId('showcase_invoice');
327+
// NOT `firstId` either, for the same reason as the account: the showcase
328+
// locks a PAID invoice's lines (its `showcase_guard_paid_invoice_line_*`
329+
// hooks), so a line can be neither added under one nor removed from one.
330+
// `firstId` takes whichever invoice a `limit: 1` read returns, and with
331+
// random ids that is a different invoice on every boot — several seeded
332+
// invoices are paid, so the admin control below failed on some boots and
333+
// not others. Every line this file creates under a seeded invoice hangs
334+
// off this one, so the parent is chosen by the state the lock reads.
335+
seed.invoiceId = String(
336+
(await ql.find('showcase_invoice', {
337+
where: { status: { $ne: 'paid' } }, limit: 1, context: SYS,
338+
}))?.[0]?.id ?? '',
339+
);
328340
seed.expenseReportId = await firstId('showcase_expense_report');
329341
seed.teamId = await firstId('showcase_team');
330342
expect(

0 commit comments

Comments
 (0)