fix(ql3): close adopted lineage acceptance gates

This commit is contained in:
whyour
2026-08-21 15:35:48 +08:00
parent 4f6be5bc2c
commit b714f2bf18
9 changed files with 155 additions and 18 deletions
@@ -13,6 +13,7 @@ const {
writeSyntheticLocalReleaseSelection,
} = require('../../scripts/lib/ql3-local-release-selection-test-fixture.cjs');
const ROOT = path.resolve(__dirname, '../..');
const IMAGE = `ghcr.io/example/qinglong3-local-application@sha256:${'a'.repeat(
64,
)}`;
@@ -178,3 +179,20 @@ test('marks an ordinary PR rollout as a synthetic fixture', (t) => {
assert.deepEqual(result.authority, { mode: 'synthetic_live_fixture' });
assert.equal(fs.existsSync(result.releaseSelection.path), true);
});
test('live Compose gates consume the built SQLite contract version', () => {
const preflight = fs.readFileSync(
path.join(ROOT, 'scripts/ql3-local-compose-preflight-live-contract.cjs'),
'utf8',
);
const rollout = fs.readFileSync(
path.join(ROOT, 'scripts/ql3-local-compose-rollout-live-contract.cjs'),
'utf8',
);
for (const source of [preflight, rollout]) {
assert.match(source, /LOCAL_SQLITE_CONTRACT_VERSION/);
assert.doesNotMatch(source, /contractVersion !== [0-9]+/);
}
assert.match(rollout, /LOCAL_SQLITE_WRITE_CONTRACT_VERSION/);
assert.doesNotMatch(rollout, /sqliteWriteContract: [0-9]+/);
});
@@ -75,7 +75,7 @@ function localReport(scope, catalog, profile) {
composeMerge: true,
rolloutActive: true,
durableReceipt: true,
sqliteWriteContract: 37,
sqliteWriteContract: 50,
sqliteBackup: true,
sqliteWriteObservation: { committed: true },
sqliteRestorePrepared: true,
@@ -259,6 +259,9 @@ test('rejects synthetic, incomplete and unclean deployment reports', () => {
(input) => {
input.local.standalone.value.gracefulCleanup = false;
},
(input) => {
input.local.edge.value.sqliteWriteContract = 0;
},
(input) => {
input.cluster.report.value.receiptAuditCompatible = false;
},
@@ -275,6 +278,15 @@ test('rejects synthetic, incomplete and unclean deployment reports', () => {
}
});
test('requires one bounded SQLite write contract across Local profiles', () => {
const input = structuredClone(fixture('local').input);
input.local.standalone.value.sqliteWriteContract = 49;
assert.throws(
() => createDeploymentReadinessReceipt(input),
/different SQLite write contracts/,
);
});
test('rejects tampered, recomputed or authority-detached receipts', () => {
const { receipt } = fixture('all');
const tampered = structuredClone(receipt);
@@ -137,7 +137,7 @@ function localReport(profile, consumption, marker) {
composeMerge: true,
rolloutActive: true,
durableReceipt: true,
sqliteWriteContract: 37,
sqliteWriteContract: 50,
sqliteBackup: true,
sqliteWriteObservation: { rows: 1 },
sqliteRestorePrepared: true,