feat: embed complete GLS protocol kernel in HoloLake

This commit is contained in:
冰朔 2026-08-17 17:56:47 +08:00
commit b8d08fb620
15 changed files with 3515 additions and 485 deletions

View file

@ -14,7 +14,7 @@ test('compiled GLS v2 manifest reconciles current registration sources without e
assert.equal(registry.compiler.raw_protocol_text_executed, false)
assert.equal(registry.compiler.arbitrary_protocol_code_allowed, false)
assert.equal(registry.compiler.unprojected_protocol_behavior, 'INVENTORIED_NOT_EXECUTABLE')
assert.equal(registry.compiler.legacy_untyped_dependency_behavior, 'AUDIT_ONLY_BLOCKS_NEW_ACTIVATION')
assert.equal(registry.compiler.source_dependency_behavior, 'TYPED_AUDIT_ONLY_NEVER_ACTIVATES')
assert.equal(registry.protocol_count, 75)
assert.equal(new Set(registry.protocols.map((protocol) => protocol.id)).size, 75)
assert.ok(registry.protocols.every((protocol) => /^[a-f0-9]{64}$/.test(protocol.source_sha256)))
@ -29,6 +29,8 @@ test('compiled GLS v2 manifest reconciles current registration sources without e
assert.equal(registry.reconciliation.legacy_dependency_cycles.length, 3)
assert.equal(registry.reconciliation.discovered_unreconciled_count, 0)
assert.equal(registry.reconciliation.authority_conflict_count, 0)
assert.equal(registry.reconciliation.unclassified_source_dependency_count, 0)
assert.equal(Object.values(registry.reconciliation.typed_source_dependency_counts).reduce((sum, count) => sum + count, 0), 183)
})
test('only explicit deterministic projections enter the runtime enforcement set', async () => {
@ -40,10 +42,29 @@ test('only explicit deterministic projections enter the runtime enforcement set'
assert.ok(protocols['GLS-0253'].event_kinds.includes('IDENTITY_ROUTE'))
assert.ok(protocols['GLS-0253'].dependency_edges.every((edge) => edge.edge_kind === 'RUNTIME_REQUIRES'))
assert.equal(protocols['GLS-0130'].registration.state, 'REGISTERED_PROTOCOL_REGISTRY')
assert.equal(protocols['GLS-0130'].contract_kind, 'COMPILER_OR_INTERMEDIATE_REPRESENTATION')
assert.ok(protocols['GLS-0130'].dependency_edges.some((edge) => edge.target === 'GLS-0131' && edge.edge_kind === 'LEGACY_UNTYPED_REFERENCE' && !edge.enters_runtime_graph))
assert.ok(protocols['GLS-0130'].activation_blockers.includes('LEGACY_DEPENDENCIES_REQUIRE_TYPED_REVIEW'))
assert.equal(protocols['GLS-0130'].contract_kind, 'BOOTSTRAP_HLDP_TO_GIR_COMPILER')
assert.ok(protocols['GLS-0130'].dependency_edges.some((edge) => edge.target === 'GLS-0131' && edge.edge_kind === 'BUILD_REQUIRES' && !edge.enters_runtime_graph))
assert.ok(protocols['GLS-0130'].dependency_edges.some((edge) => edge.target === 'GLS-0411' && edge.edge_kind === 'BUILD_REQUIRES' && !edge.enters_runtime_graph))
assert.equal(protocols['GLS-0130'].implementation_stage, 'P6')
assert.equal(protocols['GLS-0003'], undefined)
assert.equal(registry.executable_projection_count, 4)
assert.equal(registry.inventoried_not_executable_count, 71)
assert.equal(registry.executable_projection_count, 25)
assert.equal(registry.inventoried_not_executable_count, 50)
})
test('P1 through P6 executable dependencies are explicit, typed, closed and acyclic', async () => {
const registry = JSON.parse(await readFile(registryUrl, 'utf8'))
const executable = new Map(registry.protocols.filter((protocol) => protocol.projection_state === 'EXECUTABLE_PROJECTION').map((protocol) => [protocol.id, protocol]))
assert.deepEqual(new Set([...executable.values()].map((protocol) => protocol.implementation_stage)), new Set(['P0', 'P1', 'P2', 'P3', 'P4', 'P5', 'P6']))
assert.ok([...executable.values()].every((protocol) => protocol.dependency_edges.filter((edge) => edge.enters_runtime_graph).every((edge) => edge.edge_kind === 'RUNTIME_REQUIRES' && executable.has(edge.target))))
const visiting = new Set()
const visited = new Set()
const visit = (id) => {
assert.equal(visiting.has(id), false, `runtime cycle at ${id}`)
if (visited.has(id)) return
visiting.add(id)
for (const dependency of executable.get(id).dependencies) visit(dependency)
visiting.delete(id)
visited.add(id)
}
for (const id of executable.keys()) visit(id)
})