chore: snapshot audited HoloLake convergence baseline
This commit is contained in:
parent
7a14c06e41
commit
1b6b17b5ab
47 changed files with 10722 additions and 87 deletions
|
|
@ -0,0 +1,40 @@
|
|||
import assert from 'node:assert/strict'
|
||||
import fs from 'node:fs'
|
||||
import test from 'node:test'
|
||||
|
||||
const read = (path) => fs.readFileSync(new URL('../' + path, import.meta.url), 'utf8')
|
||||
const contract = JSON.parse(read('contracts/native-composition-runtime.json'))
|
||||
const rust = read('src-tauri/src/native_composition.rs')
|
||||
const knowledge = read('src-tauri/src/knowledge_base.rs')
|
||||
const ui = read('src/modules/native-composition/index.tsx')
|
||||
const lib = read('src-tauri/src/lib.rs')
|
||||
|
||||
test('native objects and composition recipes are bounded system contracts', () => {
|
||||
assert.equal(contract.internal_object.schema, 'hololake.native-object/v1')
|
||||
assert.equal(contract.internal_object.script_allowed, false)
|
||||
assert.equal(contract.internal_object.html_allowed, false)
|
||||
assert.equal(contract.recipe.registered_modules_only, true)
|
||||
assert.equal(contract.recipe.directed_acyclic_graph_required, true)
|
||||
assert.equal(contract.recipe.current_account_only, true)
|
||||
assert.match(rust, /HOLOLAKE_COMPOSITION_MODULE_NOT_REGISTERED/)
|
||||
assert.match(rust, /HOLOLAKE_COMPOSITION_PORT_TYPE_MISMATCH/)
|
||||
assert.match(rust, /HOLOLAKE_COMPOSITION_CYCLE_REJECTED/)
|
||||
})
|
||||
|
||||
test('the native core reads only the authenticated HoloLake knowledge snapshot', () => {
|
||||
assert.match(knowledge, /snapshot_for_native_composition/)
|
||||
assert.match(knowledge, /account_storage_root\(app, "knowledge-v1"\)/)
|
||||
assert.match(rust, /snapshot_for_native_composition/)
|
||||
assert.match(rust, /source_is_real_account_data: true/)
|
||||
assert.match(lib, /native_composition::execute_knowledge_native_composition/)
|
||||
})
|
||||
|
||||
test('one execution result can be rendered through every stage-one human projection', () => {
|
||||
assert.deepEqual(contract.human_projection.views, ['DASHBOARD', 'COMPARISON', 'VERTICAL_BAR', 'CLASSIFICATION', 'TABLE'])
|
||||
assert.equal(contract.human_projection.shares_one_execution_result, true)
|
||||
assert.equal(contract.human_projection.owns_source_data, false)
|
||||
assert.equal(contract.human_projection.direct_write_authority, false)
|
||||
for (const label of ['仪表盘', '对比', '柱状图', '分类', '明细表']) assert.match(ui, new RegExp(label))
|
||||
assert.match(ui, /projection\.nativeObject\.rows/)
|
||||
assert.match(ui, /projection\?\.groups/)
|
||||
})
|
||||
Loading…
Reference in a new issue