mirror of
https://git.openapi.site/https://github.com/desirecore/registry.git
synced 2026-12-06 03:39:05 +08:00
feat(registry): 同步算力插件固定发布契约
This commit is contained in:
1 parent
bd10c618b8
commit
3cf0d947a8
5 files changed
+325
-8
No files matched your search
@@ -22,7 +22,7 @@ test('根格式仍为4.2,作者Schema保持主仓固定字节,合成fixtures
|
||||
assert.equal(root.version,'4.2.0')
|
||||
assert.equal(readFileSync(join(source,'SCHEMA_VERSION'),'utf8').trim(),'4.2.0')
|
||||
assert.equal(root.stats.webBundles,undefined)
|
||||
assert.equal(createHash('sha256').update(readFileSync(join(source,'schemas/registry-entry.v4.3.schema.json'))).digest('hex'),'95afcffce0c985215685554ec8b3f5e3012036bf2c4ecc4214c23e4eff895b10')
|
||||
assert.equal(createHash('sha256').update(readFileSync(join(source,'schemas/registry-entry.v4.3.schema.json'))).digest('hex'),'27a7f86b82f5d88bfe1eae2d083540359ed8f2fccffa8f3d040fdc58d0cf3900')
|
||||
for (const id of readdirSync(join(source,'fixtures/authoring/entries'))) assert.equal(existsSync(join(source,'entries',id)),false,id)
|
||||
})
|
||||
test('静态与带服务合成目录三文件保持App语义,两个validator同样通过',() => {
|
||||
|
||||
@@ -88,6 +88,34 @@ test('官方根仍为4.2且global Schema保留已发布原字节', () => {
|
||||
assert.equal(createHash('sha256').update(readFileSync(join(source, 'schemas/registry-entry.schema.json'))).digest('hex'), 'ea63d6305ae17994e595aea009a131c41300d2b7fdb07ec83cc2c19c37b32038')
|
||||
})
|
||||
for (const type of ['native-app', 'web-bundle']) test('两个入口接受固定内联定义 ' + type, () => { expectValid(fixture(type)) })
|
||||
test('两个入口接受固定发布的算力插件并校验 sidecar 声明', () => {
|
||||
const root = fixture()
|
||||
const extension = {
|
||||
apiVersion: '1.0.0',
|
||||
hosts: ['agent-service'],
|
||||
runtime: {
|
||||
kind: 'service',
|
||||
protocol: 'mcp',
|
||||
descriptorRef: { path: 'runtime.json', sha256: 'a'.repeat(64) },
|
||||
},
|
||||
contributes: [{
|
||||
id: 'provider',
|
||||
point: 'compute.providers',
|
||||
contractVersion: 1,
|
||||
definitionRef: { path: 'provider.json', sha256: 'b'.repeat(64) },
|
||||
}],
|
||||
}
|
||||
const placementPolicy = { showInMyApps: false, allowNavPin: false, allowAgentBinding: false }
|
||||
mutate(root, entryFile, entry => {
|
||||
Object.assign(entry, { productKind: 'plugin', extension, entrypoints: [], placementPolicy })
|
||||
})
|
||||
mutate(root, sidecarFile, sidecar => {
|
||||
Object.assign(sidecar.spec, { productKind: 'plugin', extension, entrypointKinds: [], placementPolicy })
|
||||
})
|
||||
expectValid(root)
|
||||
mutate(root, sidecarFile, sidecar => { sidecar.spec.extension.contributes[0].definitionRef.sha256 = 'c'.repeat(64) })
|
||||
assert.ok(validateRegistry(root).errors.some(error => error.code === 'extension-mismatch'))
|
||||
})
|
||||
test('旧独立definitionPath分支继续通过', () => {
|
||||
const root = fixture()
|
||||
mutate(root, entryFile, entry => { delete entry.appRelease.definitionSource; entry.appRelease.definitionPath = 'definition.json' })
|
||||
|
||||
Reference in new issue
Block a user