Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(ci): reject flattened schema dumps in storage schema check

Steven Enamakel9fed5f93c0b3
diff --git a/scripts/__tests__/check-storage-schema.test.mjs b/scripts/__tests__/check-storage-schema.test.mjs
index 7d67d56cc6..3a7ccdcf2c 100644
--- a/scripts/__tests__/check-storage-schema.test.mjs
+++ b/scripts/__tests__/check-storage-schema.test.mjs
@@ -23,6 +23,12 @@ test('a well-formed per-crate schema is clean', () => {
assert.deepEqual(lint(dump), []);
});
+test('a flattened schema dump is rejected instead of passing as empty', () => {
+ assert.deepEqual(lint({ collections: [collection('cron.jobs')] }), [
+ 'schema dump must group collections under an owners array',
+ ]);
+});
+
test('collection names must be <owner>.<entity> in snake_case', () => {
const problems = lint({
owners: [{ crate: 'openhuman', collections: [
diff --git a/scripts/ci/check-storage-schema.mjs b/scripts/ci/check-storage-schema.mjs
index 4f92b96055..04cae664c9 100644
--- a/scripts/ci/check-storage-schema.mjs
+++ b/scripts/ci/check-storage-schema.mjs
@@ -88,6 +88,9 @@ export function dumpSchema(root = REPO_ROOT, { run: spawn = spawnSync, env = pro
/** @returns {string[]} one message per violation */
export function lint(dump) {
const problems = [];
+ if (!Array.isArray(dump.owners)) {
+ return ['schema dump must group collections under an owners array'];
+ }
const crates = new Set();
const names = new Set();
for (const owner of dump.owners ?? []) {