feat(ql3): add owner-private cluster operator context

This commit is contained in:
whyour
2026-08-13 00:08:42 +08:00
parent 2934123155
commit ea3bbe35c3
14 changed files with 741 additions and 8 deletions
@@ -101,6 +101,44 @@ test('requires the bounded Cluster product facade and image entrypoint', () => {
);
});
test('ships a path-only Cluster operator context example without durable authority', () => {
const example = JSON.parse(
fs.readFileSync(
path.join(
ROOT,
'deploy/kubernetes/ql3-cluster/operator-context.example.json',
),
'utf8',
),
);
assert.deepEqual(Object.keys(example).sort(), ['commands', 'schemaVersion']);
assert.equal(example.schemaVersion, 1);
assert.deepEqual(Object.keys(example.commands).sort(), [
'approval',
'automation',
'model-credential',
'package',
'package-kubernetes',
'run',
'worker-credential',
]);
for (const [name, command] of Object.entries(example.commands)) {
assert.deepEqual(
Object.keys(command).sort(),
name === 'package-kubernetes'
? ['configFile', 'kubernetesFile']
: ['configFile'],
);
for (const value of Object.values(command)) {
assert.match(value, /^\/secure\/qinglong3\/[a-z0-9-]+\.json$/);
}
}
assert.doesNotMatch(
JSON.stringify(example),
/assertion|commandFile|privateKey|token|password|secret/i,
);
});
test('keeps Cluster AI optional with projected authority and an independent digest', () => {
const defaultEnabled = auditClusterDeployment({
root: ROOT,
@@ -27,6 +27,7 @@ test('accepts the reviewed native CI and digest release contracts', () => {
nativeArchitectures: ['amd64', 'arm64'],
runtimeInventory: true,
clusterAdminProductFacade: true,
clusterAdminOperatorContext: true,
ociAttestations: true,
osVulnerabilityScan: {
scanner: 'trivy@0.70.0',
@@ -110,6 +111,21 @@ test('rejects removal of the native Cluster Admin product facade gate', () => {
);
});
test('rejects a Cluster Admin live gate that omits operator context injection', () => {
const contract = fs.readFileSync(
path.join(root, 'scripts/ql3-cluster-admin-product-live-contract.cjs'),
'utf8',
);
assert.throws(
() =>
auditClusterImageCiWorkflow(
ciSource,
contract.replace('operatorContext: true', 'operatorContext: false'),
),
/owner-private operator context injection/,
);
});
test('rejects removal of the native cluster-admin image gate', () => {
const mutated = ciSource.replace(
'image_arch: arm64\n image: admin',
+2 -2
View File
@@ -340,10 +340,10 @@ test('current QL3 workspace has exactly eighteen reviewed package boundaries', (
rootSourceFileRoles: clusterAdmin.rootSourceFileRoles,
},
{
sourceFiles: 96,
sourceFiles: 97,
rootSourceFiles: 1,
rootSourceLines: 61,
nestedSourceFiles: 95,
nestedSourceFiles: 96,
rootSourceFileRoles: {
'modelInvocationMigrationCli.ts': 'binary_entry',
},