Files
openclaw/test/scripts/check-native-state-schema-version.test.ts
Peter Steinberger 6a246f70d1 refactor(state): retire six dead shared-state tables at schema v10 (#129626)
* refactor(state): retire six dead shared-state tables at schema v10

agent_model_catalogs, android_notification_recent_packages,
command_log_entries, diagnostic_stability_bundles, media_blobs, and
model_capability_cache landed with the database-first squash but their
runtime writers never reached main; every stable since v2026.6.10 created
them empty (agent_model_catalogs held only rebuildable catalog cache rows
until #111173 removed its writer). State schema 10 drops all six tables
and seven indexes through both the runtime-open and doctor migration
paths, records the retirements, bumps the native reader ceiling, and
corrects stale database-first doc claims that still named these tables
as canonical stores.

* test: move cross-lane schema-version pins to v10

The v10 retirement missed current-version pins outside src/state: the
native guard vitest wrapper, placement-move and node-worker-launch
same-version assertions, and the audit outbound-progress tripwire. The
pinned pre-C04 audit reader is a v9-era build that now refuses v10
databases by the version contract, so the test projects the file back to
the exact v9 shape with the documented 10-to-9 downgrade fixture before
the reader proof; the shared fixture also seeds the v10 retirement
regression.

* test: keep only the used downgrade fixture export
2026-08-25 17:31:32 -07:00

21 lines
790 B
TypeScript

import { describe, expect, it } from "vitest";
import {
checkNativeStateSchemaVersion,
compareNativeStateSchemaVersions,
} from "../../scripts/check-native-state-schema-version.mjs";
describe("native state schema version guard", () => {
it("keeps the checked-in Swift and TypeScript contracts aligned", () => {
expect(checkNativeStateSchemaVersion()).toBe(10);
});
it("fails when a deliberate Swift fixture drifts behind TypeScript", () => {
expect(() =>
compareNativeStateSchemaVersions({
swiftSource: "private static let maximumSupportedSchemaVersion: Int64 = 5\n",
typescriptSource: "export const OPENCLAW_STATE_SCHEMA_VERSION = 9;\n",
}),
).toThrow("Native state schema version drift: Swift supports 5, TypeScript owns 9");
});
});