From 03011f93cfcbb4f58c45ff9d6a49b5d4b651c136 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 10 Jul 2026 16:20:26 +0100 Subject: [PATCH] Pin public conformance evidence workspace --- README.md | 12 +++++-- conformance-workspace.lock.json | 13 ++++++++ package.json | 2 +- scripts/materialize-workspace.ps1 | 28 ++++++++++++++++ scripts/run-conformance.ps1 | 6 ++-- tools/conformance/consume-export.mjs | 25 ++++++++++++++ tools/conformance/verify-workspace-lock.mjs | 28 ++++++++++++++++ tools/parity/run-parity.mjs | 36 +++++++++++++++------ 8 files changed, 136 insertions(+), 14 deletions(-) create mode 100644 conformance-workspace.lock.json create mode 100644 scripts/materialize-workspace.ps1 create mode 100644 tools/conformance/verify-workspace-lock.mjs diff --git a/README.md b/README.md index b66f2ed..33572e6 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,14 @@ implementation bodies. powershell -ExecutionPolicy Bypass -File .\scripts\run-conformance.ps1 ``` -The default workspace assumes sibling repositories under `E:\Projects`. Set -`EVE_KERNEL_ROOT` when the Eve checkout lives elsewhere. +The checked-in `conformance-workspace.lock.json` pins every owner repository to +an immutable public Git commit. Materialize that evidence set, then run it: +```powershell +$workspace = powershell -ExecutionPolicy Bypass -File .\scripts\materialize-workspace.ps1 +powershell -ExecutionPolicy Bypass -File .\scripts\run-conformance.ps1 -WorkspaceRoot $workspace +``` + +For development, `-WorkspaceRoot E:\Projects` verifies sibling checkouts only +when every checkout already matches the lock. Local branch state is never +accepted as released conformance evidence. diff --git a/conformance-workspace.lock.json b/conformance-workspace.lock.json new file mode 100644 index 0000000..b5cd54d --- /dev/null +++ b/conformance-workspace.lock.json @@ -0,0 +1,13 @@ +{ + "schema": "gamecult.eve.conformance_workspace_lock.v1", + "repositories": [ + { "name": "Aetheria", "url": "https://github.com/GameCult/Aetheria.git", "commit": "2b276a95b47b6ff6fc4c36dd2c34d45cfa765079" }, + { "name": "Eve", "url": "https://github.com/GameCult/Eve.git", "commit": "98a92111817a3d1705d69067e9fcaed7e9b69454" }, + { "name": "EveElectron", "url": "https://github.com/GameCult/EveElectron.git", "commit": "56d439e84bbbc25878527b73104d04c600997ed4" }, + { "name": "EveFlutter", "url": "https://github.com/GameCult/EveFlutter.git", "commit": "5998044f2b0ef206a43d80fdb64a1acd0830bb85" }, + { "name": "EvePlugins", "url": "https://github.com/GameCult/EvePlugins.git", "commit": "97bbbcdc612ef9941e3196ab8f3a84cf7696f707" }, + { "name": "EveUnity", "url": "https://github.com/GameCult/EveUnity.git", "commit": "d96ceeeec9432f67c0aa10df0780e36c1279929f" }, + { "name": "Norn", "url": "https://github.com/GameCult/Norn.git", "commit": "c33598d97c6cc8636984008bc739ebd16e612946" }, + { "name": "Sai", "url": "https://github.com/GameCult/Sai.git", "commit": "2e7be7e9f90e1eebce09538aff34c207820f41aa" } + ] +} diff --git a/package.json b/package.json index 3d70e27..e9db33c 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "private": true, "type": "module", "scripts": { + "materialize": "powershell -ExecutionPolicy Bypass -File ./scripts/materialize-workspace.ps1", "test": "powershell -ExecutionPolicy Bypass -File ./scripts/run-conformance.ps1" } } - diff --git a/scripts/materialize-workspace.ps1 b/scripts/materialize-workspace.ps1 new file mode 100644 index 0000000..8f6fd7e --- /dev/null +++ b/scripts/materialize-workspace.ps1 @@ -0,0 +1,28 @@ +param( + [string] $WorkspaceRoot = "artifacts\workspace", + [string] $LockPath = "conformance-workspace.lock.json" +) + +$ErrorActionPreference = "Stop" +$env:GIT_LFS_SKIP_SMUDGE = "1" +$repoRoot = Split-Path -Parent $PSScriptRoot +$lock = Get-Content -Raw -LiteralPath (Join-Path $repoRoot $LockPath) | ConvertFrom-Json +$workspace = if ([IO.Path]::IsPathRooted($WorkspaceRoot)) { $WorkspaceRoot } else { Join-Path $repoRoot $WorkspaceRoot } +New-Item -ItemType Directory -Force -Path $workspace | Out-Null + +foreach ($repository in $lock.repositories) { + $target = Join-Path $workspace $repository.name + if (-not (Test-Path (Join-Path $target ".git"))) { + git clone --filter=blob:none --no-checkout $repository.url $target + } + git -C $target remote set-url origin $repository.url + git -C $target fetch --depth 1 origin $repository.commit + git -C $target checkout --detach --force $repository.commit + $actual = git -C $target rev-parse HEAD + if ($actual -ne $repository.commit) { + throw "$($repository.name) resolved $actual instead of $($repository.commit)." + } + Write-Host "$($repository.name) $actual" +} + +Write-Output (Resolve-Path $workspace).Path diff --git a/scripts/run-conformance.ps1 b/scripts/run-conformance.ps1 index 2a09c94..45e056c 100644 --- a/scripts/run-conformance.ps1 +++ b/scripts/run-conformance.ps1 @@ -1,11 +1,12 @@ param( - [string] $KernelRoot = $(if ($env:EVE_KERNEL_ROOT) { $env:EVE_KERNEL_ROOT } else { "E:\Projects\Eve" }), + [string] $WorkspaceRoot = $(if ($env:EVE_WORKSPACE_ROOT) { $env:EVE_WORKSPACE_ROOT } else { Split-Path -Parent (Split-Path -Parent $PSScriptRoot) }), [string] $OutputDirectory = "artifacts\parity" ) $ErrorActionPreference = "Stop" $repoRoot = Split-Path -Parent $PSScriptRoot -$env:EVE_KERNEL_ROOT = (Resolve-Path $KernelRoot).Path +$env:EVE_WORKSPACE_ROOT = (Resolve-Path $WorkspaceRoot).Path +$env:EVE_KERNEL_ROOT = Join-Path $env:EVE_WORKSPACE_ROOT "Eve" $env:EVE_PARITY_OUTPUT = if ([IO.Path]::IsPathRooted($OutputDirectory)) { $OutputDirectory } else { @@ -15,6 +16,7 @@ $env:EVE_CONFORMANCE_OUTPUT = Join-Path $repoRoot "artifacts\conformance" Push-Location $repoRoot try { + node .\tools\conformance\verify-workspace-lock.mjs $env:EVE_WORKSPACE_ROOT node .\tools\parity\run-parity.mjs node .\tools\conformance\consume-export.mjs .\artifacts\conformance\latest } finally { diff --git a/tools/conformance/consume-export.mjs b/tools/conformance/consume-export.mjs index 140c97b..a500cfc 100644 --- a/tools/conformance/consume-export.mjs +++ b/tools/conformance/consume-export.mjs @@ -92,6 +92,7 @@ function validateIndex(index, directory, expectations, errors) { if (index.schema !== "gamecult.eve.conformance_export.v1") { errors.push(`schema:expected gamecult.eve.conformance_export.v1 got ${index.schema || ""}`); } + validateEvidenceLock(index.evidenceLock, errors); const packs = Array.isArray(index.packs) ? index.packs : []; const packIds = new Set(packs.map(pack => pack.id)); @@ -887,6 +888,30 @@ function validateIndex(index, directory, expectations, errors) { } } +function validateEvidenceLock(lock, errors) { + if (lock?.schema !== "gamecult.eve.conformance_workspace_lock.v1") { + errors.push(`evidenceLock:schema:expected gamecult.eve.conformance_workspace_lock.v1 got ${lock?.schema || "missing"}`); + } + if (!/^[a-f0-9]{64}$/.test(lock?.sha256 || "")) { + errors.push("evidenceLock:sha256:invalid"); + } + if (!Array.isArray(lock?.repositories) || !lock.repositories.length) { + errors.push("evidenceLock:repositories:missing"); + return; + } + const names = new Set(); + for (const [index, repository] of lock.repositories.entries()) { + for (const field of ["name", "url", "commit"]) { + if (!repository?.[field]) errors.push(`evidenceLock:repositories:${index}:${field}:missing`); + } + if (!/^[a-f0-9]{40}$/.test(repository?.commit || "")) { + errors.push(`evidenceLock:repositories:${index}:commit:invalid`); + } + if (names.has(repository?.name)) errors.push(`evidenceLock:repositories:${repository.name}:duplicate`); + names.add(repository?.name); + } +} + function readFileSyncUtf8(filePath) { return readFileSync(filePath, "utf8"); } diff --git a/tools/conformance/verify-workspace-lock.mjs b/tools/conformance/verify-workspace-lock.mjs new file mode 100644 index 0000000..7f42b4e --- /dev/null +++ b/tools/conformance/verify-workspace-lock.mjs @@ -0,0 +1,28 @@ +import { execFileSync } from "node:child_process"; +import { readFile } from "node:fs/promises"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../.."); +const workspaceRoot = path.resolve(process.argv[2] || process.env.EVE_WORKSPACE_ROOT || path.dirname(repoRoot)); +const lock = JSON.parse(await readFile(path.join(repoRoot, "conformance-workspace.lock.json"), "utf8")); + +if (lock.schema !== "gamecult.eve.conformance_workspace_lock.v1") { + throw new Error(`Unexpected workspace lock schema: ${lock.schema || "missing"}`); +} + +for (const repository of lock.repositories) { + if (!repository.name || !/^https:\/\/github\.com\/GameCult\/.+\.git$/.test(repository.url || "")) { + throw new Error(`Invalid repository coordinate: ${repository.name || "unnamed"}`); + } + if (!/^[a-f0-9]{40}$/.test(repository.commit || "")) { + throw new Error(`Invalid commit for ${repository.name}`); + } + const checkout = path.join(workspaceRoot, repository.name); + const actual = execFileSync("git", ["-C", checkout, "rev-parse", "HEAD"], { encoding: "utf8" }).trim(); + if (actual !== repository.commit) { + throw new Error(`${repository.name} is ${actual}; lock requires ${repository.commit}`); + } +} + +console.log(`Verified ${lock.repositories.length} locked repositories in ${workspaceRoot}`); diff --git a/tools/parity/run-parity.mjs b/tools/parity/run-parity.mjs index f33a0b7..204b048 100644 --- a/tools/parity/run-parity.mjs +++ b/tools/parity/run-parity.mjs @@ -1,12 +1,16 @@ import { mkdir, readFile, writeFile } from "node:fs/promises"; import { existsSync, readFileSync } from "node:fs"; +import { createHash } from "node:crypto"; import path from "node:path"; import { fileURLToPath, pathToFileURL } from "node:url"; const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../.."); const manifestPath = path.join(repoRoot, "tools/parity/parity-manifest.json"); +const workspaceRoot = process.env.EVE_WORKSPACE_ROOT + ? path.resolve(process.env.EVE_WORKSPACE_ROOT) + : path.dirname(repoRoot); const kernelRoot = process.env.EVE_KERNEL_ROOT ? path.resolve(process.env.EVE_KERNEL_ROOT) - : repoRoot; + : path.join(workspaceRoot, "Eve"); const { compileEveDsl } = await import(pathToFileURL(path.join(kernelRoot, "web/eve-dsl.js"))); const outputRoot = process.env.EVE_PARITY_OUTPUT ? path.resolve(process.env.EVE_PARITY_OUTPUT) @@ -14,6 +18,13 @@ const outputRoot = process.env.EVE_PARITY_OUTPUT const conformanceOutputRoot = process.env.EVE_CONFORMANCE_OUTPUT ? path.resolve(process.env.EVE_CONFORMANCE_OUTPUT) : path.join(repoRoot, "artifacts/conformance"); +const evidenceLockBytes = await readFile(path.join(repoRoot, "conformance-workspace.lock.json")); +const evidenceLockDocument = JSON.parse(evidenceLockBytes); +const evidenceLock = { + schema: evidenceLockDocument.schema, + sha256: createHash("sha256").update(evidenceLockBytes).digest("hex"), + repositories: evidenceLockDocument.repositories, +}; const manifest = JSON.parse(await readFile(manifestPath, "utf8")); const stamp = new Date().toISOString().replace(/[:.]/g, "-"); @@ -35,6 +46,7 @@ const report = { schema: "gamecult.eve.parity_report.v1", generatedAt: new Date().toISOString(), manifest: path.relative(repoRoot, manifestPath).replaceAll("\\", "/"), + evidenceLock, repoStrategy: { ...(manifest.repoStrategy || {}), conformanceHandoffErrors, @@ -50,7 +62,7 @@ const report = { }; const conformanceExport = buildConformanceExport(report); const conformanceExportErrors = validateSchemaSubset( - JSON.parse(await readFile(path.join(repoRoot, manifest.schemas["gamecult.eve.conformance_export.v1"]), "utf8")), + JSON.parse(await readFile(resolveWorkspacePath(manifest.schemas["gamecult.eve.conformance_export.v1"]), "utf8")), conformanceExport, "conformanceExport", ); @@ -594,7 +606,7 @@ function resolveCatalogPath(catalogDirectory, candidate) { async function evaluatePlugin(plugin, fixtureResults) { const expectedPaths = plugin.expectedPaths || []; - const missingPaths = expectedPaths.filter(candidate => !existsSync(path.join(repoRoot, candidate))); + const missingPaths = expectedPaths.filter(candidate => !existsSync(resolveWorkspacePath(candidate))); const requiredFixtures = plugin.requiredFixtures || []; const missingRequiredFixtures = requiredFixtures.filter(id => !fixtureResults.some(fixture => fixture.id === id && fixture.status === "pass")); const missingIncubationFields = requiredIncubationFields(plugin).filter(field => !plugin[field]); @@ -1031,12 +1043,17 @@ async function readJsonDocument(documentPath) { } function resolveOwnedPath(owner, candidate) { - return path.resolve(repoRoot, owner?.sourceRoot || ".", candidate); + return resolveWorkspacePath(path.join(owner?.sourceRoot || ".", candidate)); } function resolveWorkspacePath(candidate) { + if (path.isAbsolute(candidate)) return candidate; + const normalized = candidate.replaceAll("\\", "/"); + if (normalized.startsWith("../")) { + return path.resolve(workspaceRoot, normalized.slice(3)); + } const localPath = path.resolve(repoRoot, candidate); - if (existsSync(localPath) || candidate.startsWith("..")) return localPath; + if (existsSync(localPath)) return localPath; return path.resolve(kernelRoot, candidate); } @@ -1718,7 +1735,7 @@ function resolveRuntimeOwnedPath(runtime, candidate) { if (!candidate) return repoRoot; if (path.isAbsolute(candidate)) return candidate; const sourceRoot = runtime?.sourceRoot || "."; - return path.resolve(repoRoot, sourceRoot, candidate); + return resolveWorkspacePath(path.join(sourceRoot, candidate)); } function compareDependencyRecords(expectedRecords, actualRecords, label, keys) { @@ -1872,7 +1889,7 @@ function evaluateSplitTargets(splitTargets, runtimeResults) { } for (const proof of proofs) { - const missingEvidence = (proof.evidencePaths || []).filter(candidate => !existsSync(path.join(repoRoot, candidate))); + const missingEvidence = (proof.evidencePaths || []).filter(candidate => !existsSync(resolveWorkspacePath(candidate))); if (proof.status !== "passed") { const description = proof.description || "unnamed"; addBlocker(`proof:${description}:status:${proof.status || "missing"}`, { @@ -1960,7 +1977,7 @@ async function validateCommandDescriptors(fixture, commandDescriptors) { if (!fixture.expect.commandDescriptorSchema) return []; const schemaPath = manifest.schemas?.[fixture.expect.commandDescriptorSchema]; if (!schemaPath) return [`${fixture.expect.commandDescriptorSchema}:schemaPath:missing`]; - const absoluteSchemaPath = path.join(repoRoot, schemaPath); + const absoluteSchemaPath = resolveWorkspacePath(schemaPath); if (!existsSync(absoluteSchemaPath)) return [`${schemaPath}:missing`]; const schema = JSON.parse(await readFile(absoluteSchemaPath, "utf8")); return commandDescriptors.flatMap(command => @@ -2133,6 +2150,7 @@ function buildConformanceExport(report) { schema: "gamecult.eve.conformance_export.v1", generatedAt: report.generatedAt, sourceManifest: report.manifest, + evidenceLock: report.evidenceLock, boundaryRule: report.repoStrategy.boundaryRule || "", incubationPolicy: report.repoStrategy.incubationPolicy || "", schemaCatalog: buildSchemaCatalog(), @@ -3039,7 +3057,7 @@ function validateRuntimeCaptureArtifacts(runtime, capture) { } if (artifact.schema && manifest.schemas?.[artifact.schema]) { try { - const schema = JSON.parse(readFileSync(path.join(repoRoot, manifest.schemas[artifact.schema]), "utf8")); + const schema = JSON.parse(readFileSync(resolveWorkspacePath(manifest.schemas[artifact.schema]), "utf8")); errors.push(...validateSchemaSubset(schema, document, `captureArtifact:${artifactPath}`)); } catch (error) { errors.push(`${manifest.schemas[artifact.schema]}:unreadable:${error instanceof Error ? error.message : String(error)}`);