Skip to content

Commit b53bea8

Browse files
committed
test(cli): the absent-database audit pin counts every audited table, the decision-audit trail included (#21207)
#21432 (#21391) pinned that a dry run of audit-metadata-bodies on an absent database exits 1 and counts every table it audits as unread. It was written while the audit read two tables. This branch widens the audit to the decision-audit trail, so the merged tree reads three. Both intents are stacked: failures equals the whole audited set, byObject names exactly those tables, scanned stays 0, exit 1. The set is stated literally, so a later widening turns the case red rather than passing on a stale count. Claude-Session: https://claude.ai/code/session_01VvcEokUG1tvVxkceYfR5XB Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8ca4966 commit b53bea8

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎packages/cli/src/commands/migrate/preview-read-only.integration.test.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,16 +493,22 @@ for (const cell of DIALECT_CELLS) {
493493
expect(payload.error).toContain("'sys_metadata'");
494494
}, cell.timeout);
495495

496-
it('audit-metadata-bodies without --apply on a database that does not exist exits 1 with both tables counted unread', async () => {
496+
// [#21207] The audit reads a third table: the decision-audit trail, whose
497+
// conflict notes named stored content hashes. The #21391 intent is
498+
// unchanged — EVERY audited table is counted unread — so the expected set
499+
// is the whole audited set, stated literally: a widening that is not
500+
// carried here turns this case red instead of passing on a stale count.
501+
it('audit-metadata-bodies without --apply on a database that does not exist exits 1 with every audited table counted unread', async () => {
497502
const absent = join(fixture!.dir, 'data', 'never-started.db');
498503
const { payload, exitCode } = await runJson(auditBodies, ['--database-url', `file:${absent}`]);
504+
const audited = ['sys_activity', 'sys_audit_log', 'sys_metadata_audit'];
499505

500506
expect(exitCode).toBe(1);
501507
expect(payload.apply).toBe(false);
502508
// `failures` counts the tables whose rows were NOT examined.
503-
expect(payload.report.failures).toBe(2);
509+
expect(payload.report.failures).toBe(audited.length);
504510
expect(payload.report.scanned).toBe(0);
505-
expect(Object.keys(payload.report.byObject).sort()).toEqual(['sys_activity', 'sys_audit_log']);
511+
expect(Object.keys(payload.report.byObject).sort()).toEqual(audited);
506512
}, cell.timeout);
507513
}
508514
});

0 commit comments

Comments
 (0)