Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test([issue-9798]): add opt-in real Eidoverse acceptance workflow

[._.]/ Adam Eivycd42e42ddaa9
diff --git a/.github/workflows/eidoverse-acceptance.yml b/.github/workflows/eidoverse-acceptance.yml
new file mode 100644
index 0000000000..2087af9572
--- /dev/null
+++ b/.github/workflows/eidoverse-acceptance.yml
@@ -0,0 +1,127 @@
+name: Eidoverse real acceptance (opt-in)
+
+on:
+ workflow_dispatch:
+ inputs:
+ reviewed_source:
+ description: Reviewed pinned upstream source, AGPL/GPL and bundled asset terms; authorize these two builds
+ type: boolean
+ required: true
+ default: false
+
+permissions:
+ contents: read
+
+concurrency:
+ group: eidoverse-acceptance-${{ github.ref }}
+ cancel-in-progress: false
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ acceptance:
+ # Free standard public-repository runner only. Its documented 14GB storage
+ # is NOT a guarantee of the 60GiB prerequisite. Fail unavailable if short.
+ runs-on: ubuntu-24.04
+ timeout-minutes: 120
+ env:
+ PORTOS_EIDOVERSE_LIVE: '1'
+ PORTOS_EIDOVERSE_SOURCE_REVIEWED: ${{ inputs.reviewed_source && '1' || '0' }}
+ EIDOVERSE_REPORT: ${{ runner.temp }}/eidoverse-acceptance-report.json
+ NODE_ENV: test
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ persist-credentials: false
+ - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
+ with:
+ node-version: 24.x
+
+ - name: Read-only native host and resource preflight
+ run: node scripts/eidoverse-acceptance.js --preflight --report "$EIDOVERSE_REPORT"
+
+ - name: Require source and license review
+ id: source_review
+ run: test "$PORTOS_EIDOVERSE_SOURCE_REVIEWED" = 1
+
+ - name: Independent pinned upstream source
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ repository: anima-research/eidoverse-video
+ ref: 959a95c3d3963c334422d170317062e00936c573
+ path: eidoverse-upstream
+ persist-credentials: false
+
+ - name: Install acceptance dependencies without lifecycle scripts
+ run: npm ci --ignore-scripts --prefix server
+
+ - name: Build render-only base and PortOS adapter
+ id: build
+ timeout-minutes: 55
+ run: |
+ upstream_sha=959a95c3d3963c334422d170317062e00936c573
+ test "$(git -C eidoverse-upstream rev-parse HEAD)" = "$upstream_sha"
+ docker build --label "org.portos.eidoverse.upstream=$upstream_sha" \
+ -f eidoverse-upstream/docker/Dockerfile --build-arg AGENT=none \
+ -t eidoverse:render eidoverse-upstream/docker
+ docker build --label "org.portos.eidoverse.upstream=$upstream_sha" \
+ --label "org.portos.eidoverse.portos=$GITHUB_SHA" \
+ -f docker/eidoverse-video/Dockerfile -t portos-eidoverse-video:1 eidoverse-upstream
+
+ - name: Real production render, decoded geometry, audio and cleanup
+ timeout-minutes: 62
+ run: node scripts/eidoverse-acceptance.js --live --upstream eidoverse-upstream --report "$EIDOVERSE_REPORT"
+
+ - name: Per-criterion report (never turn unavailable into green)
+ if: always()
+ run: |
+ if test -f "$EIDOVERSE_REPORT"; then
+ if test '${{ steps.source_review.outcome }}' = failure; then
+ node scripts/eidoverse-acceptance.js --source-unavailable --report "$EIDOVERSE_REPORT"
+ elif test '${{ steps.build.outcome }}' = failure; then
+ node scripts/eidoverse-acceptance.js --build-failed --report "$EIDOVERSE_REPORT"
+ else
+ node scripts/eidoverse-acceptance.js --summary --report "$EIDOVERSE_REPORT"
+ fi
+ else
+ echo 'Acceptance unavailable: setup did not produce a report.' >> "$GITHUB_STEP_SUMMARY"
+ exit 2
+ fi
+
+ - name: Bound synthetic evidence before upload
+ id: evidence_bound
+ if: always()
+ run: |
+ node --input-type=module <<'NODE'
+ import { lstat, readdir } from 'node:fs/promises';
+ const report = process.env.EIDOVERSE_REPORT;
+ const info = await lstat(report);
+ if (!info.isFile() || info.isSymbolicLink()) throw new Error('Invalid report');
+ let bytes = info.size;
+ if (bytes > 65536) throw new Error('Report exceeds 64KiB');
+ const frames = `${report}.frames`;
+ const names = await readdir(frames).catch(e => { if (e.code === 'ENOENT') return []; throw e; });
+ if (names.length > 6) throw new Error('Too many preview files');
+ for (const name of names) {
+ if (!/^(landscape|portrait)-(0|24|47)\.png$/.test(name)) throw new Error('Unexpected evidence filename');
+ const info = await lstat(`${frames}/${name}`);
+ if (!info.isFile() || info.isSymbolicLink()) throw new Error('Invalid evidence file');
+ bytes += info.size;
+ }
+ if (bytes > 262144) throw new Error('Synthetic evidence exceeds 256KiB');
+ NODE
+
+ - name: Save only bounded synthetic report and decoded previews
+ if: always() && steps.evidence_bound.outcome == 'success'
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+ with:
+ name: eidoverse-synthetic-evidence
+ retention-days: 1
+ if-no-files-found: error
+ path: |
+ ${{ runner.temp }}/eidoverse-acceptance-report.json
+ ${{ runner.temp }}/eidoverse-acceptance-report.json.frames/landscape-*.png
+ ${{ runner.temp }}/eidoverse-acceptance-report.json.frames/portrait-*.png
+ # No image publication, dependency/build caches, or broad artifacts.
diff --git a/docs/EIDOVERSE_VIDEO.md b/docs/EIDOVERSE_VIDEO.md
index 6900f48e24..31fa2fe991 100644
--- a/docs/EIDOVERSE_VIDEO.md
+++ b/docs/EIDOVERSE_VIDEO.md
@@ -65,3 +65,84 @@ CPU, memory and process count, removes the container on cancel/failure, validate
its output, and muxes the master song outside the scene runtime. No uncontained
host execution fallback is provided. Typography and grading controls for HTML
compositions do not apply to this renderer; author those visuals in the scene.
+
+## Opt-in real acceptance (#9798)
+
+`scripts/eidoverse-acceptance.js` is a standalone synthetic acceptance harness.
+It calls production `prepareEidoverseRender` and `encodeEidoverseComposition`;
+Docker, ffmpeg, ffprobe and the renderer are never mocked. It requires a native
+Linux x86_64 host, a local Unix-socket Docker daemon, **8 GiB MemAvailable** and
+**60 GiB free on the Docker-root filesystem** before any build. An inaccessible
+or inadequate prerequisite records `unavailable`, leaves runtime criteria
+`not-run` and exits 2. Preflight success alone is not acceptance.
+
+The manual-only `.github/workflows/eidoverse-acceptance.yml` is a candidate
+free CI route using standard public-repository `ubuntu-24.04`. GitHub documents
+only [14 GB storage for that runner](https://docs.github.com/en/actions/reference/runners/github-hosted-runners),
+so it is **not yet a verified suitable execution host**. The workflow measures
+actual Docker-root space and fails unavailable when short. It never lowers the
+threshold, installs Docker, deletes runner software, changes OS/security settings,
+uses paid runners, publishes images, or saves dependency/build caches.
+It is not dispatched by pushes or pull requests. GitHub requires a manual
+workflow to exist on the default branch before it can be dispatched; a draft PR
+containing this new workflow alone cannot supply a real acceptance run.
+
+Before opting in, review the independent upstream checkout at
+`959a95c3d3963c334422d170317062e00936c573`, its
+[AGPL license](https://github.com/anima-research/eidoverse-video/blob/959a95c3d3963c334422d170317062e00936c573/LICENSE),
+[setup](https://github.com/anima-research/eidoverse-video/blob/959a95c3d3963c334422d170317062e00936c573/docs/SETUP.md)
+and [Dockerfile](https://github.com/anima-research/eidoverse-video/blob/959a95c3d3963c334422d170317062e00936c573/docker/Dockerfile).
+The base fetches GPL ffmpeg, OFL fonts, MIT SeedThree, Python/audio packages and
+Chrome, even with `AGENT=none`; no agent credentials or external rendering service
+are needed. The source commit is pinned, but `ubuntu:rolling` and several package
+downloads remain mutable. A passing run records the exact resulting image IDs
+and PortOS commit, not a claim of bit-for-bit reproducible image builds. The
+workflow's `reviewed_source` input defaults to false and must be explicitly set
+after source/license review before either image build is authorized.
+
+On a separately verified host, use a clean independent checkout at that revision:
+
+```sh
+node scripts/eidoverse-acceptance.js --preflight --report /tmp/eido-acceptance.json
+# Continue only when preflight exits 0 and source/terms review is complete.
+upstream_sha=959a95c3d3963c334422d170317062e00936c573
+portos_sha=$(git rev-parse HEAD)
+docker build --label "org.portos.eidoverse.upstream=$upstream_sha" \
+ -f <upstream-root>/docker/Dockerfile --build-arg AGENT=none \
+ -t eidoverse:render <upstream-root>/docker
+docker build --label "org.portos.eidoverse.upstream=$upstream_sha" \
+ --label "org.portos.eidoverse.portos=$portos_sha" \
+ -f docker/eidoverse-video/Dockerfile -t portos-eidoverse-video:1 <upstream-root>
+NODE_ENV=test PORTOS_EIDOVERSE_SOURCE_REVIEWED=1 PORTOS_EIDOVERSE_LIVE=1 \
+ node scripts/eidoverse-acceptance.js --live --upstream <upstream-root> \
+ --report /tmp/eido-acceptance.json
+```
+
+The two-second films retain production 1280×720 and 1080×1920 geometry at
+24 fps. Independent decoding checks 48 frames, duration, colored box/sphere
+locations and bounds at first/middle/last frames. A stateful moving primitive
+advances each simulation step; a one-second excerpt must match the corresponding
+full-film frames, including state accumulated during pre-roll. A generated
+330/880 Hz master song tests the full timeline and excerpt offset by decoding
+AAC and measuring the expected tone. Cancellation happens only after observing
+that invocation's actual running container. A deliberately failing scene must
+reach its failure marker, reject, remove its container/private scratch and leave
+no complete film. Real `docker inspect` must confirm production containment,
+cached-only dependencies, 8 GiB memory limit and no GPU device mounts.
+
+The JSON report gives each criterion `pass`, `fail`, `unavailable` or `not-run`.
+Successful decoding saves six previews (maximum dimension 320 pixels) beside
+the report in `<report-path>.frames/`; all media and report content are synthetic.
+Reports expose no Docker root, private scratch path, environment or full inspect
+dump. Harness validator tests use synthetic byte buffers to reject black frames,
+banded output, restarted state, wrong tones and unavailable prerequisites; their
+success is preparatory engineering, not real WebGPU evidence.
+The workflow retains only that redacted JSON and the six tiny previews for one
+day, with a 256 KiB total limit; it never uploads films, songs, build logs or
+container dumps. Its job summary records every criterion even when the host is
+unavailable or a build fails.
+
+Each production render has a 12-minute harness watchdog; the workflow bounds
+build time to 55 minutes and the entire job to 120 minutes. This validates Mesa
+software WebGPU/libx264 only and makes no physical-GPU or speed claim. Keep
+#9798 open and blocked until a suitable host passes **every** real criterion.
diff --git a/scripts/eidoverse-acceptance.js b/scripts/eidoverse-acceptance.js
new file mode 100644
index 0000000000..6666dfb71f
--- /dev/null
+++ b/scripts/eidoverse-acceptance.js
@@ -0,0 +1,229 @@
+#!/usr/bin/env node
+/** Opt-in, real production acceptance. No mocks, provider calls or live data. */
+import assert from 'node:assert/strict';
+import { mkdtemp, mkdir, readFile, writeFile, access, rm, appendFile } from 'node:fs/promises';
+import { join, dirname, resolve } from 'node:path';
+import { tmpdir } from 'node:os';
+import { randomUUID } from 'node:crypto';
+import { fileURLToPath } from 'node:url';
+import { setTimeout as delay } from 'node:timers/promises';
+import { isDirectlyInvoked } from './lib/directInvocation.js';
+import { acceptanceScene, syntheticSong } from './fixtures/eidoverseAcceptanceScene.js';
+import { UPSTREAM_SHA, newReport, preflight, run, assertVideo, inspectGeometry, toneRatio, assertContainment } from './lib/eidoverseAcceptance.js';
+
+const REPO = resolve(dirname(fileURLToPath(import.meta.url)), '..');
+const exists = path => access(path).then(() => true, () => false);
+
+async function save(report, path) {
+ await writeFile(path, `${JSON.stringify(report, null, 2)}\n`);
+}
+
+export async function summarize(report, summaryPath) {
+ const lines = ['## Eidoverse real acceptance', '', `Result: **${report.status}**`,
+ `Upstream: \`${report.upstreamSha}\``, report.backend, '', '| Criterion | Result |', '| --- | --- |',
+ ...Object.entries(report.criteria).map(([name, criterion]) => `| ${name} | ${criterion.status} |`),
+ '', ...(report.criteria.host.reasons || []), report.reason || '',
+ '', '```json', JSON.stringify(report, null, 2), '```',
+ '', 'A prerequisite failure or synthetic validator test is never real acceptance. #9798 remains open until every criterion passes.', ''];
+ if (summaryPath) await appendFile(summaryPath, lines.join('\n'));
+ console.log(lines.join('\n'));
+}
+
+/** Discover only this invocation's container by its exact private input marker. */
+async function watchContainer(plan, abort, state) {
+ while (!state.done) {
+ const ids = (await run(plan.docker, ['ps', '-q', '--filter', 'name=portos-mv-eido-'])).trim().split(/\s+/).filter(Boolean);
+ for (const id of ids) {
+ let c;
+ try { [c] = JSON.parse(await run(plan.docker, ['inspect', id])); } catch { continue; } // --rm race
+ const input = c.Mounts.find(m => m.Type === 'bind' && m.Destination === '/input');
+ if (!input) continue;
+ const scene = await readFile(join(input.Source, 'scene.json'), 'utf8').then(JSON.parse, () => null);
+ if (scene?.inlineScript !== plan.scene.inlineScript) continue;
+ assertContainment(c, plan.imageId);
+ state.container = { id: c.Id, root: dirname(input.Source) };
+ if (state.mode === 'failure') {
+ state.failureReached ||= await exists(join(state.container.root, 'output', 'intentional-failure.txt'));
+ }
+ if (state.mode === 'cancel' && !state.abortedOwned) {
+ assert.equal(c.State.Running, true);
+ state.abortedOwned = true;
+ abort.abort(new Error('synthetic owned-container cancellation'));
+ }
+ }
+ await delay(200);
+ }
+}
+
+async function renderCase({ project, plan, audioPath, outputPath, mode = 'geometry', ...window }) {
+ const { encodeEidoverseComposition } = await import('../server/services/musicVideo/eidoverseRender.js');
+ const abort = new AbortController();
+ const state = { mode, done: false };
+ const timer = setTimeout(() => abort.abort(new Error('acceptance render exceeded 12 minutes')), 12 * 60 * 1000);
+ let watchError;
+ const watcher = watchContainer(plan, abort, state).catch(error => { watchError = error; abort.abort(error); });
+ let renderError;
+ try {
+ await encodeEidoverseComposition({ project, plan, audioPath, outputPath, signal: abort.signal, ...window });
+ } catch (error) { renderError = error; }
+ finally { clearTimeout(timer); state.done = true; await watcher; }
+ if (watchError) throw watchError;
+ assert.ok(state.container, 'must observe this invocation\'s real owned container');
+ const remaining = (await run(plan.docker, ['ps', '-aq', '--no-trunc'])).trim().split(/\s+/);
+ assert.ok(!remaining.includes(state.container.id), 'owned container removed');
+ assert.equal(await exists(state.container.root), false, 'private production scratch removed');
+ if (mode === 'cancel') {
+ assert.equal(state.abortedOwned, true, 'abort was triggered only after observing the running owned container');
+ assert.ok(renderError, 'cancelled encoding rejected');
+ assert.equal(await exists(outputPath), false, 'cancel never files a film');
+ } else if (mode === 'failure') {
+ assert.equal(state.failureReached, true, 'scene actually reached the deliberate failing setup');
+ assert.equal(renderError?.code, 'EIDOVERSE_RENDER_FAILED');
+ assert.equal(await exists(outputPath), false, 'failing scene never files a film');
+ } else if (renderError) throw renderError;
+ return { observedOwnedContainer: true, containerRemoved: true, scratchRemoved: true, noFilm: mode !== 'geometry' };
+}
+
+async function probe(path, plan, frames) {
+ const parsed = JSON.parse(await run('ffprobe', ['-v', 'error', '-count_frames', '-show_streams', '-show_format', '-of', 'json', path]));
+ return assertVideo(parsed, { ...plan, frames });
+}
+
+async function decodeFrame(path, plan, frame) {
+ return await run('ffmpeg', ['-hide_banner', '-loglevel', 'error', '-i', path, '-vf', `select=eq(n\\,${frame})`,
+ '-frames:v', '1', '-f', 'rawvideo', '-pix_fmt', 'rgb24', 'pipe:1'], { encoding: 'buffer' });
+}
+
+async function checkTone(path, start, wanted, unwanted) {
+ const pcm = await run('ffmpeg', ['-hide_banner', '-loglevel', 'error', '-ss', String(start), '-i', path,
+ '-t', '0.5', '-vn', '-ac', '1', '-ar', '48000', '-f', 'f32le', 'pipe:1'], { encoding: 'buffer' });
+ return toneRatio(pcm, wanted, unwanted);
+}
+
+async function live(report, reportPath, upstream) {
+ assert.equal(process.env.PORTOS_EIDOVERSE_LIVE, '1', 'explicit PORTOS_EIDOVERSE_LIVE=1 required');
+ assert.equal(process.env.PORTOS_EIDOVERSE_SOURCE_REVIEWED, '1', 'review source and license terms before builds/runs');
+ let active = 'source';
+ let root;
+ try {
+ assert.equal((await run('git', ['-C', upstream, 'rev-parse', 'HEAD'])).trim(), UPSTREAM_SHA);
+ assert.equal((await run('git', ['-C', upstream, 'status', '--porcelain'])).trim(), '', 'independent upstream source must be clean');
+ report.criteria.source = { status: 'pass', revision: UPSTREAM_SHA };
+ active = 'build';
+ report.portosSha = (await run('git', ['-C', REPO, 'rev-parse', 'HEAD'])).trim();
+ for (const tag of ['eidoverse:render', 'portos-eidoverse-video:1']) {
+ const [image] = JSON.parse(await run('docker', ['image', 'inspect', tag]));
+ assert.equal(image.Os, 'linux'); assert.equal(image.Architecture, 'amd64');
+ assert.equal(image.Config.Labels?.['org.portos.eidoverse.upstream'], UPSTREAM_SHA, 'build provenance label required');
+ if (tag === 'portos-eidoverse-video:1') assert.equal(image.Config.Labels?.['org.portos.eidoverse.portos'], report.portosSha);
+ report.criteria.build[tag] = image.Id;
+ }
+ report.criteria.build.status = 'pass';
+ root = await mkdtemp(join(tmpdir(), 'portos-eido-acceptance-'));
+ const audioPath = join(root, 'synthetic.wav');
+ await writeFile(audioPath, syntheticSong());
+ const { prepareEidoverseRender } = await import('../server/services/musicVideo/eidoverseRender.js');
+ const makeProject = (aspect, mode = 'geometry') => ({ id: 'synthetic-acceptance',
+ treatment: { brief: { aspectRatio: aspect } }, audioAnalysis: { durationSec: 2 }, scenes: [],
+ composition: { mode: 'eidoverse', eidoverseScene: acceptanceScene({ marker: randomUUID(), mode }) } });
+ const outputs = {};
+ const plans = {};
+ for (const [criterion, aspect] of [['landscape', '16:9'], ['portrait', '9:16']]) {
+ active = criterion;
+ const project = makeProject(aspect), plan = await prepareEidoverseRender(project);
+ const outputPath = join(root, `${criterion}.mp4`);
+ const cleanup = await renderCase({ project, plan, audioPath, outputPath });
+ report.criteria.containment = { status: 'pass', ...cleanup };
+ report.criteria[criterion] = { status: 'pass', ...await probe(outputPath, plan, 48) };
+ outputs[criterion] = outputPath; plans[criterion] = plan;
+ await save(report, reportPath);
+ }
+ active = 'decodedGeometry';
+ const previews = `${reportPath}.frames`;
+ await mkdir(previews, { recursive: true });
+ report.criteria.decodedGeometry.samples = {};
+ for (const key of ['landscape', 'portrait']) {
+ const plan = plans[key];
+ report.criteria.decodedGeometry.samples[key] = [];
+ for (const frame of [0, 24, 47]) {
+ const rgb = await decodeFrame(outputs[key], plan, frame);
+ const landmarks = inspectGeometry(rgb, plan.width, plan.height, frame);
+ report.criteria.decodedGeometry.samples[key].push({ frame, landmarks });
+ await run('ffmpeg', ['-hide_banner', '-loglevel', 'error', '-i', outputs[key], '-vf',
+ `select=eq(n\\,${frame}),scale=320:320:force_original_aspect_ratio=decrease`, '-frames:v', '1', '-y', join(previews, `${key}-${frame}.png`)]);
+ }
+ }
+ report.criteria.decodedGeometry.status = 'pass';
+ active = 'audioOffset';
+ const project = makeProject('16:9'), plan = await prepareEidoverseRender(project);
+ const excerpt = join(root, 'excerpt.mp4');
+ await renderCase({ project, plan, audioPath, outputPath: excerpt, windowStart: 1, windowEnd: 2 });
+ const excerptVideo = await probe(excerpt, plan, 24);
+ report.criteria.audioOffset = { status: 'pass', excerptVideo,
+ fullFirstToneRatio: await checkTone(outputs.landscape, 0.1, 330, 880),
+ fullSecondToneRatio: await checkTone(outputs.landscape, 1.1, 880, 330),
+ excerptToneRatio: await checkTone(excerpt, 0.1, 880, 330) };
+ active = 'preroll';
+ const continuity = [];
+ for (const frame of [0, 12, 23]) {
+ const full = inspectGeometry(await decodeFrame(outputs.landscape, plan, frame + 24), plan.width, plan.height, frame + 24);
+ const cut = inspectGeometry(await decodeFrame(excerpt, plan, frame), plan.width, plan.height, frame + 24);
+ assert.ok(Math.abs(full.red.x - cut.red.x) < 0.005, 'excerpt preserves accumulated simulation state');
+ continuity.push({ fullFrame: frame + 24, excerptFrame: frame, fullX: full.red.x, excerptX: cut.red.x });
+ }
+ report.criteria.preroll = { status: 'pass', samples: continuity };
+ for (const [criterion, mode] of [['cancellation', 'cancel'], ['failureCleanup', 'failure']]) {
+ active = criterion;
+ const project = makeProject('16:9', mode), plan = await prepareEidoverseRender(project);
+ report.criteria[criterion] = { status: 'pass', ...await renderCase({ project, plan, audioPath, outputPath: join(root, `${mode}.mp4`), mode }) };
+ }
+ assert.ok(Object.values(report.criteria).every(c => c.status === 'pass'), 'every real criterion must pass');
+ report.status = 'pass';
+ } catch (error) {
+ report.status = 'fail';
+ // Do not publish arbitrary child-process logs, absolute paths or host environment.
+ report.reason = `Real acceptance failed at ${active}; inspect the private execution log before retrying.`;
+ report.criteria[active].status = 'fail';
+ console.error(`❌ ${report.reason}`);
+ console.error(error.code || error.name);
+ } finally {
+ if (root) await rm(root, { recursive: true, force: true });
+ await save(report, reportPath);
+ }
+}
+
+export async function main(args = process.argv.slice(2)) {
+ const reportPath = args.includes('--report') ? args[args.indexOf('--report') + 1] : join(tmpdir(), 'eidoverse-acceptance-report.json');
+ if (args.includes('--summary') || args.includes('--build-failed') || args.includes('--source-unavailable')) {
+ const report = JSON.parse(await readFile(reportPath, 'utf8'));
+ if (args.includes('--build-failed') && report.criteria.host.status === 'pass' && report.criteria.build.status !== 'pass') {
+ report.status = 'fail'; report.criteria.build.status = 'fail';
+ report.reason = 'Image build or setup failed; real runtime criteria have not passed.';
+ await save(report, reportPath);
+ }
+ if (args.includes('--source-unavailable')) {
+ report.status = 'unavailable'; report.criteria.source.status = 'unavailable';
+ report.reason = 'Source/license review was not accepted; no image build authorized or attempted.';
+ await save(report, reportPath);
+ }
+ await summarize(report, process.env.GITHUB_STEP_SUMMARY);
+ return report.status === 'pass' ? 0 : 2;
+ }
+ const report = newReport();
+ report.criteria.host = await preflight();
+ await save(report, reportPath);
+ if (report.criteria.host.status !== 'pass') {
+ report.reason = 'Suitable host unavailable; no build or acceptance attempted.';
+ } else if (args.includes('--live')) {
+ await live(report, reportPath, args[args.indexOf('--upstream') + 1]);
+ } else {
+ report.reason = 'Host preflight passed; real acceptance has not run.';
+ }
+ await save(report, reportPath);
+ await summarize(report, process.env.GITHUB_STEP_SUMMARY);
+ return args.includes('--preflight') && report.criteria.host.status === 'pass' ? 0 : report.status === 'pass' ? 0 : 2;
+}
+
+if (isDirectlyInvoked(import.meta.url)) main().then(code => { process.exitCode = code; }).catch(() => {
+ console.error('❌ Acceptance invocation failed; no pass recorded.'); process.exitCode = 2;
+});
diff --git a/scripts/fixtures/eidoverseAcceptanceScene.js b/scripts/fixtures/eidoverseAcceptanceScene.js
new file mode 100644
index 0000000000..9b0fe6d736
--- /dev/null
+++ b/scripts/fixtures/eidoverseAcceptanceScene.js
@@ -0,0 +1,46 @@
+/** Authored synthetic inputs only: no assets, provider calls or instance data. */
+export function acceptanceScene({ marker = 'synthetic', mode = 'geometry' } = {}) {
+ return { inlineScript: `// PortOS acceptance: ${marker}
+globalThis.setup = async () => {
+ ${mode === 'cancel' ? 'await new Promise(resolve => setTimeout(resolve, 600000));' : ''}
+ ${mode === 'failure' ? 'Deno.writeTextFileSync("/output/intentional-failure.txt", "synthetic"); await new Promise(resolve => setTimeout(resolve, 1500)); throw new Error("synthetic acceptance failure");' : ''}
+ globalThis._noAutoEnhance = true;
+ const scene = globalThis._scene = new THREE.Scene();
+ scene.background = new THREE.Color('#101018');
+ const camera = globalThis._camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0.1, 20);
+ camera.position.set(0, 0, 5); camera.lookAt(0, 0, 0);
+ const renderer = globalThis._renderer = new THREE.WebGPURenderer({ canvas, adapter: GPU_ADAPTER, device: GPU_DEVICE, antialias: false });
+ renderer.setSize(WIDTH, HEIGHT); renderer.setPixelRatio(1);
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
+ await renderer.init();
+ const box = new THREE.Mesh(new THREE.BoxGeometry(0.3, 0.3, 0.1), new THREE.MeshBasicMaterial({ color: '#20e060' }));
+ box.position.set(-0.55, 0.4, 0); scene.add(box);
+ const sphere = new THREE.Mesh(new THREE.SphereGeometry(0.15, 32, 16), new THREE.MeshBasicMaterial({ color: '#2050f0' }));
+ sphere.position.set(0.55, 0.4, 0); scene.add(sphere);
+ const moving = new THREE.Mesh(new THREE.BoxGeometry(0.2, 0.2, 0.1), new THREE.MeshBasicMaterial({ color: '#f03020' }));
+ moving.position.set(-0.45, -0.35, 0); scene.add(moving);
+ // State is accumulated per simulation step, never derived from seek time.
+ let steps = 0;
+ globalThis.renderFrame = async () => {
+ moving.position.x = -0.45 + 0.018 * steps++;
+ await renderer.renderAsync(scene, camera);
+ };
+};` };
+}
+
+/** Two distinguishable time segments catch muxing from zero on an excerpt. */
+export function syntheticSong() {
+ const rate = 48000;
+ const samples = rate * 2;
+ const wav = Buffer.alloc(44 + samples * 2);
+ wav.write('RIFF'); wav.writeUInt32LE(wav.length - 8, 4); wav.write('WAVEfmt ', 8);
+ wav.writeUInt32LE(16, 16); wav.writeUInt16LE(1, 20); wav.writeUInt16LE(1, 22);
+ wav.writeUInt32LE(rate, 24); wav.writeUInt32LE(rate * 2, 28);
+ wav.writeUInt16LE(2, 32); wav.writeUInt16LE(16, 34); wav.write('data', 36);
+ wav.writeUInt32LE(samples * 2, 40);
+ for (let i = 0; i < samples; i++) {
+ const frequency = i < rate ? 330 : 880;
+ wav.writeInt16LE(Math.round(12000 * Math.sin(2 * Math.PI * frequency * i / rate)), 44 + i * 2);
+ }
+ return wav;
+}
diff --git a/scripts/lib/eidoverseAcceptance.js b/scripts/lib/eidoverseAcceptance.js
new file mode 100644
index 0000000000..c7d2ec250c
--- /dev/null
+++ b/scripts/lib/eidoverseAcceptance.js
@@ -0,0 +1,117 @@
+import assert from 'node:assert/strict';
+import { execFile } from 'node:child_process';
+import { promisify } from 'node:util';
+import { readFile, statfs } from 'node:fs/promises';
+
+export const UPSTREAM_SHA = '959a95c3d3963c334422d170317062e00936c573';
+export const CRITERIA = ['host', 'source', 'build', 'containment', 'landscape', 'portrait', 'decodedGeometry', 'audioOffset', 'preroll', 'cancellation', 'failureCleanup'];
+export const run = async (bin, args, options = {}) => (await promisify(execFile)(bin, args, {
+ timeout: 30000, maxBuffer: 32 * 1024 ** 2, encoding: 'utf8', ...options,
+})).stdout;
+
+export function newReport() {
+ return { schema: 1, upstreamSha: UPSTREAM_SHA, backend: 'Mesa software WebGPU + libx264; no physical GPU or speed claim',
+ status: 'unavailable', criteria: Object.fromEntries(CRITERIA.map(key => [key, { status: 'not-run' }])) };
+}
+
+export function hostVerdict({ platform, arch, docker, memAvailable, diskFree }) {
+ const reasons = [];
+ if (platform !== 'linux' || arch !== 'x64') reasons.push('native Linux x86_64 required');
+ if (docker?.OSType !== 'linux' || docker?.Architecture !== 'x86_64') reasons.push('local Linux x86_64 Docker daemon required');
+ if (!(memAvailable >= 8 * 1024 ** 3)) reasons.push('MemAvailable below 8 GiB or unreadable');
+ if (!(diskFree >= 60 * 1024 ** 3)) reasons.push('Docker-root filesystem free space below 60 GiB or unreadable');
+ return { status: reasons.length ? 'unavailable' : 'pass', reasons, memAvailable, diskFree };
+}
+
+/** Read only. Never install Docker, change its root, prune images or free OS space. */
+export async function preflight() {
+ const facts = { platform: process.platform, arch: process.arch };
+ try {
+ // A remote daemon's root is not measurable with host statfs/MemAvailable.
+ const context = JSON.parse(await run('docker', ['context', 'inspect']));
+ assert.match(process.env.DOCKER_HOST || context[0].Endpoints.docker.Host, /^unix:\/\//);
+ facts.docker = JSON.parse(await run('docker', ['info', '--format', '{{json .}}']));
+ const mem = await readFile('/proc/meminfo', 'utf8');
+ facts.memAvailable = Number(mem.match(/^MemAvailable:\s+(\d+) kB$/m)?.[1]) * 1024;
+ const disk = await statfs(facts.docker.DockerRootDir);
+ facts.diskFree = disk.bavail * disk.bsize;
+ } catch { /* Missing, inaccessible and unmeasurable prerequisites fail closed. */ }
+ return { platform: facts.platform, arch: facts.arch, ...hostVerdict(facts) };
+}
+
+export function assertVideo(probe, { width, height, frames }) {
+ const video = probe.streams.find(s => s.codec_type === 'video');
+ const audio = probe.streams.find(s => s.codec_type === 'audio');
+ assert.ok(video && audio, 'real video and muxed audio streams required');
+ assert.equal(video.width, width); assert.equal(video.height, height);
+ assert.equal(Number(video.nb_read_frames), frames, 'decoded frame count');
+ const [n, d] = video.avg_frame_rate.split('/').map(Number);
+ assert.equal(n / d, 24);
+ assert.ok(Math.abs(Number(video.duration) - frames / 24) <= 1 / 24000, 'video duration');
+ assert.ok(Math.abs(Number(probe.format.duration) - frames / 24) <= 1 / 24, 'mux duration');
+ return { width, height, fps: 24, frames, duration: Number(video.duration), audioCodec: audio.codec_name };
+}
+
+/** Spatial landmarks reject black frames AND successful banded-gradient renders. */
+export function inspectGeometry(rgb, width, height, frame) {
+ assert.equal(rgb.length, width * height * 3);
+ const masks = { red: [], green: [], blue: [] };
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
+ const i = (y * width + x) * 3, r = rgb[i], g = rgb[i + 1], b = rgb[i + 2];
+ if (r > 130 && r > g * 1.8 && r > b * 1.8) masks.red.push([x, y]);
+ if (g > 130 && g > r * 1.8 && g > b * 1.5) masks.green.push([x, y]);
+ if (b > 130 && b > r * 1.8 && b > g * 1.8) masks.blue.push([x, y]);
+ }
+ const expected = { green: [0.225, 0.3, 0.15], blue: [0.775, 0.3, 0.15], red: [(0.55 + 0.018 * frame) / 2, 0.675, 0.1] };
+ const result = {};
+ for (const [key, points] of Object.entries(masks)) {
+ const [cx, cy, span] = expected[key];
+ assert.ok(points.length > width * height * span ** 2 * 0.5, `${key} recognizable nonblank area`);
+ const x = points.reduce((a, p) => a + p[0], 0) / points.length / width;
+ const y = points.reduce((a, p) => a + p[1], 0) / points.length / height;
+ assert.ok(Math.abs(x - cx) < 0.015 && Math.abs(y - cy) < 0.015, `${key} expected location at frame ${frame}`);
+ const bounds = points.reduce((a, p) => [Math.min(a[0], p[0]), Math.max(a[1], p[0]), Math.min(a[2], p[1]), Math.max(a[3], p[1])], [width, 0, height, 0]);
+ assert.ok(Math.abs((bounds[1] - bounds[0] + 1) / width - span) < 0.025, `${key} bounded width (not a gradient)`);
+ assert.ok(Math.abs((bounds[3] - bounds[2] + 1) / height - span) < 0.025, `${key} bounded height (not a gradient)`);
+ result[key] = { x, y, pixels: points.length };
+ }
+ return result;
+}
+
+/** Frequency energy at known synthetic tones, independently decoded from AAC. */
+export function toneRatio(pcm, wanted, unwanted, rate = 48000) {
+ assert.ok(pcm.length >= rate / 4 * 4, 'at least 250ms decoded audio');
+ const energy = frequency => {
+ let re = 0, im = 0;
+ for (let i = 0; i < pcm.length / 4; i++) {
+ const value = pcm.readFloatLE(i * 4), angle = 2 * Math.PI * frequency * i / rate;
+ re += value * Math.cos(angle); im += value * Math.sin(angle);
+ }
+ return re ** 2 + im ** 2;
+ };
+ const signal = energy(wanted);
+ assert.ok(signal > 1, 'non-silent synthetic master song');
+ const ratio = signal / Math.max(energy(unwanted), 1e-9);
+ assert.ok(ratio > 100, `expected ${wanted}Hz rather than ${unwanted}Hz`);
+ return ratio;
+}
+
+export function assertContainment(container, imageId) {
+ const h = container.HostConfig;
+ assert.equal(container.Image, imageId);
+ assert.equal(h.NetworkMode, 'none'); assert.equal(h.ReadonlyRootfs, true);
+ assert.deepEqual(h.CapDrop, ['ALL']); assert.equal(h.Privileged, false);
+ assert.ok(h.SecurityOpt.includes('no-new-privileges'));
+ assert.equal(h.Memory, 8 * 1024 ** 3); assert.equal(h.NanoCpus, 4 * 1e9); assert.equal(h.PidsLimit, 256);
+ assert.equal(container.Config.User, '1000:1000');
+ assert.ok(container.Config.Env.includes('GALLIUM_DRIVER=llvmpipe'));
+ assert.ok(container.Config.Env.includes('RENDER_CODEC=libx264'));
+ assert.ok(container.Config.Cmd.includes('--cached-only') && container.Config.Cmd.includes('--frozen'));
+ const binds = container.Mounts.filter(m => m.Type === 'bind');
+ assert.equal(binds.length, 2);
+ assert.equal(binds.find(m => m.Destination === '/input')?.RW, false);
+ assert.equal(binds.find(m => m.Destination === '/output')?.RW, true);
+ assert.ok(!container.Mounts.some(m => m.Destination.includes('docker.sock')));
+ assert.match(h.Tmpfs['/tmp'], /size=512m/);
+ assert.deepEqual(h.Devices || [], []); assert.deepEqual(h.DeviceRequests || [], []);
+}
diff --git a/scripts/lib/eidoverseAcceptance.test.js b/scripts/lib/eidoverseAcceptance.test.js
new file mode 100644
index 0000000000..568b716778
--- /dev/null
+++ b/scripts/lib/eidoverseAcceptance.test.js
@@ -0,0 +1,85 @@
+import { describe, it, expect } from 'vitest';
+import { execFileSync } from 'node:child_process';
+import { mkdtempSync, readFileSync, rmSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { hostVerdict, assertVideo, inspectGeometry, toneRatio, assertContainment } from './eidoverseAcceptance.js';
+import { syntheticSong } from '../fixtures/eidoverseAcceptanceScene.js';
+
+const host = { platform: 'linux', arch: 'x64', docker: { OSType: 'linux', Architecture: 'x86_64' }, memAvailable: 8 * 1024 ** 3, diskFree: 60 * 1024 ** 3 };
+const probe = { streams: [{ codec_type: 'video', width: 1280, height: 720, nb_read_frames: '48', avg_frame_rate: '24/1', duration: '2' }, { codec_type: 'audio', codec_name: 'aac' }], format: { duration: '2' } };
+const expected = { width: 1280, height: 720, frames: 48 };
+
+function geometry(frame) {
+ const width = 400, height = 400, rgb = Buffer.alloc(width * height * 3, 16);
+ const shapes = [[0.225, 0.3, 0.15, [32, 224, 96]], [0.775, 0.3, 0.15, [32, 80, 240]], [(0.55 + frame * 0.018) / 2, 0.675, 0.1, [240, 48, 32]]];
+ for (const [cx, cy, span, color] of shapes) {
+ for (let y = 0; y < height; y++) for (let x = 0; x < width; x++) {
+ if (Math.abs((x + 0.5) / width - cx) < span / 2 && Math.abs((y + 0.5) / height - cy) < span / 2) rgb.set(color, (y * width + x) * 3);
+ }
+ }
+ return rgb;
+}
+
+describe('acceptance evidence guards (synthetic validator tests, never runtime acceptance)', () => {
+ it('fails closed on unavailable native architecture, daemon, memory or Docker-root storage', () => {
+ expect(hostVerdict(host).status).toBe('pass');
+ for (const change of [{ platform: 'darwin' }, { arch: 'arm64' }, { docker: null }, { memAvailable: host.memAvailable - 1 }, { diskFree: host.diskFree - 1 }, { diskFree: NaN }]) {
+ expect(hostVerdict({ ...host, ...change }).status).toBe('unavailable');
+ }
+ });
+ it('checks decoded frame counts and muxed streams independently of successful encoder exit', () => {
+ expect(assertVideo(probe, expected).frames).toBe(48);
+ for (const change of [{ width: 720 }, { nb_read_frames: '47' }, { duration: '1.95' }, { avg_frame_rate: '30/1' }]) {
+ expect(() => assertVideo({ ...probe, streams: [{ ...probe.streams[0], ...change }, probe.streams[1]] }, expected)).toThrow();
+ }
+ expect(() => assertVideo({ ...probe, streams: [probe.streams[0]] }, expected)).toThrow();
+ });
+ it('recognizes spatial geometry at first/middle/last and rejects a restarted excerpt, black output and banded gradients', () => {
+ for (const frame of [0, 24, 47]) expect(inspectGeometry(geometry(frame), 400, 400, frame).red.pixels).toBeGreaterThan(0);
+ expect(() => inspectGeometry(geometry(0), 400, 400, 24)).toThrow();
+ expect(() => inspectGeometry(Buffer.alloc(400 * 400 * 3), 400, 400, 0)).toThrow();
+ const bands = Buffer.alloc(400 * 400 * 3);
+ for (let i = 0; i < bands.length; i += 3) bands.set([0, 240, 0], i);
+ expect(() => inspectGeometry(bands, 400, 400, 0)).toThrow();
+ });
+ it('detects the excerpt tone rather than treating any audio stream as correct alignment', () => {
+ const wav = syntheticSong();
+ const decode = offset => {
+ const pcm = Buffer.alloc(24000 * 4);
+ for (let i = 0; i < 24000; i++) pcm.writeFloatLE(wav.readInt16LE(44 + (offset + i) * 2) / 32768, i * 4);
+ return pcm;
+ };
+ expect(toneRatio(decode(0), 330, 880)).toBeGreaterThan(100);
+ expect(toneRatio(decode(48000), 880, 330)).toBeGreaterThan(100);
+ expect(() => toneRatio(decode(0), 880, 330)).toThrow();
+ expect(() => toneRatio(Buffer.alloc(24000 * 4), 880, 330)).toThrow();
+ });
+ it('checks the real inspect projection for containment and rejects writable inputs, GPU devices and extra host mounts', () => {
+ const imageId = `sha256:${'a'.repeat(64)}`;
+ const c = { Image: imageId, Config: { User: '1000:1000', Cmd: ['--cached-only', '--frozen'], Env: ['GALLIUM_DRIVER=llvmpipe', 'RENDER_CODEC=libx264'] }, HostConfig: {
+ NetworkMode: 'none', ReadonlyRootfs: true, CapDrop: ['ALL'], Privileged: false, SecurityOpt: ['no-new-privileges'],
+ Memory: 8 * 1024 ** 3, NanoCpus: 4 * 1e9, PidsLimit: 256, Tmpfs: { '/tmp': 'rw,nosuid,nodev,size=512m' }, Devices: [], DeviceRequests: [],
+ }, Mounts: [{ Type: 'bind', Destination: '/input', RW: false }, { Type: 'bind', Destination: '/output', RW: true }] };
+ expect(() => assertContainment(c, imageId)).not.toThrow();
+ for (const mutate of [copy => { copy.HostConfig.NetworkMode = 'host'; }, copy => { copy.Mounts[0].RW = true; }, copy => { copy.Mounts.push({ Type: 'bind', Destination: '/home', RW: false }); }, copy => { copy.HostConfig.DeviceRequests = [{ Count: -1 }]; }]) {
+ const copy = structuredClone(c); mutate(copy);
+ expect(() => assertContainment(copy, imageId)).toThrow();
+ }
+ });
+ it('writes unavailable and leaves all runtime criteria not-run when prerequisites are missing', () => {
+ const root = mkdtempSync(join(tmpdir(), 'eido-acceptance-validator-'));
+ try {
+ const report = join(root, 'report.json');
+ const script = fileURLToPath(new URL('../eidoverse-acceptance.js', import.meta.url));
+ expect(() => execFileSync(process.execPath, [script, '--preflight', '--report', report], {
+ env: { PATH: '/no-acceptance-tools', NODE_ENV: 'test' }, stdio: 'pipe', timeout: 5000,
+ })).toThrow();
+ const saved = JSON.parse(readFileSync(report, 'utf8'));
+ expect(saved.status).toBe('unavailable'); expect(saved.criteria.host.status).toBe('unavailable');
+ expect(Object.entries(saved.criteria).filter(([k]) => k !== 'host').every(([, c]) => c.status === 'not-run')).toBe(true);
+ expect(JSON.stringify(saved)).not.toContain(root);
+ } finally { rmSync(root, { recursive: true, force: true }); }
+ });
+});