import assert from 'node:assert/strict' import { readFile } from 'node:fs/promises' import test from 'node:test' const registryUrl = new URL('../contracts/gls-runtime-registry.json', import.meta.url) test('compiled GLS v2 manifest reconciles current registration sources without executing raw text', async () => { const registry = JSON.parse(await readFile(registryUrl, 'utf8')) assert.equal(registry.schema, 'hololake.gls-runtime-manifest/v2') assert.equal(registry.source.repository, 'REPO-012') assert.equal(registry.source.commit, '2598fbfba8caf64c7ab9740a3036c5aab977502e') assert.equal(registry.source.authority_files.length, 4) 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.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))) assert.equal(registry.reconciliation.protocol_registry_id_count, 52) assert.equal(registry.reconciliation.existing_registered_count, 19) assert.equal(registry.reconciliation.registered_draft_count, 33) assert.equal(registry.reconciliation.registered_draft_not_started_count, 21) assert.equal(registry.reconciliation.legacy_dependency_target_count, 57) assert.equal(registry.reconciliation.dependencies_not_in_protocol_registry.length, 19) assert.equal(registry.reconciliation.dependencies_without_numbered_source.length, 24) assert.equal(registry.reconciliation.numbered_sources_not_in_protocol_registry.length, 31) 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) }) test('only explicit deterministic projections enter the runtime enforcement set', async () => { const registry = JSON.parse(await readFile(registryUrl, 'utf8')) const protocols = Object.fromEntries(registry.protocols.map((protocol) => [protocol.id, protocol])) assert.equal(protocols['GLS-0253'].projection_state, 'EXECUTABLE_PROJECTION') assert.equal(protocols['GLS-0253'].adapter, 'zero-core-numbering') 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-0003'], undefined) assert.equal(registry.executable_projection_count, 4) assert.equal(registry.inventoried_not_executable_count, 71) })