Skip to content

Commit f215e09

Browse files
committed
test(plugin-approvals): pin that page labels never land on a slate that replaced it
Claude-Session: https://claude.ai/code/session_01LZZjeuwVdnwn6dFDPLwTBu Co-authored-by: Claude <noreply@anthropic.com>
1 parent 18b5a33 commit f215e09

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎packages/plugins/plugin-approvals/src/display-label-backfill.integration.test.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,13 @@ describe('#23889 — the boot-time display-label backfill', () => {
338338
await engine.insert('sys_approval_request', legacyRequest('moved', {
339339
status: 'pending', pending_approvers: 'u_alice', node_config_json: JSON.stringify({ approvers: [] }),
340340
}), { context: SYSTEM } as any);
341-
for (const id of ['areq_done', 'areq_open', 'areq_recalled', 'areq_moved']) await backdate('sys_approval_request', id);
341+
// And one the sweep moves while its name read fails, so the live writer leaves no label.
342+
await engine.insert('sys_approval_request', legacyRequest('moved_unnamed', {
343+
status: 'pending', pending_approvers: 'u_alice', node_config_json: JSON.stringify({ approvers: [] }),
344+
}), { context: SYSTEM } as any);
345+
for (const id of ['areq_done', 'areq_open', 'areq_recalled', 'areq_moved', 'areq_moved_unnamed']) {
346+
await backdate('sys_approval_request', id);
347+
}
342348

343349
const svc = new ApprovalService({ engine: engine as any, logger: quiet as any });
344350
const source = slotLabelSourceOf(svc);
@@ -356,9 +362,13 @@ describe('#23889 — the boot-time display-label backfill', () => {
356362
await engine.update('sys_approval_request', {
357363
id: 'areq_moved', pending_approvers: 'u_mail', pending_approver_labels: 'Mia Mail',
358364
}, { context: SYSTEM } as any);
365+
await engine.update('sys_approval_request', {
366+
id: 'areq_moved_unnamed', pending_approvers: 'u_mail', pending_approver_labels: null,
367+
}, { context: SYSTEM } as any);
359368
left = {
360369
recalled: await row('sys_approval_request', 'areq_recalled'),
361370
moved: await row('sys_approval_request', 'areq_moved'),
371+
movedUnnamed: await row('sys_approval_request', 'areq_moved_unnamed'),
362372
};
363373
}
364374
return source.slotLabels(slots);
@@ -373,6 +383,8 @@ describe('#23889 — the boot-time display-label backfill', () => {
373383
expect(left!.recalled.updated_at).not.toBe(BACKDATED);
374384
expect(pick(await row('sys_approval_request', 'areq_recalled'))).toEqual(pick(left!.recalled));
375385
expect(pick(await row('sys_approval_request', 'areq_moved'))).toEqual(pick(left!.moved));
386+
// Labels made for the page's slate are never written onto the slate that replaced it.
387+
expect(pick(await row('sys_approval_request', 'areq_moved_unnamed'))).toEqual(pick(left!.movedUnnamed));
376388
// Their null label columns are still filled, under the stamp the live write left.
377389
expect((await row('sys_approval_request', 'areq_recalled')).process_label).toBe('Deal Review');
378390

0 commit comments

Comments
 (0)