fix: close realtime initialization visibility gaps

This commit is contained in:
root
2026-07-10 06:59:16 +02:00
parent efe4b62a0b
commit d5230cb923
4 changed files with 159 additions and 11 deletions
@@ -9,8 +9,10 @@ import {
parseArgs
} from "./dev-runtime-migration.mjs";
import {
CLOUD_CORE_MIGRATIONS,
CLOUD_RUNTIME_DURABLE_MIGRATION_ID,
CLOUD_RUNTIME_DURABLE_ADAPTER_SCHEMA_VERSION,
CLOUD_RUNTIME_DURABLE_MIGRATION_TABLE,
CLOUD_RUNTIME_DURABLE_TABLE_COLUMNS
} from "../../internal/db/schema.ts";
@@ -34,6 +36,8 @@ test("source check is non-secret and does not attempt live DB access", async ()
assert.equal(report.gates.schema.status, "ready");
assert.equal(report.gates.migration.status, "ready");
assert.equal(report.gates.readiness.status, "not_checked");
assert.equal(report.issue, "pikasTech/HWLAB#2464");
assert.deepEqual(report.applyBoundary.writeScope, []);
assert.equal(report.safety.sourceStoresSecretValues, false);
assert.equal(report.safety.printsSecretValues, false);
assert.equal(JSON.stringify(report).includes("secret-password"), false);
@@ -308,6 +312,13 @@ test("apply mode records ledger and verifies durable runtime readiness", async (
assert.equal(report.gates.readiness.status, "ready");
assert.equal(report.runtime.migration.appliedMigrationId, CLOUD_RUNTIME_DURABLE_MIGRATION_ID);
assert.equal(report.runtime.migration.appliedSchemaVersion, CLOUD_RUNTIME_DURABLE_ADAPTER_SCHEMA_VERSION);
assert.deepEqual(report.applyBoundary.writeScope, [
...CLOUD_CORE_MIGRATIONS.map((migration) => `DEV Postgres schema objects declared by ${migration.path}`),
...CLOUD_CORE_MIGRATIONS.map((migration) => `DEV ${CLOUD_RUNTIME_DURABLE_MIGRATION_TABLE} ledger row ${migration.id}`)
]);
assert.equal(report.applyBoundary.writeScope.length, CLOUD_CORE_MIGRATIONS.length * 2);
assert.ok(report.applyBoundary.writeScope.some((entry) => entry.includes("0008_workbench_kafka_realtime.sql")));
assert.ok(report.applyBoundary.writeScope.some((entry) => entry.endsWith(`ledger row ${CLOUD_RUNTIME_DURABLE_MIGRATION_ID}`)));
assert.ok(queryClient.calls.some((call) => call.sql === "BEGIN"));
assert.ok(queryClient.calls.some((call) => call.sql.includes("INSERT INTO hwlab_schema_migrations")));
assert.ok(queryClient.calls.some((call) => call.sql === "COMMIT"));