mirror of
https://git.openapi.site/https://github.com/desirecore/config-center.git
synced 2026-07-23 03:13:20 +08:00
feat(runtimes): 新增推荐运行时清单与离线兜底版本清单 (#44)
- runtimes/recommended.json:Python 3.13.9 (hatch 1.16.5 pin) + Node.js 24.18.0 LTS, 含 6 平台归档路径与 SHA-256,供主仓库构建时打包离线运行时与首启导入 - runtimes/versions-fallback.json:Node/Python/包管理器版本快照, 客户端联网查询失败时的兜底列表 - schemas + validate.mjs 映射 + 测试(与主仓库 lib/schemas/agent-service/runtime-manifest.ts 同源导出) - 不递增 presetDataVersion:runtimes/ 由客户端直接读取,不参与 compute.json 合并
This commit is contained in:
@@ -91,6 +91,44 @@ describe('真实数据全量校验', () => {
|
||||
assert.equal(r1.ok, true, JSON.stringify(r1.errors, null, 2))
|
||||
assert.equal(r2.ok, true, JSON.stringify(r2.errors, null, 2))
|
||||
})
|
||||
|
||||
it('runtimes/recommended.json 应通过 runtime-recommended schema', () => {
|
||||
const result = validateFile(join(ROOT, 'runtimes', 'recommended.json'), validators)
|
||||
assert.equal(result.ok, true, JSON.stringify(result.errors, null, 2))
|
||||
})
|
||||
|
||||
it('runtimes/versions-fallback.json 应通过 runtime-versions-fallback schema', () => {
|
||||
const result = validateFile(join(ROOT, 'runtimes', 'versions-fallback.json'), validators)
|
||||
assert.equal(result.ok, true, JSON.stringify(result.errors, null, 2))
|
||||
})
|
||||
})
|
||||
|
||||
// ==================== Runtime 清单反例 ====================
|
||||
|
||||
describe('runtime-recommended schema 反例', () => {
|
||||
const validate = compile('runtime-recommended')
|
||||
|
||||
function makeValidManifest() {
|
||||
return JSON.parse(readFileSync(join(ROOT, 'runtimes', 'recommended.json'), 'utf8'))
|
||||
}
|
||||
|
||||
it('拒绝缺少平台归档(archives 六平台必填)', () => {
|
||||
const data = makeValidManifest()
|
||||
delete data.node.archives['win32-arm64']
|
||||
assert.equal(validate(data), false)
|
||||
})
|
||||
|
||||
it('拒绝非法 sha256(长度/字符集不符)', () => {
|
||||
const data = makeValidManifest()
|
||||
data.python.sha256['darwin-arm64'] = 'not-a-sha'
|
||||
assert.equal(validate(data), false)
|
||||
})
|
||||
|
||||
it('拒绝未知字段(additionalProperties: false 保护老客户端)', () => {
|
||||
const data = makeValidManifest()
|
||||
data.unknownField = true
|
||||
assert.equal(validate(data), false)
|
||||
})
|
||||
})
|
||||
|
||||
// ==================== Provider schema 反例 ====================
|
||||
|
||||
Reference in New Issue
Block a user