@playcademy/sandbox 0.6.1-beta.7 → 0.6.1-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +126 -61
- package/dist/server.js +126 -61
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1084,7 +1084,7 @@ var package_default;
|
|
|
1084
1084
|
var init_package = __esm(() => {
|
|
1085
1085
|
package_default = {
|
|
1086
1086
|
name: "@playcademy/sandbox",
|
|
1087
|
-
version: "0.6.1-beta.
|
|
1087
|
+
version: "0.6.1-beta.8",
|
|
1088
1088
|
description: "Local development server for Playcademy game development",
|
|
1089
1089
|
type: "module",
|
|
1090
1090
|
exports: {
|
|
@@ -28293,14 +28293,16 @@ function assertBaselineClaimValid(args2) {
|
|
|
28293
28293
|
function validateBaselineClaim(args2) {
|
|
28294
28294
|
const { claimedTag, evidence, tables, indexes: indexes2, views, lastDeployAt } = args2;
|
|
28295
28295
|
const claimedIndex = evidence.findIndex((entry) => entry.tag === claimedTag);
|
|
28296
|
+
const expected = replayEvidence(evidence, claimedIndex);
|
|
28297
|
+
const live = { tables, indexes: indexes2, views };
|
|
28296
28298
|
const verdicts = [];
|
|
28297
28299
|
const unverified = [];
|
|
28298
28300
|
evidence.forEach((entry, index2) => {
|
|
28299
28301
|
if (claimedIndex === -1 || index2 > claimedIndex) {
|
|
28300
|
-
verdicts.push(judgeBeyond(entry,
|
|
28302
|
+
verdicts.push(judgeBeyond(entry, expected, live));
|
|
28301
28303
|
return;
|
|
28302
28304
|
}
|
|
28303
|
-
const judged = judgeClaimed(entry,
|
|
28305
|
+
const judged = judgeClaimed(entry, expected, live, lastDeployAt);
|
|
28304
28306
|
verdicts.push(judged.verdict);
|
|
28305
28307
|
if (judged.unverifiable) {
|
|
28306
28308
|
unverified.push(judged.verdict);
|
|
@@ -28313,8 +28315,99 @@ function validateBaselineClaim(args2) {
|
|
|
28313
28315
|
suggestedTag: suggestTag(evidence, tables)
|
|
28314
28316
|
};
|
|
28315
28317
|
}
|
|
28316
|
-
function
|
|
28317
|
-
|
|
28318
|
+
function replayEvidence(evidence, claimedIndex) {
|
|
28319
|
+
const state = { tables: new Map, indexes: new Map, views: new Map };
|
|
28320
|
+
for (let index2 = 0;index2 <= claimedIndex; index2++) {
|
|
28321
|
+
applyEvidenceEntry(state, evidence[index2]);
|
|
28322
|
+
}
|
|
28323
|
+
return state;
|
|
28324
|
+
}
|
|
28325
|
+
function applyEvidenceEntry(state, entry) {
|
|
28326
|
+
for (const table8 of entry.dropsTables) {
|
|
28327
|
+
state.tables.delete(table8);
|
|
28328
|
+
}
|
|
28329
|
+
for (const dropped of entry.dropsColumns) {
|
|
28330
|
+
state.tables.get(dropped.table)?.columns.delete(dropped.column);
|
|
28331
|
+
}
|
|
28332
|
+
for (const droppedIndex of entry.dropsIndexes) {
|
|
28333
|
+
state.indexes.delete(droppedIndex);
|
|
28334
|
+
}
|
|
28335
|
+
for (const view2 of entry.dropsViews) {
|
|
28336
|
+
state.views.delete(view2);
|
|
28337
|
+
}
|
|
28338
|
+
for (const table8 of entry.createsTables) {
|
|
28339
|
+
state.tables.set(table8.name, {
|
|
28340
|
+
creator: entry.tag,
|
|
28341
|
+
columns: new Map(table8.columns.map((column2) => [column2, entry.tag]))
|
|
28342
|
+
});
|
|
28343
|
+
}
|
|
28344
|
+
for (const added of entry.addsColumns) {
|
|
28345
|
+
state.tables.get(added.table)?.columns.set(added.column, entry.tag);
|
|
28346
|
+
}
|
|
28347
|
+
for (const createdIndex of entry.createsIndexes) {
|
|
28348
|
+
state.indexes.set(createdIndex, entry.tag);
|
|
28349
|
+
}
|
|
28350
|
+
for (const view2 of entry.createsViews) {
|
|
28351
|
+
state.views.set(view2, entry.tag);
|
|
28352
|
+
}
|
|
28353
|
+
}
|
|
28354
|
+
function judgeClaimed(entry, expected, live, lastDeployAt) {
|
|
28355
|
+
let surviving = 0;
|
|
28356
|
+
for (const table8 of entry.createsTables) {
|
|
28357
|
+
const expectation = expected.tables.get(table8.name);
|
|
28358
|
+
if (expectation?.creator === entry.tag) {
|
|
28359
|
+
surviving++;
|
|
28360
|
+
const columns2 = live.tables.get(table8.name);
|
|
28361
|
+
if (!columns2) {
|
|
28362
|
+
return {
|
|
28363
|
+
verdict: {
|
|
28364
|
+
tag: entry.tag,
|
|
28365
|
+
verdict: "contradicted",
|
|
28366
|
+
detail: `creates table \`${table8.name}\`, which is not in the live database`
|
|
28367
|
+
},
|
|
28368
|
+
unverifiable: false
|
|
28369
|
+
};
|
|
28370
|
+
}
|
|
28371
|
+
const missing = [...expectation.columns.entries()].filter(([, creator]) => creator === entry.tag).map(([column2]) => column2).filter((column2) => !columns2.includes(column2));
|
|
28372
|
+
if (missing.length > 0) {
|
|
28373
|
+
return {
|
|
28374
|
+
verdict: {
|
|
28375
|
+
tag: entry.tag,
|
|
28376
|
+
verdict: "contradicted",
|
|
28377
|
+
detail: `table \`${table8.name}\` exists but is missing column(s) ${missing.map((column2) => `\`${column2}\``).join(", ")} this migration defines`
|
|
28378
|
+
},
|
|
28379
|
+
unverifiable: false
|
|
28380
|
+
};
|
|
28381
|
+
}
|
|
28382
|
+
}
|
|
28383
|
+
}
|
|
28384
|
+
for (const added of entry.addsColumns) {
|
|
28385
|
+
if (expected.tables.get(added.table)?.columns.get(added.column) === entry.tag) {
|
|
28386
|
+
surviving++;
|
|
28387
|
+
const columns2 = live.tables.get(added.table);
|
|
28388
|
+
if (columns2 && !columns2.includes(added.column)) {
|
|
28389
|
+
return {
|
|
28390
|
+
verdict: {
|
|
28391
|
+
tag: entry.tag,
|
|
28392
|
+
verdict: "contradicted",
|
|
28393
|
+
detail: `adds column \`${added.column}\` to \`${added.table}\`, which the live table does not have`
|
|
28394
|
+
},
|
|
28395
|
+
unverifiable: false
|
|
28396
|
+
};
|
|
28397
|
+
}
|
|
28398
|
+
}
|
|
28399
|
+
}
|
|
28400
|
+
for (const name2 of entry.createsIndexes) {
|
|
28401
|
+
if (expected.indexes.get(name2) === entry.tag && live.indexes.has(name2)) {
|
|
28402
|
+
surviving++;
|
|
28403
|
+
}
|
|
28404
|
+
}
|
|
28405
|
+
for (const name2 of entry.createsViews) {
|
|
28406
|
+
if (expected.views.get(name2) === entry.tag && live.views.has(name2)) {
|
|
28407
|
+
surviving++;
|
|
28408
|
+
}
|
|
28409
|
+
}
|
|
28410
|
+
if (surviving === 0) {
|
|
28318
28411
|
const generated = new Date(entry.generatedAt);
|
|
28319
28412
|
if (lastDeployAt && generated > lastDeployAt) {
|
|
28320
28413
|
return {
|
|
@@ -28328,48 +28421,11 @@ function judgeClaimed(entry, tables, lastDeployAt) {
|
|
|
28328
28421
|
}
|
|
28329
28422
|
return { verdict: { tag: entry.tag, verdict: "no-signal" }, unverifiable: false };
|
|
28330
28423
|
}
|
|
28331
|
-
for (const table8 of entry.createsTables) {
|
|
28332
|
-
const columns2 = tables.get(table8.name);
|
|
28333
|
-
if (!columns2) {
|
|
28334
|
-
return {
|
|
28335
|
-
verdict: {
|
|
28336
|
-
tag: entry.tag,
|
|
28337
|
-
verdict: "contradicted",
|
|
28338
|
-
detail: `creates table \`${table8.name}\`, which is not in the live database`
|
|
28339
|
-
},
|
|
28340
|
-
unverifiable: false
|
|
28341
|
-
};
|
|
28342
|
-
}
|
|
28343
|
-
const missing = table8.columns.filter((column2) => !columns2.includes(column2));
|
|
28344
|
-
if (missing.length > 0) {
|
|
28345
|
-
return {
|
|
28346
|
-
verdict: {
|
|
28347
|
-
tag: entry.tag,
|
|
28348
|
-
verdict: "contradicted",
|
|
28349
|
-
detail: `table \`${table8.name}\` exists but is missing column(s) ${missing.map((column2) => `\`${column2}\``).join(", ")} this migration defines`
|
|
28350
|
-
},
|
|
28351
|
-
unverifiable: false
|
|
28352
|
-
};
|
|
28353
|
-
}
|
|
28354
|
-
}
|
|
28355
|
-
for (const added of entry.addsColumns) {
|
|
28356
|
-
const columns2 = tables.get(added.table);
|
|
28357
|
-
if (columns2 && !columns2.includes(added.column)) {
|
|
28358
|
-
return {
|
|
28359
|
-
verdict: {
|
|
28360
|
-
tag: entry.tag,
|
|
28361
|
-
verdict: "contradicted",
|
|
28362
|
-
detail: `adds column \`${added.column}\` to \`${added.table}\`, which the live table does not have`
|
|
28363
|
-
},
|
|
28364
|
-
unverifiable: false
|
|
28365
|
-
};
|
|
28366
|
-
}
|
|
28367
|
-
}
|
|
28368
28424
|
return { verdict: { tag: entry.tag, verdict: "verified" }, unverifiable: false };
|
|
28369
28425
|
}
|
|
28370
|
-
function judgeBeyond(entry,
|
|
28426
|
+
function judgeBeyond(entry, expected, live) {
|
|
28371
28427
|
for (const table8 of entry.createsTables) {
|
|
28372
|
-
if (tables.has(table8.name)) {
|
|
28428
|
+
if (live.tables.has(table8.name) && !expected.tables.has(table8.name)) {
|
|
28373
28429
|
return {
|
|
28374
28430
|
tag: entry.tag,
|
|
28375
28431
|
verdict: "contradicted",
|
|
@@ -28378,8 +28434,9 @@ function judgeBeyond(entry, tables, indexes2, views) {
|
|
|
28378
28434
|
}
|
|
28379
28435
|
}
|
|
28380
28436
|
for (const added of entry.addsColumns) {
|
|
28381
|
-
const columns2 = tables.get(added.table);
|
|
28382
|
-
|
|
28437
|
+
const columns2 = live.tables.get(added.table);
|
|
28438
|
+
const explained = expected.tables.get(added.table)?.columns.has(added.column);
|
|
28439
|
+
if (columns2?.includes(added.column) && !explained) {
|
|
28383
28440
|
return {
|
|
28384
28441
|
tag: entry.tag,
|
|
28385
28442
|
verdict: "contradicted",
|
|
@@ -28388,7 +28445,7 @@ function judgeBeyond(entry, tables, indexes2, views) {
|
|
|
28388
28445
|
}
|
|
28389
28446
|
}
|
|
28390
28447
|
for (const index2 of entry.createsIndexes) {
|
|
28391
|
-
if (
|
|
28448
|
+
if (live.indexes.has(index2) && !expected.indexes.has(index2)) {
|
|
28392
28449
|
return {
|
|
28393
28450
|
tag: entry.tag,
|
|
28394
28451
|
verdict: "contradicted",
|
|
@@ -28397,7 +28454,7 @@ function judgeBeyond(entry, tables, indexes2, views) {
|
|
|
28397
28454
|
}
|
|
28398
28455
|
}
|
|
28399
28456
|
for (const view2 of entry.createsViews) {
|
|
28400
|
-
if (views.has(view2)) {
|
|
28457
|
+
if (live.views.has(view2) && !expected.views.has(view2)) {
|
|
28401
28458
|
return {
|
|
28402
28459
|
tag: entry.tag,
|
|
28403
28460
|
verdict: "contradicted",
|
|
@@ -28408,19 +28465,20 @@ function judgeBeyond(entry, tables, indexes2, views) {
|
|
|
28408
28465
|
return { tag: entry.tag, verdict: "verified" };
|
|
28409
28466
|
}
|
|
28410
28467
|
function suggestTag(evidence, tables) {
|
|
28411
|
-
|
|
28412
|
-
|
|
28413
|
-
|
|
28414
|
-
}
|
|
28415
|
-
let
|
|
28416
|
-
|
|
28417
|
-
|
|
28468
|
+
const liveCreated = [
|
|
28469
|
+
...new Set(evidence.flatMap((entry) => entry.createsTables.map((table8) => table8.name)))
|
|
28470
|
+
].filter((name2) => tables.has(name2));
|
|
28471
|
+
const state = { tables: new Map, indexes: new Map, views: new Map };
|
|
28472
|
+
let best = null;
|
|
28473
|
+
for (const entry of evidence) {
|
|
28474
|
+
applyEvidenceEntry(state, entry);
|
|
28475
|
+
const allPresent = [...state.tables.keys()].every((name2) => tables.has(name2));
|
|
28476
|
+
const noStray = liveCreated.every((name2) => state.tables.has(name2));
|
|
28477
|
+
if (allPresent && noStray) {
|
|
28478
|
+
best = entry.tag;
|
|
28479
|
+
}
|
|
28418
28480
|
}
|
|
28419
|
-
|
|
28420
|
-
return candidate >= 0 && candidate >= absentFrom - 1 ? evidence[candidate].tag : null;
|
|
28421
|
-
}
|
|
28422
|
-
function hasSignal(entry) {
|
|
28423
|
-
return entry.createsTables.length > 0 || entry.addsColumns.length > 0 || entry.createsIndexes.length > 0 || entry.createsViews.length > 0;
|
|
28481
|
+
return best;
|
|
28424
28482
|
}
|
|
28425
28483
|
var init_baseline_validation_util = __esm(() => {
|
|
28426
28484
|
init_spans();
|
|
@@ -33980,7 +34038,14 @@ var init_schemas2 = __esm(() => {
|
|
|
33980
34038
|
column: exports_external.string().min(1)
|
|
33981
34039
|
})),
|
|
33982
34040
|
createsIndexes: exports_external.array(exports_external.string()),
|
|
33983
|
-
createsViews: exports_external.array(exports_external.string())
|
|
34041
|
+
createsViews: exports_external.array(exports_external.string()),
|
|
34042
|
+
dropsTables: exports_external.array(exports_external.string()),
|
|
34043
|
+
dropsColumns: exports_external.array(exports_external.object({
|
|
34044
|
+
table: exports_external.string().min(1),
|
|
34045
|
+
column: exports_external.string().min(1)
|
|
34046
|
+
})),
|
|
34047
|
+
dropsIndexes: exports_external.array(exports_external.string()),
|
|
34048
|
+
dropsViews: exports_external.array(exports_external.string())
|
|
33984
34049
|
})).optional();
|
|
33985
34050
|
DeployBaselineSchema = exports_external.object({
|
|
33986
34051
|
lastAppliedMigrationTag: exports_external.string().min(1).optional(),
|
package/dist/server.js
CHANGED
|
@@ -1083,7 +1083,7 @@ var package_default;
|
|
|
1083
1083
|
var init_package = __esm(() => {
|
|
1084
1084
|
package_default = {
|
|
1085
1085
|
name: "@playcademy/sandbox",
|
|
1086
|
-
version: "0.6.1-beta.
|
|
1086
|
+
version: "0.6.1-beta.8",
|
|
1087
1087
|
description: "Local development server for Playcademy game development",
|
|
1088
1088
|
type: "module",
|
|
1089
1089
|
exports: {
|
|
@@ -28292,14 +28292,16 @@ function assertBaselineClaimValid(args2) {
|
|
|
28292
28292
|
function validateBaselineClaim(args2) {
|
|
28293
28293
|
const { claimedTag, evidence, tables, indexes: indexes2, views, lastDeployAt } = args2;
|
|
28294
28294
|
const claimedIndex = evidence.findIndex((entry) => entry.tag === claimedTag);
|
|
28295
|
+
const expected = replayEvidence(evidence, claimedIndex);
|
|
28296
|
+
const live = { tables, indexes: indexes2, views };
|
|
28295
28297
|
const verdicts = [];
|
|
28296
28298
|
const unverified = [];
|
|
28297
28299
|
evidence.forEach((entry, index2) => {
|
|
28298
28300
|
if (claimedIndex === -1 || index2 > claimedIndex) {
|
|
28299
|
-
verdicts.push(judgeBeyond(entry,
|
|
28301
|
+
verdicts.push(judgeBeyond(entry, expected, live));
|
|
28300
28302
|
return;
|
|
28301
28303
|
}
|
|
28302
|
-
const judged = judgeClaimed(entry,
|
|
28304
|
+
const judged = judgeClaimed(entry, expected, live, lastDeployAt);
|
|
28303
28305
|
verdicts.push(judged.verdict);
|
|
28304
28306
|
if (judged.unverifiable) {
|
|
28305
28307
|
unverified.push(judged.verdict);
|
|
@@ -28312,8 +28314,99 @@ function validateBaselineClaim(args2) {
|
|
|
28312
28314
|
suggestedTag: suggestTag(evidence, tables)
|
|
28313
28315
|
};
|
|
28314
28316
|
}
|
|
28315
|
-
function
|
|
28316
|
-
|
|
28317
|
+
function replayEvidence(evidence, claimedIndex) {
|
|
28318
|
+
const state = { tables: new Map, indexes: new Map, views: new Map };
|
|
28319
|
+
for (let index2 = 0;index2 <= claimedIndex; index2++) {
|
|
28320
|
+
applyEvidenceEntry(state, evidence[index2]);
|
|
28321
|
+
}
|
|
28322
|
+
return state;
|
|
28323
|
+
}
|
|
28324
|
+
function applyEvidenceEntry(state, entry) {
|
|
28325
|
+
for (const table8 of entry.dropsTables) {
|
|
28326
|
+
state.tables.delete(table8);
|
|
28327
|
+
}
|
|
28328
|
+
for (const dropped of entry.dropsColumns) {
|
|
28329
|
+
state.tables.get(dropped.table)?.columns.delete(dropped.column);
|
|
28330
|
+
}
|
|
28331
|
+
for (const droppedIndex of entry.dropsIndexes) {
|
|
28332
|
+
state.indexes.delete(droppedIndex);
|
|
28333
|
+
}
|
|
28334
|
+
for (const view2 of entry.dropsViews) {
|
|
28335
|
+
state.views.delete(view2);
|
|
28336
|
+
}
|
|
28337
|
+
for (const table8 of entry.createsTables) {
|
|
28338
|
+
state.tables.set(table8.name, {
|
|
28339
|
+
creator: entry.tag,
|
|
28340
|
+
columns: new Map(table8.columns.map((column2) => [column2, entry.tag]))
|
|
28341
|
+
});
|
|
28342
|
+
}
|
|
28343
|
+
for (const added of entry.addsColumns) {
|
|
28344
|
+
state.tables.get(added.table)?.columns.set(added.column, entry.tag);
|
|
28345
|
+
}
|
|
28346
|
+
for (const createdIndex of entry.createsIndexes) {
|
|
28347
|
+
state.indexes.set(createdIndex, entry.tag);
|
|
28348
|
+
}
|
|
28349
|
+
for (const view2 of entry.createsViews) {
|
|
28350
|
+
state.views.set(view2, entry.tag);
|
|
28351
|
+
}
|
|
28352
|
+
}
|
|
28353
|
+
function judgeClaimed(entry, expected, live, lastDeployAt) {
|
|
28354
|
+
let surviving = 0;
|
|
28355
|
+
for (const table8 of entry.createsTables) {
|
|
28356
|
+
const expectation = expected.tables.get(table8.name);
|
|
28357
|
+
if (expectation?.creator === entry.tag) {
|
|
28358
|
+
surviving++;
|
|
28359
|
+
const columns2 = live.tables.get(table8.name);
|
|
28360
|
+
if (!columns2) {
|
|
28361
|
+
return {
|
|
28362
|
+
verdict: {
|
|
28363
|
+
tag: entry.tag,
|
|
28364
|
+
verdict: "contradicted",
|
|
28365
|
+
detail: `creates table \`${table8.name}\`, which is not in the live database`
|
|
28366
|
+
},
|
|
28367
|
+
unverifiable: false
|
|
28368
|
+
};
|
|
28369
|
+
}
|
|
28370
|
+
const missing = [...expectation.columns.entries()].filter(([, creator]) => creator === entry.tag).map(([column2]) => column2).filter((column2) => !columns2.includes(column2));
|
|
28371
|
+
if (missing.length > 0) {
|
|
28372
|
+
return {
|
|
28373
|
+
verdict: {
|
|
28374
|
+
tag: entry.tag,
|
|
28375
|
+
verdict: "contradicted",
|
|
28376
|
+
detail: `table \`${table8.name}\` exists but is missing column(s) ${missing.map((column2) => `\`${column2}\``).join(", ")} this migration defines`
|
|
28377
|
+
},
|
|
28378
|
+
unverifiable: false
|
|
28379
|
+
};
|
|
28380
|
+
}
|
|
28381
|
+
}
|
|
28382
|
+
}
|
|
28383
|
+
for (const added of entry.addsColumns) {
|
|
28384
|
+
if (expected.tables.get(added.table)?.columns.get(added.column) === entry.tag) {
|
|
28385
|
+
surviving++;
|
|
28386
|
+
const columns2 = live.tables.get(added.table);
|
|
28387
|
+
if (columns2 && !columns2.includes(added.column)) {
|
|
28388
|
+
return {
|
|
28389
|
+
verdict: {
|
|
28390
|
+
tag: entry.tag,
|
|
28391
|
+
verdict: "contradicted",
|
|
28392
|
+
detail: `adds column \`${added.column}\` to \`${added.table}\`, which the live table does not have`
|
|
28393
|
+
},
|
|
28394
|
+
unverifiable: false
|
|
28395
|
+
};
|
|
28396
|
+
}
|
|
28397
|
+
}
|
|
28398
|
+
}
|
|
28399
|
+
for (const name2 of entry.createsIndexes) {
|
|
28400
|
+
if (expected.indexes.get(name2) === entry.tag && live.indexes.has(name2)) {
|
|
28401
|
+
surviving++;
|
|
28402
|
+
}
|
|
28403
|
+
}
|
|
28404
|
+
for (const name2 of entry.createsViews) {
|
|
28405
|
+
if (expected.views.get(name2) === entry.tag && live.views.has(name2)) {
|
|
28406
|
+
surviving++;
|
|
28407
|
+
}
|
|
28408
|
+
}
|
|
28409
|
+
if (surviving === 0) {
|
|
28317
28410
|
const generated = new Date(entry.generatedAt);
|
|
28318
28411
|
if (lastDeployAt && generated > lastDeployAt) {
|
|
28319
28412
|
return {
|
|
@@ -28327,48 +28420,11 @@ function judgeClaimed(entry, tables, lastDeployAt) {
|
|
|
28327
28420
|
}
|
|
28328
28421
|
return { verdict: { tag: entry.tag, verdict: "no-signal" }, unverifiable: false };
|
|
28329
28422
|
}
|
|
28330
|
-
for (const table8 of entry.createsTables) {
|
|
28331
|
-
const columns2 = tables.get(table8.name);
|
|
28332
|
-
if (!columns2) {
|
|
28333
|
-
return {
|
|
28334
|
-
verdict: {
|
|
28335
|
-
tag: entry.tag,
|
|
28336
|
-
verdict: "contradicted",
|
|
28337
|
-
detail: `creates table \`${table8.name}\`, which is not in the live database`
|
|
28338
|
-
},
|
|
28339
|
-
unverifiable: false
|
|
28340
|
-
};
|
|
28341
|
-
}
|
|
28342
|
-
const missing = table8.columns.filter((column2) => !columns2.includes(column2));
|
|
28343
|
-
if (missing.length > 0) {
|
|
28344
|
-
return {
|
|
28345
|
-
verdict: {
|
|
28346
|
-
tag: entry.tag,
|
|
28347
|
-
verdict: "contradicted",
|
|
28348
|
-
detail: `table \`${table8.name}\` exists but is missing column(s) ${missing.map((column2) => `\`${column2}\``).join(", ")} this migration defines`
|
|
28349
|
-
},
|
|
28350
|
-
unverifiable: false
|
|
28351
|
-
};
|
|
28352
|
-
}
|
|
28353
|
-
}
|
|
28354
|
-
for (const added of entry.addsColumns) {
|
|
28355
|
-
const columns2 = tables.get(added.table);
|
|
28356
|
-
if (columns2 && !columns2.includes(added.column)) {
|
|
28357
|
-
return {
|
|
28358
|
-
verdict: {
|
|
28359
|
-
tag: entry.tag,
|
|
28360
|
-
verdict: "contradicted",
|
|
28361
|
-
detail: `adds column \`${added.column}\` to \`${added.table}\`, which the live table does not have`
|
|
28362
|
-
},
|
|
28363
|
-
unverifiable: false
|
|
28364
|
-
};
|
|
28365
|
-
}
|
|
28366
|
-
}
|
|
28367
28423
|
return { verdict: { tag: entry.tag, verdict: "verified" }, unverifiable: false };
|
|
28368
28424
|
}
|
|
28369
|
-
function judgeBeyond(entry,
|
|
28425
|
+
function judgeBeyond(entry, expected, live) {
|
|
28370
28426
|
for (const table8 of entry.createsTables) {
|
|
28371
|
-
if (tables.has(table8.name)) {
|
|
28427
|
+
if (live.tables.has(table8.name) && !expected.tables.has(table8.name)) {
|
|
28372
28428
|
return {
|
|
28373
28429
|
tag: entry.tag,
|
|
28374
28430
|
verdict: "contradicted",
|
|
@@ -28377,8 +28433,9 @@ function judgeBeyond(entry, tables, indexes2, views) {
|
|
|
28377
28433
|
}
|
|
28378
28434
|
}
|
|
28379
28435
|
for (const added of entry.addsColumns) {
|
|
28380
|
-
const columns2 = tables.get(added.table);
|
|
28381
|
-
|
|
28436
|
+
const columns2 = live.tables.get(added.table);
|
|
28437
|
+
const explained = expected.tables.get(added.table)?.columns.has(added.column);
|
|
28438
|
+
if (columns2?.includes(added.column) && !explained) {
|
|
28382
28439
|
return {
|
|
28383
28440
|
tag: entry.tag,
|
|
28384
28441
|
verdict: "contradicted",
|
|
@@ -28387,7 +28444,7 @@ function judgeBeyond(entry, tables, indexes2, views) {
|
|
|
28387
28444
|
}
|
|
28388
28445
|
}
|
|
28389
28446
|
for (const index2 of entry.createsIndexes) {
|
|
28390
|
-
if (
|
|
28447
|
+
if (live.indexes.has(index2) && !expected.indexes.has(index2)) {
|
|
28391
28448
|
return {
|
|
28392
28449
|
tag: entry.tag,
|
|
28393
28450
|
verdict: "contradicted",
|
|
@@ -28396,7 +28453,7 @@ function judgeBeyond(entry, tables, indexes2, views) {
|
|
|
28396
28453
|
}
|
|
28397
28454
|
}
|
|
28398
28455
|
for (const view2 of entry.createsViews) {
|
|
28399
|
-
if (views.has(view2)) {
|
|
28456
|
+
if (live.views.has(view2) && !expected.views.has(view2)) {
|
|
28400
28457
|
return {
|
|
28401
28458
|
tag: entry.tag,
|
|
28402
28459
|
verdict: "contradicted",
|
|
@@ -28407,19 +28464,20 @@ function judgeBeyond(entry, tables, indexes2, views) {
|
|
|
28407
28464
|
return { tag: entry.tag, verdict: "verified" };
|
|
28408
28465
|
}
|
|
28409
28466
|
function suggestTag(evidence, tables) {
|
|
28410
|
-
|
|
28411
|
-
|
|
28412
|
-
|
|
28413
|
-
}
|
|
28414
|
-
let
|
|
28415
|
-
|
|
28416
|
-
|
|
28467
|
+
const liveCreated = [
|
|
28468
|
+
...new Set(evidence.flatMap((entry) => entry.createsTables.map((table8) => table8.name)))
|
|
28469
|
+
].filter((name2) => tables.has(name2));
|
|
28470
|
+
const state = { tables: new Map, indexes: new Map, views: new Map };
|
|
28471
|
+
let best = null;
|
|
28472
|
+
for (const entry of evidence) {
|
|
28473
|
+
applyEvidenceEntry(state, entry);
|
|
28474
|
+
const allPresent = [...state.tables.keys()].every((name2) => tables.has(name2));
|
|
28475
|
+
const noStray = liveCreated.every((name2) => state.tables.has(name2));
|
|
28476
|
+
if (allPresent && noStray) {
|
|
28477
|
+
best = entry.tag;
|
|
28478
|
+
}
|
|
28417
28479
|
}
|
|
28418
|
-
|
|
28419
|
-
return candidate >= 0 && candidate >= absentFrom - 1 ? evidence[candidate].tag : null;
|
|
28420
|
-
}
|
|
28421
|
-
function hasSignal(entry) {
|
|
28422
|
-
return entry.createsTables.length > 0 || entry.addsColumns.length > 0 || entry.createsIndexes.length > 0 || entry.createsViews.length > 0;
|
|
28480
|
+
return best;
|
|
28423
28481
|
}
|
|
28424
28482
|
var init_baseline_validation_util = __esm(() => {
|
|
28425
28483
|
init_spans();
|
|
@@ -33979,7 +34037,14 @@ var init_schemas2 = __esm(() => {
|
|
|
33979
34037
|
column: exports_external.string().min(1)
|
|
33980
34038
|
})),
|
|
33981
34039
|
createsIndexes: exports_external.array(exports_external.string()),
|
|
33982
|
-
createsViews: exports_external.array(exports_external.string())
|
|
34040
|
+
createsViews: exports_external.array(exports_external.string()),
|
|
34041
|
+
dropsTables: exports_external.array(exports_external.string()),
|
|
34042
|
+
dropsColumns: exports_external.array(exports_external.object({
|
|
34043
|
+
table: exports_external.string().min(1),
|
|
34044
|
+
column: exports_external.string().min(1)
|
|
34045
|
+
})),
|
|
34046
|
+
dropsIndexes: exports_external.array(exports_external.string()),
|
|
34047
|
+
dropsViews: exports_external.array(exports_external.string())
|
|
33983
34048
|
})).optional();
|
|
33984
34049
|
DeployBaselineSchema = exports_external.object({
|
|
33985
34050
|
lastAppliedMigrationTag: exports_external.string().min(1).optional(),
|