Skip to content

Commit 791db71

Browse files
committed
wip(cli): pin the unreachable declared archive
Claude-Session: https://claude.ai/code/session_01WQWCrorWxW5zDh4n6jCEF5 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 0f17ba7 commit 791db71

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

‎packages/cli/src/commands/migrate/audit-mail-bodies.archive.integration.test.ts‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2-
// test-budget: 70 — spawns the real producer once per single-cause fixture: two served-shape boots that run the real Archiver, and six spawns of the source CLI (dry run, --apply, re-run over the archive fixture; --apply on a project with no archive; a dry run with a runtime archive row; --apply with a declared archive that cannot connect); 54.7 s, the slower of two local runs on a shared container, x 1.25, no CI reading yet
2+
// test-budget: 85 — spawns the real producer once per single-cause fixture: two served-shape boots that run the real Archiver, and six spawns of the source CLI (dry run, --apply, re-run over the archive fixture; --apply on a project with no archive; a dry run with a runtime archive row; --apply with a declared archive that cannot connect); 67.8 s, the slower of two local runs on a shared container, x 1.25, no CI reading yet
33

44
/**
55
* [#24899] `os migrate audit-mail-bodies` masks the mail-log bodies the
@@ -281,12 +281,14 @@ beforeAll(async () => {
281281
}
282282
runtimeRowRun = await runCommand(runtimeRowDir, runtimeRowDb, ['--json']);
283283

284-
// A declared archive whose SQLite file cannot be opened: its directory is a
285-
// regular file, so the connect fails on every attempt.
284+
// A declared archive the boot cannot reach: a Postgres server on a port
285+
// nothing listens on, so the connect is refused on every attempt. Not an
286+
// unopenable SQLite file: the source entry pins NODE_ENV=development, under
287+
// which the SQLite factory steps an unopenable file down to an in-memory
288+
// engine instead of failing.
286289
unreachableDir = mkdtempSync(join(tmpdir(), 'os-24899-unreachable-'));
287-
writeFileSync(join(unreachableDir, 'blocker'), 'not a directory');
288290
writeArtifact(unreachableDir, [
289-
{ name: 'archive', driver: 'sqlite', config: { filename: join(unreachableDir, 'blocker', 'archive.db') }, autoConnect: true },
291+
{ name: 'archive', driver: 'postgres', config: { host: '127.0.0.1', port: 1, database: 'archive', user: 'os24899' }, autoConnect: true },
290292
]);
291293
unreachableRun = await runCommand(unreachableDir, join(unreachableDir, 'main.db'), ['--apply', '--yes', '--json']);
292294
}, HOOK_TIMEOUT_MS);
@@ -377,8 +379,7 @@ describe('[#24899] os migrate audit-mail-bodies over an archive datasource', ()
377379
expect(unreachableRun.code).toBe(1);
378380
const entry = archiveOf(unreachableRun);
379381
expect(entry).toMatchObject({ datasource: 'archive', objects: ['sys_audit_log'], status: 'not-connected' });
380-
expect(typeof entry.connection?.status).toBe('string');
381-
expect(entry.connection.status === 'connected' || entry.connection.status === 'already-registered').toBe(false);
382+
expect(entry.connection?.status).toBe('failed-degraded');
382383
expect(entry.report).toBeUndefined();
383384
});
384385
});

0 commit comments

Comments
 (0)