The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.
TypeScript agent-skillsagentic-aiai-agentsai-videobyokclaude-codecodexdeepseek-harnessdsh-plugingenerative-ailocal-firstmcpmotionmotion-graphicsmultimodalopenmotionreverse-engineeringvideo-editingvideo-generationworkbuddy
Separate candidate builds from operator-confirmed test publication
luogao0d8ef73b3b9d
diff --git a/.github/scripts/motion-release.mjs b/.github/scripts/motion-release.mjsindex 884fc0f0..f0749db2 100644--- a/.github/scripts/motion-release.mjs+++ b/.github/scripts/motion-release.mjs@@ -13,9 +13,9 @@ import { publishGuide, storagePlan } from './publish-install-guide.mjs';import { scanPackage, scanSource } from './motion-scan.mjs';export const repository = 'nexu-io/html-anything';-export const candidateWorkflow = '.github/workflows/motion-publish-test.yml';+export const candidateWorkflow = '.github/workflows/motion-candidate.yml';+export const publicationWorkflow = '.github/workflows/motion-publish-test.yml';export const recoveryWorkflow = '.github/workflows/motion-publication-recovery.yml';-export const publicationEnvironment = 'motion-test-publish';export const candidateJobName = 'Build immutable candidate';const exec = promisify(execFile), hashPattern = /^[a-f0-9]{64}$/;const json = async file => JSON.parse(await readFile(file, 'utf8'));@@ -27,12 +27,12 @@ export function releaseInputs(env = process.env) {assert.equal(env.GITHUB_REF, 'refs/heads/main', 'Run the trusted workflow registered on main');assert(['publish-test', 'archive-only'].includes(env.MOTION_RELEASE_ACTION), 'Unknown release action');const workflow = env.GITHUB_WORKFLOW_REF;- assert([candidateWorkflow, recoveryWorkflow].some(p => workflow === `${repository}/${p}@refs/heads/main`), 'Require a trusted manual entry');+ assert([publicationWorkflow, recoveryWorkflow].some(p => workflow === `${repository}/${p}@refs/heads/main`), 'Require a trusted manual entry');if (workflow.includes(recoveryWorkflow)) assert.equal(env.MOTION_RELEASE_ACTION, 'archive-only', 'Recovery never publishes or moves a channel');if (env.MOTION_EXPECTED_SHA256) assert.match(env.MOTION_EXPECTED_SHA256, hashPattern);- assert(/^[1-9]\d*$/.test(env.MOTION_CANDIDATE_RUN || ''), 'Require a candidate workflow run ID');- return { action: env.MOTION_RELEASE_ACTION, expectedSHA256: env.MOTION_EXPECTED_SHA256,- candidateRun: env.MOTION_CANDIDATE_RUN, artifactId: env.MOTION_CANDIDATE_ARTIFACT_ID };+ assert.equal(env.MOTION_ACCEPTED, 'true', 'Explicit operator acceptance confirmation is required');+ checkReleaseVersion(env.MOTION_VERSION); assert(env.MOTION_VERSION.includes('-test.'), 'Only test versions may use this entry');+ return { action: env.MOTION_RELEASE_ACTION, accepted: true, version: env.MOTION_VERSION, expectedSHA256: env.MOTION_EXPECTED_SHA256 };}export async function resolveSource(control, requested, version, run = runFile) {@@ -69,7 +69,13 @@ export async function sealCandidate(build, output, source, env = process.env) {tgz: filename, tgzSHA256: await sha256(path.join(output, filename)), applicationSHA256: guide.applicationSHA256, locks: guide.locks,templateEnvironment: 'prod' };await writeFile(path.join(output, 'acceptance.md'), template.replace('<!-- CANDIDATE_IDENTITY -->', '```json\n' + JSON.stringify(identity, null, 2) + '\n```'));- const names = [filename, 'release-npm.json', 'source-scan.json', 'package-scan.json', 'install.md', 'install-record.json', 'acceptance.md'];+ const installTemplate = await readFile(new URL('../../docs/templates/candidate-install.md', import.meta.url), 'utf8');+ const values = { VERSION: guide.version, TGZ: filename, SHA256: identity.tgzSHA256, SOURCE_SHA: guide.commit,+ DETAILS_URL: `https://github.com/${repository}/blob/${guide.commit}/docs/npm-installation.md` };+ const instructions = installTemplate.replace(/\{\{([A-Z0-9_]+)\}\}/g, (_, key) => { assert(Object.hasOwn(values, key)); return values[key]; });+ assert(!instructions.includes('{{'), 'Unresolved candidate instructions');+ await writeFile(path.join(output, 'candidate-install.md'), instructions);+ const names = [filename, 'release-npm.json', 'source-scan.json', 'package-scan.json', 'install.md', 'install-record.json', 'acceptance.md', 'candidate-install.md'];const files = Object.fromEntries(await Promise.all(names.map(async name => [name, await sha256(path.join(output, name))])));const candidate = { schemaVersion: 2, kind: 'motion-candidate', packageName: guide.packageName, version: guide.version,sourceCommit: guide.commit, tgz: filename, tgzSHA256: files[filename], integrity: integrity(await readFile(path.join(output, filename))), files,@@ -80,14 +86,12 @@ export async function sealCandidate(build, output, source, env = process.env) {return candidate;}-export function validateRun(run, artifact, job, attempt) {+export function validateRun(run, artifact, version) {assert.equal(run.event, 'workflow_dispatch'); assert.equal(run.head_branch, 'main');assert.equal(run.head_repository?.full_name, repository);- assert.equal(run.path.split('@')[0], candidateWorkflow, 'Candidate must come from the registered workflow');- assert(Number.isSafeInteger(attempt) && attempt > 0 && attempt <= run.run_attempt, 'Invalid producer attempt');- assert.equal(job.name, candidateJobName); assert.equal(job.status, 'completed'); assert.equal(job.conclusion, 'success');- assert.equal(job.run_id, run.id); assert.equal(job.head_sha, run.head_sha);- assert.equal(artifact.name, `motion-candidate-${run.id}-${attempt}`);+ assert.equal(run.status, 'completed'); assert.equal(run.conclusion, 'success', 'Candidate build must finish successfully');+ assert.equal(run.path.split('@')[0], candidateWorkflow, 'Candidate must come from the registered build workflow');+ assert.equal(artifact.name, `motion-candidate-${version}`);assert.equal(artifact.workflow_run?.id, run.id); assert.equal(artifact.expired, false);assert.match(artifact.digest || '', /^sha256:[a-f0-9]{64}$/, 'Require the GitHub artifact digest');assert(artifact.size_in_bytes > 0 && artifact.size_in_bytes < 150 * 1024 * 1024, 'Unexpected artifact size');@@ -100,55 +104,34 @@ async function github(route, fetcher = fetch) {return response.json();}-export function validatePublicationEnvironment(environment, branches) {- assert.equal(environment.name, publicationEnvironment);- const rule = environment.protection_rules?.find(r => r.type === 'required_reviewers');- assert(rule?.reviewers?.length > 0 && rule.prevent_self_review === true, 'Configure independent required reviewers and prevent self-review');- assert.equal(environment.can_admins_bypass, false, 'Disable environment protection bypass');- assert.equal(environment.deployment_branch_policy?.custom_branch_policies, true, 'Restrict the publication environment to main');- assert.equal(environment.deployment_branch_policy?.protected_branches, false);- assert.deepEqual(branches.branch_policies?.map(b => ({ name: b.name, type: b.type })).sort((a, b) => a.name.localeCompare(b.name)), [{ name: 'main', type: 'branch' }]);+export function authorizationReceipt(candidate, run, action, observedAt = new Date().toISOString()) {+ const actor = run.triggering_actor?.login || run.actor?.login;+ assert(typeof actor === 'string' && actor.length > 0, 'Require the actual publication operator');+ return { schemaVersion: 1, type: 'manual-workflow-dispatch', publicationRun: run.id, runAttempt: run.run_attempt,+ action, version: candidate.version, tgzSHA256: candidate.tgzSHA256, candidateRun: candidate.workflow,+ actor, acceptanceConfirmed: true, observedAt };}-export async function checkPublicationEnvironment(fetcher = fetch) {- const environment = await github(`/environments/${publicationEnvironment}`, fetcher);- const branches = await github(`/environments/${publicationEnvironment}/deployment-branch-policies?per_page=100`, fetcher);- validatePublicationEnvironment(environment, branches);-}--export function approvalReceipt(candidate, reviews, run, action, observedAt = new Date().toISOString()) {- // shortcut: GitHub reviews are run-scoped; use deployment-specific receipts if the API gains attempt identities.- const reviewers = [...new Set(reviews.filter(r => r.state === 'approved' && r.comment?.trim() === 'PASS' &&- r.environments?.some(e => e.name === publicationEnvironment) && r.user?.login &&- ![run.actor?.login, run.triggering_actor?.login].includes(r.user.login)).map(r => r.user.login))].sort();- assert(reviewers.length > 0, 'Require an independent environment approval with the non-sensitive comment PASS');- return { schemaVersion: 1, environment: publicationEnvironment, publicationRun: run.id, action,- version: candidate.version, tgzSHA256: candidate.tgzSHA256, candidateRun: candidate.workflow,- reviewers, observedAt, historySHA256: createHash('sha256').update(JSON.stringify(reviews)).digest('hex'),- scope: 'run-review-history; the protected npm job enforces approval for its execution' };-}--export async function recordApproval(directory, inputs, fetcher = fetch, env = process.env) {- await checkPublicationEnvironment(fetcher);- const candidate = await verifyDownloaded(directory, inputs.expectedSHA256);+export async function recordAuthorization(directory, inputs, fetcher = fetch, env = process.env) {+ const authorized = releaseInputs(env);+ assert.equal(authorized.action, inputs.action); assert.equal(authorized.version, inputs.version);+ const candidate = await verifyDownloaded(directory, inputs.expectedSHA256, inputs.version);const run = await github(`/actions/runs/${env.GITHUB_RUN_ID}`, fetcher);- assert.equal(run.head_branch, 'main'); assert.equal(run.event, 'workflow_dispatch');- assert.equal(run.head_sha, env.GITHUB_SHA);+ assert.equal(String(run.id), env.GITHUB_RUN_ID); assert.equal(run.head_branch, 'main'); assert.equal(run.event, 'workflow_dispatch');+ assert.equal(run.head_repository?.full_name, repository); assert.equal(run.head_sha, env.GITHUB_SHA);assert.equal(run.path.split('@')[0], env.GITHUB_WORKFLOW_REF.slice(repository.length + 1).split('@')[0]);- const reviews = await github(`/actions/runs/${run.id}/approvals`, fetcher);- await writeJSON(path.join(directory, 'approval.json'), approvalReceipt(candidate, reviews, run, inputs.action));+ await writeJSON(path.join(directory, 'authorization.json'), authorizationReceipt(candidate, run, inputs.action));}-async function verifyApproval(directory, inputs, env = process.env) {- const candidate = await verifyDownloaded(directory, inputs.expectedSHA256), approval = await json(path.join(directory, 'approval.json'));- assert.equal(approval.schemaVersion, 1);- assert.equal(approval.environment, publicationEnvironment); assert.equal(approval.version, candidate.version);- assert.equal(approval.tgzSHA256, candidate.tgzSHA256); assert.equal(approval.action, inputs.action);- assert.deepEqual(approval.candidateRun, candidate.workflow);- assert.equal(String(approval.publicationRun), env.GITHUB_RUN_ID, 'Approval belongs to another publication run');- assert(Array.isArray(approval.reviewers) && approval.reviewers.length > 0 && approval.reviewers.every(v => typeof v === 'string' && v.length > 0));- assert.match(approval.historySHA256, hashPattern);- return approval;+async function verifyAuthorization(directory, inputs, env = process.env) {+ const candidate = await verifyDownloaded(directory, inputs.expectedSHA256, inputs.version), authorization = await json(path.join(directory, 'authorization.json'));+ assert.equal(inputs.accepted, true); assert.equal(authorization.schemaVersion, 1);+ assert.equal(authorization.type, 'manual-workflow-dispatch'); assert.equal(authorization.acceptanceConfirmed, true);+ assert.equal(authorization.version, candidate.version); assert.equal(authorization.tgzSHA256, candidate.tgzSHA256);+ assert.equal(authorization.action, inputs.action); assert.deepEqual(authorization.candidateRun, candidate.workflow);+ assert.equal(String(authorization.publicationRun), env.GITHUB_RUN_ID, 'Authorization belongs to another publication run');+ assert(typeof authorization.actor === 'string' && authorization.actor.length > 0);+ return authorization;}export async function verifyCandidate(directory, expectedSHA256, run) {@@ -158,7 +141,7 @@ export async function verifyCandidate(directory, expectedSHA256, run) {assert.equal(candidate.tgz, `openmotion-app-${candidate.version}.tgz`); assert.equal(candidate.tgzSHA256, expectedSHA256);assert.match(expectedSHA256, hashPattern); assert.match(candidate.sourceCommit, /^[a-f0-9]{40}$/);assert.deepEqual(candidate.workflow, { repository, path: candidateWorkflow, ref: 'refs/heads/main', sha: run.head_sha, runId: run.id, attempt: run.run_attempt });- const names = [candidate.tgz, 'release-npm.json', 'source-scan.json', 'package-scan.json', 'install.md', 'install-record.json', 'acceptance.md'];+ const names = [candidate.tgz, 'release-npm.json', 'source-scan.json', 'package-scan.json', 'install.md', 'install-record.json', 'acceptance.md', 'candidate-install.md'];assert.deepEqual(Object.keys(candidate.files).sort(), names.sort());for (const name of names) assert.equal(await sha256(path.join(directory, name)), candidate.files[name], 'Candidate file changed: ' + name);assert.equal(await sha256(path.join(directory, candidate.tgz)), expectedSHA256);@@ -174,9 +157,11 @@ export async function verifyCandidate(directory, expectedSHA256, run) {return candidate;}-export async function verifyDownloaded(directory, expectedSHA256) {+export async function verifyDownloaded(directory, expectedSHA256, version) {const provenance = await json(path.join(directory, 'provenance.json'));- return verifyCandidate(directory, expectedSHA256, { head_sha: provenance.head_sha, id: provenance.runId, run_attempt: provenance.attempt });+ const candidate = await verifyCandidate(directory, expectedSHA256, { head_sha: provenance.head_sha, id: provenance.runId, run_attempt: provenance.attempt });+ if (version) assert.equal(candidate.version, version, 'Candidate version differs from the accepted version');+ return candidate;}export async function platformReports(directory, candidate) {@@ -194,18 +179,20 @@ export async function platformReports(directory, candidate) {return reports;}-export async function downloadCandidate(runId, directory, expectedSHA256, fetcher = fetch, artifactId) {- assert(/^[1-9]\d*$/.test(runId));- const run = await github(`/actions/runs/${runId}`, fetcher);- const { artifacts } = await github(`/actions/runs/${runId}/artifacts?per_page=100`, fetcher);- const matches = artifacts.filter(a => artifactId ? String(a.id) === String(artifactId) : new RegExp(`^motion-candidate-${run.id}-[1-9]\\d*$`).test(a.name));- assert(matches.length > 0, 'Candidate artifact missing');- matches.sort((a, b) => Number(b.name.split('-').at(-1)) - Number(a.name.split('-').at(-1)));- const artifact = matches[0], attempt = Number(artifact.name.split('-').at(-1));- assert.equal(matches.filter(a => a.name === artifact.name).length, 1, 'Candidate artifact ambiguous');- const { jobs } = await github(`/actions/runs/${run.id}/attempts/${attempt}/jobs?per_page=100`, fetcher);- const builds = jobs.filter(j => j.name === candidateJobName); assert.equal(builds.length, 1, 'Successful candidate producer is missing or ambiguous');- validateRun(run, artifact, builds[0], attempt);+export async function findCandidate(version, fetcher = fetch) {+ checkReleaseVersion(version); assert(version.includes('-test.'));+ const name = `motion-candidate-${version}`;+ const result = await github(`/actions/artifacts?name=${encodeURIComponent(name)}&per_page=100`, fetcher);+ assert(result.total_count <= 100, 'Too many matching artifacts; refusing an incomplete lookup');+ const matches = result.artifacts.filter(a => a.name === name && !a.expired);+ assert.equal(matches.length, 1, 'Candidate missing, expired or ambiguous; build a new unique version');+ assert(Number.isSafeInteger(matches[0].workflow_run?.id) && matches[0].workflow_run.id > 0);+ return matches[0];+}++export async function downloadCandidate(version, directory, expectedSHA256, fetcher = fetch) {+ const artifact = await findCandidate(version, fetcher), run = await github(`/actions/runs/${artifact.workflow_run.id}`, fetcher);+ validateRun(run, artifact, version);const redirect = await fetcher(`https://api.github.com/repos/${repository}/actions/artifacts/${artifact.id}/zip`, {redirect: 'manual', signal: AbortSignal.timeout(30_000), headers: { Authorization: `Bearer ${process.env.GH_TOKEN || process.env.GITHUB_TOKEN}` } });assert.equal(redirect.status, 302); const url = new URL(redirect.headers.get('location')); assert.equal(url.protocol, 'https:'); assert(!url.username && !url.password);@@ -217,15 +204,16 @@ export async function downloadCandidate(runId, directory, expectedSHA256, fetchetry {const archive = path.join(work, 'candidate.zip'); await writeFile(archive, bytes);const entries = (await runFile('unzip', ['-Z1', archive])).trim().split('\n');- assert(entries.length === 8 && new Set(entries).size === 8, 'Unexpected candidate artifact files');+ assert(entries.length === 9 && new Set(entries).size === 9, 'Unexpected candidate artifact files');assert(entries.every(name => /^[a-zA-Z0-9._-]+$/.test(name) && name.length < 160), 'Unsafe candidate artifact entry');await mkdir(directory, { recursive: true });for (const name of entries) {const { stdout } = await exec('unzip', ['-p', archive, name], { encoding: 'buffer', maxBuffer: 150 * 1024 * 1024 });await writeFile(path.join(directory, name), stdout);}- const candidate = await verifyCandidate(directory, expectedSHA256 || (await json(path.join(directory, 'candidate.json'))).tgzSHA256, { ...run, run_attempt: attempt });- await writeJSON(path.join(directory, 'provenance.json'), { runId: run.id, attempt, head_sha: run.head_sha, artifactId: artifact.id, digest: artifact.digest });+ const candidate = await verifyCandidate(directory, expectedSHA256 || (await json(path.join(directory, 'candidate.json'))).tgzSHA256, run);+ assert.equal(candidate.version, version, 'Artifact version differs from the accepted version');+ await writeJSON(path.join(directory, 'provenance.json'), { runId: run.id, attempt: run.run_attempt, head_sha: run.head_sha, artifactId: artifact.id, digest: artifact.digest });return candidate;} finally { await rm(work, { recursive: true, force: true }); }}@@ -241,7 +229,7 @@ export async function registryPackage(candidate, fetcher = fetch) {export async function publishNpm(directory, inputs, { fetcher = fetch, run = runFile, env = process.env } = {}) {const candidate = await verifyDownloaded(directory, inputs.expectedSHA256);- await verifyApproval(directory, inputs, env);+ await verifyAuthorization(directory, inputs, env);const before = await registryPackage(candidate, fetcher);if (inputs.action === 'archive-only') assert(before.version, 'Archive-only requires an existing identical npm version');if (inputs.action === 'publish-test' && before.tags.test) assert(compareReleaseVersions(candidate.version, before.tags.test) >= 0, 'A newer npm test version already exists; use snapshot recovery for an identical published version');@@ -259,7 +247,7 @@ export async function publishNpm(directory, inputs, { fetcher = fetch, run = runexport async function archiveRelease(directory, inputs, config, { run = runFile, fetcher = fetch, env = process.env } = {}) {await writeJSON(path.join(directory, 'release-attempt.json'), { action: inputs.action, tgzSHA256: inputs.expectedSHA256, stage: 'verifying-release', runId: env.GITHUB_RUN_ID });const candidate = await verifyDownloaded(directory, inputs.expectedSHA256);- const approval = await verifyApproval(directory, inputs, env);+ const authorization = await verifyAuthorization(directory, inputs, env);const platforms = await platformReports(directory, candidate);const record = await json(path.join(directory, 'install-record.json')), plan = storagePlan(record, config);assert.equal(candidate.tgzSHA256, inputs.expectedSHA256);@@ -281,7 +269,7 @@ export async function archiveRelease(directory, inputs, config, { run = runFile,const prior = await get(`${prefix}/release-record.json`);let release = { schemaVersion: 2, packageName: candidate.packageName, version: candidate.version, sourceCommit: candidate.sourceCommit,tgzSHA256: candidate.tgzSHA256, integrity: candidate.integrity, candidateRun: candidate.workflow,- approval, publicationRun: env.GITHUB_RUN_ID,+ authorization, publicationRun: env.GITHUB_RUN_ID,platformVerification: platforms, status: 'registry-verified', publishedAt: new Date().toISOString() };if (prior) {const existing = JSON.parse(prior);@@ -321,12 +309,11 @@ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meelse {const inputs = releaseInputs();if (command === 'download') {- const candidate = await downloadCandidate(inputs.candidateRun, directory, inputs.expectedSHA256, fetch, inputs.artifactId);+ const candidate = await downloadCandidate(inputs.version, directory, inputs.expectedSHA256);const { appendFile } = await import('node:fs/promises');await appendFile(process.env.GITHUB_OUTPUT, `tgz_sha256=${candidate.tgzSHA256}\n`);}- else if (command === 'environment') await checkPublicationEnvironment();- else if (command === 'approval') await recordApproval(directory, inputs);+ else if (command === 'authorize') await recordAuthorization(directory, inputs);else if (command === 'rescan') {const c = await verifyDownloaded(directory, inputs.expectedSHA256);await validateSource(extra, c.sourceCommit, c.version);@@ -336,7 +323,7 @@ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meawait writeJSON(path.join(directory, 'publication-source-scan.json'), await scanSource(work, final));await writeJSON(path.join(directory, 'publication-package-scan.json'), await scanPackage(path.join(directory, c.tgz), final));} finally { await runFile('git', ['worktree', 'remove', '--force', work], { cwd: extra }).catch(() => {}); }- } else if (command === 'verify') await verifyDownloaded(directory, inputs.expectedSHA256);+ } else if (command === 'verify') await verifyDownloaded(directory, inputs.expectedSHA256, inputs.version);else if (command === 'npm') await publishNpm(directory, inputs);else if (command === 'archive') {for (const name of ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY']) assert(process.env[name], 'Missing R2 credential: ' + name);diff --git a/.github/workflows/motion-candidate.yml b/.github/workflows/motion-candidate.ymlnew file mode 100644index 00000000..b3e995ce--- /dev/null+++ b/.github/workflows/motion-candidate.yml@@ -0,0 +1,95 @@+name: Motion candidate build+run-name: Motion candidate · ${{ inputs.version }}++on:+ workflow_dispatch:+ inputs:+ version:+ description: 'New test version, e.g. 0.6.4-test.7; build and retain only, never publish'+ type: string+ required: true+ source_sha:+ description: 'Optional reviewed full SHA integrated into feature/motion; empty freezes its current head'+ type: string+ required: false+ default: ''++permissions:+ contents: read++jobs:+ candidate:+ name: Build immutable candidate+ if: github.repository == 'nexu-io/html-anything' && github.ref == 'refs/heads/main'+ runs-on: ubuntu-24.04+ timeout-minutes: 45+ env:+ MOTION_SOURCE_SHA: ${{ inputs.source_sha }}+ MOTION_VERSION: ${{ inputs.version }}+ OPENMOTION_TELEMETRY: '0'+ HYPERFRAMES_BROWSER_PATH: /usr/bin/chromium+ HYPERFRAMES_FFMPEG_PATH: /usr/bin/ffmpeg+ HYPERFRAMES_FFPROBE_PATH: /usr/bin/ffprobe+ steps:+ - uses: actions/[email protected]+ with:+ path: control+ ref: ${{ github.sha }}+ fetch-depth: 0+ persist-credentials: false+ - uses: actions/setup-node@v6+ with:+ node-version: '26.11.1'+ - name: Resolve and freeze the integrated source+ id: source+ run: |+ git -C control fetch origin feature/motion:refs/remotes/origin/feature/motion+ node control/.github/scripts/motion-release.mjs source control+ - uses: actions/[email protected]+ with:+ path: source+ ref: ${{ steps.source.outputs.source_sha }}+ persist-credentials: false+ - name: Scan tracked source before dependency installation+ run: |+ node control/.github/scripts/motion-scan.mjs install "$RUNNER_TEMP/scanner"+ node control/.github/scripts/motion-scan.mjs source source "$RUNNER_TEMP/source-scan.json" "$RUNNER_TEMP/scanner/gitleaks"+ - name: Install rendering test tools+ run: sudo apt-get update -qq && sudo apt-get install -y -qq --no-install-recommends zip unzip chromium ffmpeg fonts-noto-core+ - name: Check the selected source+ working-directory: source+ run: |+ npm ci --no-audit --no-fund+ npm run check+ npm run typecheck:studio+ npm run build:studio+ npm run build:tracking+ node --experimental-strip-types --test tests/tracking.test.ts tests/install.test.ts tests/npm-installer.test.ts tests/npm-package.test.ts tests/test-package.test.ts tests/source-install.test.ts tests/bootstrap.test.ts tests/mcp-registry.test.ts tests/mcp-runtime.test.ts tests/mcp-upgrade.test.ts tests/preview.test.ts tests/phase1.test.ts tests/preview-handoff.test.ts tests/adapters.test.ts tests/package.test.ts tests/recreate-measure.test.ts tests/workflow.test.ts tests/catalog.test.ts tests/prism-templates.test.ts tests/extension-boundary.test.ts tests/connections.test.ts tests/install-guide.test.ts+ npm run test:studio -- --maxWorkers=2+ npm run package:phase1+ archive="$PWD/dist/motion-$(node -p "require('./package.json').version")-phase1.zip"+ node tests/phase1-package.mjs "$archive" "$RUNNER_TEMP/phase1-e2e"+ - name: Build the final prod application tgz once and scan both archives+ env:+ MOTION_SOURCE_SHA: ${{ steps.source.outputs.source_sha }}+ run: |+ node source/scripts/package-npm.mjs "$RUNNER_TEMP/build" "$MOTION_VERSION" --template-env=prod+ cp "$RUNNER_TEMP/source-scan.json" "$RUNNER_TEMP/build/source-scan.json"+ node control/.github/scripts/motion-scan.mjs package "$RUNNER_TEMP/build/openmotion-app-$MOTION_VERSION.tgz" "$RUNNER_TEMP/build/package-scan.json" "$RUNNER_TEMP/scanner/gitleaks"+ node control/.github/scripts/motion-release.mjs seal "$RUNNER_TEMP/build" "$RUNNER_TEMP/candidate" source+ - name: Retain the immutable candidate+ id: artifact+ uses: actions/[email protected]+ with:+ name: motion-candidate-${{ inputs.version }}+ path: ${{ runner.temp }}/candidate/+ retention-days: 30+ if-no-files-found: error+ - name: Show candidate download and tester instructions+ run: |+ node --input-type=module <<'JS'+ import { readFileSync, appendFileSync } from 'node:fs';+ const c = JSON.parse(readFileSync(process.env.RUNNER_TEMP + '/candidate/candidate.json'));+ const run = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;+ appendFileSync(process.env.GITHUB_STEP_SUMMARY, `## Candidate ready for acceptance\n\nVersion: ${c.version}\n\nSource: ${c.sourceCommit}\n\nTGZ SHA256: ${c.tgzSHA256}\n\n[Download motion-candidate-${c.version}](${run}#artifacts), extract it and give the folder to your Agent with this instruction:\n\n> Follow candidate-install.md in this folder to install this exact local candidate into an isolated test profile, application home, project data and Skills directory. Complete prepare and verify host loading. Record requested template/edit/export acceptance results in a private copy of acceptance.md; mark unrun checks NOT RUN. Do not publish.\n\nUse candidate-install.md before publication, not the sibling registry install.md. After acceptance, manually open Motion test publication, enter ${c.version} and confirm acceptance. Nothing was published by this build.\n`);+ JSdiff --git a/.github/workflows/motion-publication-recovery.yml b/.github/workflows/motion-publication-recovery.ymlindex eba6ef89..42ae95cd 100644--- a/.github/workflows/motion-publication-recovery.yml+++ b/.github/workflows/motion-publication-recovery.yml@@ -3,10 +3,15 @@ name: Motion snapshot recoveryon:workflow_dispatch:inputs:- candidate_run_id:- description: 'Original Motion test release run; package must already exist identically on npm'+ version:+ description: 'Exact existing candidate version; the identical package must already be public on npm'type: stringrequired: true+ accepted:+ description: 'I verified this exact candidate and authorize snapshot-only recovery'+ type: boolean+ required: true+ default: falsepermissions:contents: read@@ -21,5 +26,7 @@ jobs:id-token: writeuses: ./.github/workflows/motion-publish-test.ymlwith:- candidate_run_id: ${{ inputs.candidate_run_id }}+ version: ${{ inputs.version }}+ accepted: ${{ inputs.accepted }}+ archive_only: truesecrets: inheritdiff --git a/.github/workflows/motion-publish-test.yml b/.github/workflows/motion-publish-test.ymlindex 8a2d9948..8c5571fa 100644--- a/.github/workflows/motion-publish-test.yml+++ b/.github/workflows/motion-publish-test.yml@@ -1,115 +1,46 @@-name: Motion test release-run-name: Motion test release · ${{ inputs.version || format('snapshot recovery for run {0}', inputs.candidate_run_id) }}+name: Motion test publication+run-name: Motion test publication · ${{ inputs.version }}on:workflow_dispatch:inputs:version:- description: 'New test version, e.g. 0.6.4-test.7; build first, publish only after independent acceptance approval'+ description: 'Exact accepted candidate version, e.g. 0.6.4-test.7; candidate identity is resolved automatically'type: stringrequired: true- source_sha:- description: 'Optional reviewed full SHA already integrated into feature/motion; empty freezes its current head'- type: string- required: false- default: ''+ accepted:+ description: 'I completed the required acceptance for this exact candidate and authorize public test publication'+ type: boolean+ required: true+ default: falseworkflow_call:inputs:- candidate_run_id:- description: 'Existing candidate run for snapshot-only recovery; never publishes npm or advances a guide'+ version:type: stringrequired: true+ accepted:+ type: boolean+ required: true+ archive_only:+ type: boolean+ required: truepermissions:contents: readactions: read+concurrency:+ group: motion-test-publication+ cancel-in-progress: false+env:- MOTION_CANDIDATE_RUN: ${{ inputs.candidate_run_id || github.run_id }}- MOTION_RELEASE_ACTION: ${{ inputs.candidate_run_id != '' && 'archive-only' || 'publish-test' }}+ MOTION_VERSION: ${{ inputs.version }}+ MOTION_ACCEPTED: ${{ inputs.accepted }}+ MOTION_RELEASE_ACTION: ${{ inputs.archive_only && 'archive-only' || 'publish-test' }}jobs:- candidate:- name: Build immutable candidate- if: github.repository == 'nexu-io/html-anything' && github.ref == 'refs/heads/main' && inputs.candidate_run_id == ''- runs-on: ubuntu-24.04- timeout-minutes: 45- outputs:- artifact_id: ${{ steps.artifact.outputs.artifact-id }}- env:- MOTION_SOURCE_SHA: ${{ inputs.source_sha }}- MOTION_VERSION: ${{ inputs.version }}- OPENMOTION_TELEMETRY: '0'- HYPERFRAMES_BROWSER_PATH: /usr/bin/chromium- HYPERFRAMES_FFMPEG_PATH: /usr/bin/ffmpeg- HYPERFRAMES_FFPROBE_PATH: /usr/bin/ffprobe- steps:- - uses: actions/[email protected]- with:- path: control- ref: ${{ github.sha }}- fetch-depth: 0- persist-credentials: false- - uses: actions/setup-node@v6- with:- node-version: '26.11.1'- - name: Resolve and freeze the integrated source- id: source- run: |- git -C control fetch origin feature/motion:refs/remotes/origin/feature/motion- node control/.github/scripts/motion-release.mjs source control- - uses: actions/[email protected]- with:- path: source- ref: ${{ steps.source.outputs.source_sha }}- persist-credentials: false- - name: Scan tracked source before dependency installation- run: |- node control/.github/scripts/motion-scan.mjs install "$RUNNER_TEMP/scanner"- node control/.github/scripts/motion-scan.mjs source source "$RUNNER_TEMP/source-scan.json" "$RUNNER_TEMP/scanner/gitleaks"- - name: Install rendering test tools- run: sudo apt-get update -qq && sudo apt-get install -y -qq --no-install-recommends zip unzip chromium ffmpeg fonts-noto-core- - name: Check the selected source- working-directory: source- run: |- npm ci --no-audit --no-fund- npm run check- npm run typecheck:studio- npm run build:studio- npm run build:tracking- node --experimental-strip-types --test tests/tracking.test.ts tests/install.test.ts tests/npm-installer.test.ts tests/npm-package.test.ts tests/test-package.test.ts tests/source-install.test.ts tests/bootstrap.test.ts tests/mcp-registry.test.ts tests/mcp-runtime.test.ts tests/mcp-upgrade.test.ts tests/preview.test.ts tests/phase1.test.ts tests/preview-handoff.test.ts tests/adapters.test.ts tests/package.test.ts tests/recreate-measure.test.ts tests/workflow.test.ts tests/catalog.test.ts tests/prism-templates.test.ts tests/extension-boundary.test.ts tests/connections.test.ts tests/install-guide.test.ts- npm run test:studio -- --maxWorkers=2- npm run package:phase1- archive="$PWD/dist/motion-$(node -p "require('./package.json').version")-phase1.zip"- node tests/phase1-package.mjs "$archive" "$RUNNER_TEMP/phase1-e2e"- - name: Build the final prod application tgz once and scan both archives- env:- MOTION_SOURCE_SHA: ${{ steps.source.outputs.source_sha }}- run: |- node source/scripts/package-npm.mjs "$RUNNER_TEMP/build" "$MOTION_VERSION" --template-env=prod- cp "$RUNNER_TEMP/source-scan.json" "$RUNNER_TEMP/build/source-scan.json"- node control/.github/scripts/motion-scan.mjs package "$RUNNER_TEMP/build/openmotion-app-$MOTION_VERSION.tgz" "$RUNNER_TEMP/build/package-scan.json" "$RUNNER_TEMP/scanner/gitleaks"- node control/.github/scripts/motion-release.mjs seal "$RUNNER_TEMP/build" "$RUNNER_TEMP/candidate" source- - name: Retain the immutable candidate- id: artifact- uses: actions/[email protected]- with:- name: motion-candidate-${{ github.run_id }}-${{ github.run_attempt }}- path: ${{ runner.temp }}/candidate/- retention-days: 30- if-no-files-found: error- - name: Show download, isolated install and acceptance instructions- run: |- node --input-type=module <<'JS'- import { readFileSync, appendFileSync } from 'node:fs';- const c = JSON.parse(readFileSync(process.env.RUNNER_TEMP + '/candidate/candidate.json'));- const run = `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`;- appendFileSync(process.env.GITHUB_STEP_SUMMARY, `## Candidate ready for acceptance\n\nVersion: ${c.version}\n\nSource: ${c.sourceCommit}\n\nTGZ SHA256: ${c.tgzSHA256}\n\n[Download motion-candidate-${c.workflow.runId}-${c.workflow.attempt}](${run}#artifacts) and extract it.\n\nApply the isolated host/profile, application home, project data and Skills paths from docs/npm-installation.md, then use this local package (select your actual host):\n\n\`npx --yes --package "./${c.tgz}" openmotion setup --host HOST\`\n\nRepeat the same package and explicit home for prepare. Never accept through the unpublished registry version.\n\nComplete the generated acceptance.md internally, including install, templates, real Agent creation, edit/export and human audio/video playback. The independent reviewer then opens Review deployments, checks this exact candidate and enters only PASS in the approval comment. Do not paste internal links or test material. Reject if acceptance failed. Nothing has been published yet.\n`);- JS-verify:- needs: candidate- if: ${{ always() && !cancelled() && github.repository == 'nexu-io/html-anything' && github.ref == 'refs/heads/main' && (needs.candidate.result == 'success' || (inputs.candidate_run_id != '' && needs.candidate.result == 'skipped')) }}+ if: github.repository == 'nexu-io/html-anything' && github.ref == 'refs/heads/main'runs-on: ubuntu-24.04timeout-minutes: 15outputs:@@ -128,9 +59,8 @@ jobs:id: downloadenv:GH_TOKEN: ${{ github.token }}- MOTION_CANDIDATE_ARTIFACT_ID: ${{ needs.candidate.outputs.artifact_id }}run: node .github/scripts/motion-release.mjs download "$RUNNER_TEMP/candidate"- - name: Recheck source, archives and protected publication configuration+ - name: Recheck the integrated source and both archivesenv:GH_TOKEN: ${{ github.token }}MOTION_EXPECTED_SHA256: ${{ steps.download.outputs.tgz_sha256 }}@@ -138,7 +68,6 @@ jobs:git fetch origin feature/motion:refs/remotes/origin/feature/motionnode .github/scripts/motion-scan.mjs install "$RUNNER_TEMP/scanner"node .github/scripts/motion-release.mjs rescan "$RUNNER_TEMP/candidate" "$PWD" "$RUNNER_TEMP/scanner/gitleaks"- node .github/scripts/motion-release.mjs environment "$RUNNER_TEMP/candidate"- uses: actions/[email protected]id: artifactwith:@@ -146,26 +75,12 @@ jobs:path: ${{ runner.temp }}/candidate/retention-days: 30if-no-files-found: error- - name: Show the existing candidate for snapshot recovery approval- if: inputs.candidate_run_id != ''- run: |- node --input-type=module <<'JS'- import { readFileSync, appendFileSync } from 'node:fs';- const c = JSON.parse(readFileSync(process.env.RUNNER_TEMP + '/candidate/candidate.json'));- appendFileSync(process.env.GITHUB_STEP_SUMMARY, `## Snapshot recovery requires independent approval\n\nVersion: ${c.version}\n\nSource: ${c.sourceCommit}\n\nTGZ SHA256: ${c.tgzSHA256}\n\nOriginal candidate: https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${c.workflow.runId}\n\nReview the retained identity and existing npm publication, then approve with PASS or reject. Recovery never publishes npm or changes the default guide.\n`);- JSnpm:if: ${{ always() && !cancelled() && needs.verify.result == 'success' }}env:MOTION_EXPECTED_SHA256: ${{ needs.verify.outputs.tgz_sha256 }}needs: verify- concurrency:- group: motion-npm-test- cancel-in-progress: false- environment:- name: motion-test-publish- url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifactsruns-on: ubuntu-24.04timeout-minutes: 15outputs:@@ -189,10 +104,10 @@ jobs:github-token: ${{ github.token }}run-id: ${{ github.run_id }}path: ${{ runner.temp }}/candidate- - name: Record the independent acceptance approval+ - name: Record explicit operator acceptance authorizationenv:GH_TOKEN: ${{ github.token }}- run: node .github/scripts/motion-release.mjs approval "$RUNNER_TEMP/candidate"+ run: node .github/scripts/motion-release.mjs authorize "$RUNNER_TEMP/candidate"- name: Publish the accepted bytes with npm trusted publishing, or verify an identical existing versionrun: node .github/scripts/motion-release.mjs npm "$RUNNER_TEMP/candidate"- name: Retain npm publication state even after a partial failure@@ -203,7 +118,7 @@ jobs:name: npm-publication-${{ github.run_id }}-${{ github.run_attempt }}path: |${{ runner.temp }}/candidate/npm-publication.json- ${{ runner.temp }}/candidate/approval.json+ ${{ runner.temp }}/candidate/authorization.jsonretention-days: 30if-no-files-found: warn@@ -283,9 +198,6 @@ jobs:snapshot:if: ${{ always() && !cancelled() && needs.verify.result == 'success' && needs.npm.result == 'success' && needs.registry-mac.result == 'success' && needs.registry-windows.result == 'success' }}- concurrency:- group: motion-install-guide-test- cancel-in-progress: falseenv:MOTION_EXPECTED_SHA256: ${{ needs.verify.outputs.tgz_sha256 }}MOTION_INSTALL_PUBLIC_ORIGIN: ${{ vars.CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN }}diff --git a/AGENTS.md b/AGENTS.mdindex d0c7f9ec..7459f1fc 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -45,6 +45,6 @@ Phase one exposes eleven motion_ Tools (nine project tools plus catalog fetch an## Candidate and publication controls-Follow [the release workflow manual](docs/release-workflows.md): one daily build/accept/approve entry and a separate snapshot-only recovery entry. Keep full acceptance evidence private; independent reviewers authorize the frozen candidate through the protected npm job, without manually copying hashes. Public candidates must use an exact reviewed source SHA integrated into `feature/motion`, a new test version and prod template defaults. Scan tracked source plus the outer npm tgz and inner application; preserve the positive distribution list and licenses. Keep candidate, native registry installation, real Agent creation and human acceptance evidence separate.+Follow [the release workflow manual](docs/release-workflows.md): separate manual candidate-build and test-publication entries, plus snapshot-only recovery. Download and accept the local tgz using candidate-install.md; keep completed acceptance.md private. The publication operator enters the accepted version and explicitly confirms acceptance, without manually copying hashes. No independent approval environment is enabled at this stage. Public candidates must use an exact reviewed source SHA integrated into `feature/motion`, a new test version and prod template defaults. Scan tracked source plus the outer npm tgz and inner application; preserve the positive distribution list and licenses. Keep candidate, native registry installation, real Agent creation and human acceptance evidence separate.-Publication uses the accepted candidate bytes, never a rebuild. Only the separately authorized manual test publication workflow may use npm OIDC or R2 credentials; validate candidate provenance and hashes first, archive immutable version records, and update the moving guide last. Archive-only work must not move tags or default entries. Never overwrite published versions, put private DEV data/internal acceptance material into public artifacts, or infer merge/publication authorization from green CI. Main registration, environment protection, npm trust, main cutover and repository rename remain separate operations.+Publication uses the accepted candidate bytes, never a rebuild. Only the separately authorized manual test publication workflow may use npm OIDC or R2 credentials; validate candidate provenance and hashes first, archive immutable version records, and update the moving guide last. Archive-only work must not move tags or default entries. Never overwrite published versions, put private DEV data/internal acceptance material into public artifacts, or infer merge/publication authorization from green CI. Main registration, npm trust, main cutover and repository rename remain separate operations.diff --git a/CLAUDE.md b/CLAUDE.mdindex 0ee61cd6..5bc7bc89 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -4,6 +4,6 @@ Read and follow [AGENTS.md](AGENTS.md) before working in this repository. It is## Candidate and publication controls-Follow [the release workflow manual](docs/release-workflows.md): one daily build/accept/approve entry and a separate snapshot-only recovery entry. Keep full acceptance evidence private; independent reviewers authorize the frozen candidate through the protected npm job, without manually copying hashes. Public candidates must use an exact reviewed source SHA integrated into `feature/motion`, a new test version and prod template defaults. Scan tracked source plus the outer npm tgz and inner application; preserve the positive distribution list and licenses. Keep candidate, native registry installation, real Agent creation and human acceptance evidence separate.+Follow [the release workflow manual](docs/release-workflows.md): separate manual candidate-build and test-publication entries, plus snapshot-only recovery. Download and accept the local tgz using candidate-install.md; keep completed acceptance.md private. The publication operator enters the accepted version and explicitly confirms acceptance, without manually copying hashes. No independent approval environment is enabled at this stage. Public candidates must use an exact reviewed source SHA integrated into `feature/motion`, a new test version and prod template defaults. Scan tracked source plus the outer npm tgz and inner application; preserve the positive distribution list and licenses. Keep candidate, native registry installation, real Agent creation and human acceptance evidence separate.-Publication uses the accepted candidate bytes, never a rebuild. Only the separately authorized manual test publication workflow may use npm OIDC or R2 credentials; validate candidate provenance and hashes first, archive immutable version records, and update the moving guide last. Archive-only work must not move tags or default entries. Never overwrite published versions, put private DEV data/internal acceptance material into public artifacts, or infer merge/publication authorization from green CI. Main registration, environment protection, npm trust, main cutover and repository rename remain separate operations.+Publication uses the accepted candidate bytes, never a rebuild. Only the separately authorized manual test publication workflow may use npm OIDC or R2 credentials; validate candidate provenance and hashes first, archive immutable version records, and update the moving guide last. Archive-only work must not move tags or default entries. Never overwrite published versions, put private DEV data/internal acceptance material into public artifacts, or infer merge/publication authorization from green CI. Main registration, npm trust, main cutover and repository rename remain separate operations.diff --git a/docs/product/architecture.md b/docs/product/architecture.mdindex d28bdfb7..a2b9ba6b 100644--- a/docs/product/architecture.md+++ b/docs/product/architecture.md@@ -187,7 +187,7 @@ Explicit test/stable prod builds produce publishable artifact metadata with test## 演进约束-The application npm format is the default; complete platform ZIPs are backups. Ordinary PR CI scans tracked source and both npm archive layers without publication credentials. One manual test-release entry resolves a fixed integrated source SHA, builds one immutable prod candidate and generated acceptance checklist, then pauses at a protected independent approval. Source/artifact/hash identity flows automatically between successful jobs; the approval receipt records run-scoped GitHub review history while full acceptance evidence stays private. After approval, the same tgz is published to npm test, checked anonymously on separate Mac/Windows runners and archived before conditionally advancing the default guide. Candidate production may complete while the overall release is still awaiting approval; origin validation checks the successful producer job and exact artifact attempt rather than requiring a finished release run. Builds can continue during acceptance; job-level publication serialization, version checks and ETag writes prevent late older candidates from rolling the moving entry backward. Snapshot-only recovery does not move the default. Private DEV template artifacts remain outside these public workflows. Stable publication is a separate authorized process. Trusted default-branch registration, a protected publication environment and npm OIDC setup remain administrator prerequisites, not enabled by this feature PR. Build, native installation, real Agent creation and human playback remain separate evidence. See [release workflows](../release-workflows.md) and [package checks](../test-packages.md).+The application npm format is the default; complete platform ZIPs are backups. Ordinary PR CI scans tracked source and both npm archive layers without publication credentials. Separate manual candidate-build and test-publication entries implement build → download/accept → publish. The build freezes an integrated source SHA, builds one immutable prod candidate and generates a local candidate-install.md plus an identity-filled acceptance checklist. Publication resolves a unique unexpired versioned artifact from a completed successful build, validates official ZIP/file hashes and source integration, and requires explicit operator acceptance. No independent approval environment is enabled; the manual operator receipt is not proof of private tests or independent review. The same tgz is published to npm test, checked anonymously on separate Mac/Windows runners and archived before conditionally advancing the default guide. Builds can continue during acceptance; publication-only serialization, version checks and ETag writes prevent late older candidates from rolling the moving entry backward. Snapshot-only recovery requires an existing identical npm version and does not move the default. Private DEV template artifacts remain outside these public workflows. Stable publication is a separate authorized process. Trusted default-branch registration and npm OIDC setup remain separate prerequisites, not enabled by this feature PR. Build, native installation, real Agent creation and human playback remain separate evidence. See [release workflows](../release-workflows.md) and [package checks](../test-packages.md).Downstream publication jobs consume immutable producer artifact IDs retained across partial retries; native Mac and Windows jobs expose separate report identities. OIDC authenticates publication, but automatic npm provenance is disabled for prebuilt candidates because the publication workflow SHA differs from the application source. Candidate/manifest/hash records provide traceability without claiming a signed build attestation. Stable version construction and URL contracts exist; a stable candidate/publication workflow is not implemented.diff --git a/docs/release-guide.md b/docs/release-guide.mdindex 6f7c3baa..fde1780f 100644--- a/docs/release-guide.md+++ b/docs/release-guide.md@@ -62,7 +62,7 @@ Each defect needs exact package/source/OS/host/environment/catalog identity, proOrdinary npm/prod CI builds generate a **candidate-only** guide and retain it as an Actions artifact for 14 days. The publisher rejects candidate previews. DEV/private packages cannot produce a public guide.-Maintainers use the single [build, accept and approve entry](release-workflows.md): enter a test version, download its frozen candidate and generated acceptance checklist, then independently approve the protected npm job. Candidate identity and hashes are passed automatically; the reviewer keeps completed evidence internally and enters only PASS in the public approval comment. The same accepted bytes receive anonymous native registry checks and immutable snapshots before the moving test guide can advance. Snapshot-only recovery is a separate maintenance entry. The former CI guide-only upload route is removed so it cannot bypass these gates. Ordinary PR CI remains read-only.+Maintainers follow [build → download and accept → publish](release-workflows.md): first run Motion candidate build with a new test version, download its frozen candidate and follow the included `candidate-install.md` to install the local tgz in an isolated host. Keep completed `acceptance.md` privately. After acceptance, run Motion test publication with that exact version and confirm acceptance. Candidate lookup and hashes are automatic; no independent approval environment is enabled. The same accepted bytes receive anonymous native registry checks and immutable snapshots before the moving test guide can advance. Snapshot-only recovery is a separate maintenance entry. The former CI guide-only upload route is removed so it cannot bypass these checks. Ordinary PR CI remains read-only.These manual entries support test versions only. Stable package construction and the stable URL contract exist, but stable candidate/publication/channel promotion still require a separate implementation and authorization. Partial retries retain the actual successful producer artifact IDs; automatic npm provenance is disabled for prebuilt candidates while OIDC authentication remains enabled. See the workflow manual for the source/hash evidence and recovery limits.@@ -70,4 +70,4 @@ The short test/stable version URL contract and historical `/versions/` URLs remaThe configured destination bucket is `open-design-releases` and the public origin is `https://releases.open-design.ai`. After stable publication, the website can give the Agent a short prompt: "Read `https://releases.open-design.ai/open-motion/install.md`, install OpenMotion MCP and Skills for my current supported Agent host, preserve existing projects/settings, and report installation and preparation results." Use `https://releases.open-design.ai/open-motion/dev/install.md` for the test software channel. The test guide now pins `@openmotion/[email protected]`, with an immutable copy at `open-motion/dev/0.6.4-test.6/install.md`; both canonical public URLs were verified byte-for-byte against guide SHA256 `4b6f6b25c782c23d5529d225c6c0506d524b245a242f54d84fbf8d4dd61f4f05` after the [upload run](https://github.com/nexu-io/html-anything/actions/runs/42633147999). The short test.6 URL was added by [run 42638072025](https://github.com/nexu-io/html-anything/actions/runs/42638072025), with the same verified bytes as the retained legacy `/versions/0.6.4-test.6/install.md` URL. The older test.5 and test.4 immutable instructions remain unchanged; test.4 records the historical `@open-design/motion` name. Their existence does not imply those old npm versions were published. The stable entry is untouched and currently returns HTTP 404. Guide publication and npm publication remain separate operations.-The new entries require separate trusted default-branch registration, a reviewed GitHub publication environment and npm trusted-publisher setup before use. Those administrative steps are not performed by this feature PR. Existing R2 credentials are reused only in the final snapshot job. No workflow was dispatched or package published as part of implementing these controls. See [setup, records and recovery](release-workflows.md).+The new entries require separate trusted default-branch registration, npm trusted-publisher setup before use. Those administrative steps are not performed by this feature PR. Existing R2 credentials are reused only in the final snapshot job. No workflow was dispatched or package published as part of implementing these controls. See [setup, records and recovery](release-workflows.md).diff --git a/docs/release-workflows.md b/docs/release-workflows.mdindex 0cf5f7fc..670c2aa7 100644--- a/docs/release-workflows.md+++ b/docs/release-workflows.md@@ -1,28 +1,30 @@-# Motion test release: build, accept, approve+# Motion test release: build, accept, publish-The daily entry is **Actions → Motion test release → Run workflow**. It builds a complete `@openmotion/app` candidate, pauses at one protected environment approval, then publishes those same bytes. It never runs on pushes, PR merges, tags or a schedule. This implementation does not register workflows on `main`, configure repository/npm permissions, publish a package or switch the product main branch.+Use two manual Actions entries: **Motion candidate build**, then **Motion test publication** after acceptance. The daily flow is **build → download and accept → publish**. Neither entry runs on pushes, PR merges, tags or a schedule. This implementation does not register workflows on `main`, configure repository/npm permissions, publish a package or switch the product main branch.| Operator step | Automated work || --- | --- |-| Enter a new version and run | Freeze the current `feature/motion` SHA, check/build/scan once, retain the candidate and show download/install instructions |-| Download and accept the candidate | Retain the exact package identity and generate `acceptance.md`; no publication yet |-| Independently approve with `PASS` | Publish the accepted tgz to npm `test`, perform native registry checks, archive version snapshots and update the default guide last |+| Build: enter a new test version | Freeze the current `feature/motion` SHA, check/build/scan once, retain the candidate and show download/install instructions |+| Download and accept | Use `candidate-install.md` and the local tgz in an isolated host; retain completed `acceptance.md` internally |+| Publish: enter the accepted version and confirm acceptance | Find the unique candidate automatically, verify its source/hashes, publish the same tgz to npm `test`, check native installations, archive snapshots and update the default guide last |++**No independent approval environment is enabled at this stage.** The publication checkbox is explicit authorization by the operator, not evidence of an independent review or proof that the tests happened. Anyone able to dispatch the trusted publication workflow can authorize publication; the team must control that access and keep the acceptance record. Adding a separate required reviewer later is a separate decision.Public test software uses **prod templates**. A URL containing `dev` selects the test software channel, not private DEV template data. Stable version construction and URL contracts exist, but a stable release workflow is not implemented.## First-time administrator setup-The default `main` currently contains the legacy project. GitHub must register these reviewed control files on the default branch through a separately authorized PR before the manual entries are available. This registration does not copy the Motion application onto `main` or rewrite its history. Always select **Use workflow from: main**.+The default `main` currently contains the legacy project. GitHub requires a `workflow_dispatch` workflow to exist on the **default branch** before its manual entry is available; it can otherwise run from another ref. This project's controls deliberately require **Use workflow from: main**, while the application source comes from `feature/motion`. Register the reviewed control files through a separately authorized small PR. This does not copy the Motion application onto `main` or rewrite its history. See [GitHub's manual workflow requirements](https://docs.github.com/en/actions/how-tos/manage-workflow-runs/manually-run-a-workflow).Register these files together:-- `.github/workflows/motion-publish-test.yml` and `motion-publication-recovery.yml`; remove an older `motion-candidate.yml` registration if one exists.+- `.github/workflows/motion-candidate.yml`, `motion-publish-test.yml` and `motion-publication-recovery.yml`.- `.github/scripts/motion-release.mjs`, `motion-scan.mjs`, `motion-registry-smoke.mjs`, `publish-install-guide.mjs` and `.github/gitleaks.toml`.-- `scripts/runtime-assets.mjs`, `release-version.mjs`, `install-guide.mjs`, `docs/install.md` and `docs/templates/release-record.md`.+- `scripts/runtime-assets.mjs`, `release-version.mjs`, `install-guide.mjs`, `docs/install.md`, `docs/templates/release-record.md` and `docs/templates/candidate-install.md`.-Protect changes to the trusted control files and `main`. Configure the **`motion-test-publish` GitHub Environment** with required independent reviewers, **prevent self-review**, **disable administrator bypass**, and allow exactly the `main` **branch** (no tag or wildcard policy). The workflow checks these actual settings before it can request approval and again inside the protected npm job. A missing or unprotected environment fails closed; naming an environment in YAML alone does not configure it. Test both rejection and approval before enabling real publication.+Protect changes to the trusted control files and `main`. There is no `motion-test-publish` GitHub Environment prerequisite or Review deployments step in this version.-For `@openmotion/app`, configure npm trusted publishing for owner `nexu-io`, repository `html-anything`, workflow **`motion-publish-test.yml`**, environment **`motion-test-publish`**, allowing publish. The workflow uses GitHub-hosted runners, Node 26.11.1/npm 11.20.0 and `id-token: write`; no stored npm token is needed. Do not grant tag-management actions. The recovery caller is not an npm trusted publisher and never calls npm publish. See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/).+For `@openmotion/app`, open npm **Settings → Trusted publishing → Add trusted publisher → GitHub Actions**. Set owner **`nexu-io`**, repository **`html-anything`**, workflow filename **`motion-publish-test.yml`** (no directory), **leave Environment blank**, and allow **npm publish**. Do not grant tag-management actions. If an older entry names an environment, it must be updated to match this workflow before publication. GitHub-hosted runners use Node 26.11.1/npm 11.20.0 and `id-token: write`; no stored npm token is needed. The recovery caller never calls npm publish. See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/).Reuse the existing R2 settings. Only the final snapshot step receives the storage credentials:@@ -35,40 +37,39 @@ Reuse the existing R2 settings. Only the final snapshot step receives the storag## 1. Build-Open **Motion test release → Run workflow**, select `main` and fill in **version**, for example `0.6.4-test.7`. Use a new `MAJOR.MINOR.PATCH-test.N[.N]`; never change bytes under an existing published version.+Open **Actions → Motion candidate build → Run workflow**, select `main` and fill in **version**, for example `0.6.4-test.7`. Use a new `MAJOR.MINOR.PATCH-test.N[.N]` for each candidate. Never change bytes under an existing published version.Normally leave **source_sha** empty. The build fetches `feature/motion`, resolves its current full SHA once, records it and checks out exactly that SHA. To test a particular reviewed integrated commit, supply its full 40-character SHA. A later branch update cannot silently change this candidate. Confirm the chosen source has completed the required integration review.-The build scans tracked source before dependency installation, runs the technical checks/Studio regression/eleven-Tool ZIP E2E, builds the final prod npm tgz once and scans its outer and inner archives. It does not have npm OIDC or R2 credentials. Successful output is retained as `motion-candidate-<run-id>-<attempt>` for **30 days**.+The build scans tracked source before dependency installation, runs the technical checks/Studio regression/eleven-Tool ZIP E2E, builds the final prod npm tgz once and scans its outer and inner archives. It has no npm OIDC or R2 credentials. Successful output is retained as **`motion-candidate-<version>` for 30 days**. Wait for the whole build run to succeed before publication.-The artifact contains eight files: `openmotion-app-<version>.tgz`, `release-npm.json`, `source-scan.json`, `package-scan.json`, `install.md`, `install-record.json`, `acceptance.md` and `candidate.json`. The schema-2 candidate records source/control SHA, producer run/attempt and file hashes. Its acceptance state remains `not-performed`. The generated checklist has the machine identity filled in and human results set to `NOT RUN`.+The artifact contains nine files: `openmotion-app-<version>.tgz`, `release-npm.json`, `source-scan.json`, `package-scan.json`, `install.md`, `install-record.json`, **`candidate-install.md`**, `acceptance.md` and `candidate.json`. The schema-2 candidate records source/control SHA, producer run/attempt and file hashes. Its acceptance state remains `not-performed`. The generated checklist fills machine identity only; human results start at `NOT RUN`.-The frozen `install.md` pins a registry version which is not published yet. Do not hand it out as a working npm installation link before publication.+`candidate-install.md` installs the exact **local tgz**. The sibling frozen `install.md` pins the registry version for **after publication** and cannot install an unpublished version. The candidate guide template is a CI helper, not an addition to the product distribution list.-## 2. Accept the downloaded package+## 2. Download and accept-Open the run summary and download/extract its candidate artifact. Follow the isolated profile, application home, project data and Skills recipes in [npm installation](npm-installation.md). Use the **local tgz**, replacing `HOST` with the actual selected supported host:+1. Open the successful build summary, download `motion-candidate-<version>` and extract the ZIP.+2. Give that directory to your Agent and copy this instruction:-```sh-npx --yes --package "./openmotion-app-0.6.4-test.7.tgz" openmotion setup --host HOST-npx --yes --package "./openmotion-app-0.6.4-test.7.tgz" openmotion prepare-```+ > Read candidate-install.md in this folder. Read candidate.json, verify the local tgz SHA256, and install this exact local OpenMotion candidate. Use a separate test host profile/configuration, application home, data directory and Skills directory; preserve my daily environment. Complete prepare, then verify actual MCP/Skills loading and the requested template, editing and export checks. Record actual results in a private copy of acceptance.md; mark unrun checks NOT RUN. Do not publish.-These short commands require the isolation options/environment from the platform recipe first. Repeat the same explicit application home on setup and prepare. Do not use the unpublished npm version or your normal daily Agent profile for candidate acceptance. Copy the one tgz into a clean consumer directory; its application is embedded and needs no source checkout or sidecar archive.+3. Follow the actual supported host/platform isolation recipe in [npm installation](npm-installation.md). Setup and prepare must use the same explicit application home; `--home` alone does not isolate the host profile. The application is embedded: no source checkout or sidecar application/manifest download is needed. Native dependencies still need network access.+4. Complete **`acceptance.md` privately** with PASS / FAIL / NOT RUN, supported OS/host, template/catalog identity, existing-data preservation, real Agent creation/edit/export, normal-speed human audio/video playback, known issues and recovery. [The acceptance guide](release-guide.md) defines the checks. Build success cannot fill human results.-Complete the generated **`acceptance.md` privately**: record PASS / FAIL / NOT RUN, supported OS/host, template/catalog identity, existing-data preservation, real Agent creation/edit/export, normal-speed human audio/video playback, known issues and recovery. [The acceptance guide](release-guide.md) defines the checks. Build success cannot fill the human results. Keep that completed evidence against the generated candidate identity; do not edit or re-upload the frozen public candidate artifact. No run ID, tgz hash or private-record hash needs to be typed into a second release form.+Keep completed evidence against the generated candidate identity. Do not edit/re-upload the frozen candidate artifact or place private test results in public Actions artifacts. Stop on failed or incomplete required acceptance; code changes need a new candidate version. No run ID, tgz hash or private-record hash needs to be copied into the publication form.-## 3. Approve once+## 3. Publish the accepted version-The npm job waits at **Review deployments → motion-test-publish**. An independent configured reviewer inspects this run's exact version/source/hash and the internally retained acceptance record. If required checks failed or remain incomplete, reject. If accepted, enter only **`PASS`** in the approval comment and approve. The comment is a public, non-sensitive authorization signal; never paste internal URLs, logs, credentials or user material there.+Open **Actions → Motion test publication → Run workflow**, select `main`, enter the exact accepted **version**, and tick **accepted** only after its required acceptance passes. Click **Run workflow**. This is the explicit publication action; there is no later independent approval dialog. Leaving the checkbox false fails before any publication.-The protected job rechecks the environment and reads GitHub's review history. It requires an independent approved review with that exact comment. The receipt records actual reviewer logins, the observed time and a review-history digest, not the triggering operator as the approver. GitHub's history is run-scoped and has no per-review timestamp/attempt binding: the receipt says so, and the environment gate enforces approval for the job execution. The receipt does not prove that the private tests happened or cryptographically attest the private acceptance document. Keep the completed internal record.+The workflow searches GitHub artifacts by the exact versioned name and requires exactly one unexpired match from a completed successful registered candidate build on `main` in this repository. Missing, ambiguous, expired or failed candidates stop instead of choosing a different run. The official ZIP digest, frozen file hashes and source integration are checked; source and package scans run again. The current manual run's actual operator, candidate identity and acceptance confirmation are retained in `authorization.json`.-After approval the workflow automatically:+It then automatically:1. Publishes only the accepted tgz with `--tag test --ignore-scripts --provenance=false`, or verifies an already published identical version. It rejects an older test version than the current npm test channel and never overwrites different bytes.2. On separate macOS arm64 and Windows x64 runners without publication credentials, anonymously downloads the exact registry version, verifies its hashes, prepares Chromium/FFmpeg/ffprobe, runs isolated setup/repeat setup and checks the eleven Tools/resources and five Skills. These are native technical checks, not real-model or human playback acceptance.-3. Requires both platform reports, archives immutable R2 snapshots and checks canonical public bytes. Only then conditionally advances the default test guide. R2 needs no second approval: it consumes the retained approval from the successful npm job plus both native reports. The snapshot job executes trusted `main` controls and never executes the candidate application.+3. Requires both platform reports, archives immutable R2 snapshots and checks canonical public bytes. Only then conditionally advances the default test guide. The snapshot job consumes the operator authorization and both native reports, executes trusted `main` controls and never executes the candidate application.4. Shows the exact version, publication phase, versioned installation guide and default guide in the run summary.OIDC authenticates the publisher. Automatic npm provenance remains disabled because this trusted control workflow's `main` SHA differs from the selected application source SHA. Candidate/manifest/lock/hash records provide traceability, not a signed build attestation.@@ -82,18 +83,18 @@ OIDC authenticates the publisher. Automatic npm provenance remains disabled becaThis workflow does not publish stable versions or move npm `latest`. The storage helper supports stable paths without providing a stable publication job. Existing legacy `/versions/<version>/install.md` objects remain immutable.-Each test version also archives the exact tgz, manifests, blank generated acceptance checklist, scans, candidate identity, both platform reports and the schema-2 release record. The release record contains package/source identity and the run-scoped approval receipt. Completed private acceptance material is never uploaded. A previous immutable release record is preserved during snapshot recovery, while the recovery attempt retains its own fresh approval receipt.+Each test version archives the exact tgz, manifests, generated blank acceptance checklist, both installation guides, scans, candidate identity, both platform reports and the schema-2 release record. The release record contains package/source identity and the manual operator authorization; it does not claim independent review or attest private test results. Completed private acceptance material is never uploaded. Snapshot recovery preserves a prior immutable release record while retaining its own fresh operator authorization in its attempt artifact.-Builds and approval waits do not hold a workflow-wide release lock, so another version can build. npm writes and default-guide writes have separate job-level concurrency groups. GitHub concurrency is not a durable FIFO: it retains one running and one newest pending job, so do not enqueue a batch of releases for automatic publication; a displaced run keeps its candidate and can be reviewed/rerun deliberately. Approve one release at a time. A candidate superseded after npm publication can retain version snapshots without moving the default. Default-guide version comparison plus ETag conditional writes prevent a late older completion from rolling a newer entry back; unrecognized or conflicting same-version guide bytes require inspection.+Builds have no publication lock, so another version can build during acceptance. Publication and snapshot recovery share one workflow-wide concurrency group with cancellation disabled. GitHub concurrency is not a durable FIFO: it retains one running and one newest pending run; do not enqueue a batch. Publish one accepted version at a time. A superseded candidate can retain version snapshots without moving the default. Default-guide version comparison plus ETag conditional writes prevent late older completion from rolling a newer entry back; unrecognized or conflicting same-version guide bytes require inspection.-Actions artifacts and attempt records expire after **30 days**. R2 snapshots follow the separately managed bucket lifecycle. Approval does not extend artifact retention. Expired/deleted artifacts fail closed; keep internal evidence before expiry and build a new version when necessary.+Actions artifacts and attempt records expire after **30 days**. R2 snapshots follow the separately managed bucket lifecycle. Acceptance does not extend artifact retention. Two unexpired builds with the same version are ambiguous and blocked; use a new version rather than asking the publisher to guess. Expired/deleted artifacts fail closed; retain internal evidence before expiry and build a new version when necessary.## Failure and snapshot recovery-- Before approval: a scan/build/configuration failure or rejection publishes nothing. Cancel/reject an unwanted candidate. Fix code under a new version when bytes change.-- After approval: npm may already be public if a native or R2 stage fails. The default guide remains unchanged until its checks pass. Inspect retained npm state and release-attempt/publication files; do not rebuild or blindly republish.-- Use **Re-run failed jobs** for a partial failure. Consumers use successful producer artifact IDs rather than guessing their own attempt. A retry of the protected npm job requires approval again; a snapshot-only retry continues under its retained successful approval. **Re-run all jobs rebuilds the candidate** and requires renewed acceptance; do not use it to resume already-published changed bytes.-- **Motion snapshot recovery** is a separate maintenance entry. Select `main`, enter the original daily release run ID and independently approve its existing candidate. It skips the build, requires an already published identical npm version, repeats native checks and fills missing immutable snapshots. It never publishes npm, moves npm tags or accesses the moving guide. If the latest candidate-producing attempt is failed, ambiguous, expired or incompatible, it stops rather than guessing another artifact.+- Before clicking publish: building, downloading and testing publish nothing. Discard an unwanted candidate. Fix code under a new version when bytes change.+- After clicking publish: npm may already be public if a native or R2 stage fails. The default guide stays unchanged until its checks pass. Inspect retained npm state and release-attempt/publication files; do not rebuild or blindly republish.+- Use **Re-run failed jobs** for a partial publication failure. Consumers use successful producer artifact IDs rather than guessing their own attempt. Re-running publication reuses the existing candidate and original accepted version; it does not rebuild. A candidate build rerun is different: a successful new artifact must be accepted again, and duplicate version artifacts block publication.+- **Motion snapshot recovery** is a separate maintenance entry. Select `main`, enter the existing candidate version and confirm snapshot-only recovery. It requires an already published identical npm version, repeats native checks and fills missing immutable snapshots. It never builds, publishes npm, moves npm tags or accesses the moving guide. Missing/expired/ambiguous candidates stop.- Version writes use conditional create and byte comparison. Same bytes resume; different immutable bytes stop. A public readback error blocks promotion. A failure after `fixed-write-attempted` may mean the moving write completed: inspect storage and its canonical URL before retrying.- An unexpected npm `latest` change stops promotion. This workflow does not silently repair tags. Channel rollback is a separate reviewed operation and does not downgrade installed clients or restore their data.@@ -101,6 +102,6 @@ Source/package scans are not a scan of every historical Git object or business c## Validation before activation-Run the repository's release/scanner/guide tests and actionlint. Their no-publication rehearsal uses temporary candidate files and simulated GitHub/npm/R2 responses to test the whole transition and failures. It does **not** exercise hosted approval policy, npm OIDC, real registry installation or CDN routing.+Run the repository's release/scanner/guide tests and actionlint. The no-publication rehearsal uses temporary candidate files and simulated GitHub/npm/R2 responses to test the transition and failure cases. It does **not** exercise npm OIDC, hosted native installation or CDN routing.-After separately authorized default-branch/environment/npm setup, first run a new candidate and reject its deployment to verify that no publication occurs. A positive hosted rehearsal that proceeds beyond approval is a real publication and requires explicit release authorization. Ordinary PR CI remains credential-free. This implementation PR alone enables none of those administrative actions.+After separately authorized default-branch/npm setup, build a new candidate and verify that building alone publishes nothing. A publication dispatch with acceptance unchecked must fail closed. A positive hosted publication rehearsal is a real publication and needs explicit release authorization. Ordinary PR CI remains credential-free. This implementation PR enables none of those administrative actions by itself.diff --git a/docs/templates/candidate-install.md b/docs/templates/candidate-install.mdnew file mode 100644index 00000000..19072324--- /dev/null+++ b/docs/templates/candidate-install.md@@ -0,0 +1,28 @@+# Install the OpenMotion {{VERSION}} candidate++This is a **local candidate installation guide**. It installs the complete `{{TGZ}}` next to this file, not an unpublished npm registry version. The application, MCP, built Studio and five Skills are embedded. Native browser/FFmpeg/ffprobe and locked npm dependencies still need network access when prepared. Public test software defaults to prod templates.++## Frozen identity++- Version: `{{VERSION}}`+- Source: `{{SOURCE_SHA}}`+- Local file: `{{TGZ}}`+- TGZ SHA256: `{{SHA256}}`++## Instructions for the Agent++1. Read `candidate.json` in this extracted directory. Require its version, source commit, tgz filename and hash to match the identity above. Calculate the local tgz SHA256 before running it. Stop on a missing file or any mismatch; do not substitute npm `test`, `latest` or another candidate.+2. Collect OS/CPU, Node/npm and the actual Agent host once. Apply the supported [isolated platform recipes]({{DETAILS_URL}}): separate the host profile/configuration, application home, project data and Skills directory. Preserve existing projects, credentials, MCP entries and daily Skills. `--home` alone does not isolate host configuration. Ask for a missing host/profile when it cannot be established reliably.+3. Use the **local tgz** with the selected host, with the isolation settings applied first:++ ```sh+ npx --yes --package "./{{TGZ}}" -- openmotion setup --host HOST+ npx --yes --package "./{{TGZ}}" -- openmotion prepare+ ```++ Replace `HOST` with `codex`, `claude`, `deepseek` or `workbuddy`. Carry the explicit `--home`, `--data-dir`, `--skills-dir` and host-specific options from the platform recipe; repeat the same home for prepare. Wait for setup and prepare to finish before native use. Keep using this local package; no sidecar application/manifest download or source build is required.+4. Follow this host's discovery/reload action. Verify the actual application version, prod template environment, eleven MCP Tools, resources and five Skills, including a `motion_get_project` call against the isolated data directory. Registration or installation success alone is not host loading or creative acceptance.+5. Follow the tester's requested acceptance cases in `acceptance.md`: use an independent test project for template creation, editing, save/reopen and MP4 export. Do not modify an existing user project or start a paid provider call without its separate authorization. Retain technical export checks separately from real Agent creation and human audio/video playback.+6. Fill a **private copy** of `acceptance.md` with actual PASS / FAIL / NOT RUN results and evidence. Report failures and retain the generated candidate identity. Do not edit/re-upload the frozen candidate artifact. Do not publish npm, upload a guide or change a tag as part of installation/testing.++The sibling `install.md` is frozen for **after npm publication** and points at the exact registry version. Before publication, use this `candidate-install.md` and local tgz. Successful installation does not authorize release.diff --git a/docs/templates/release-record.md b/docs/templates/release-record.mdindex d816d927..2f187e6c 100644--- a/docs/templates/release-record.md+++ b/docs/templates/release-record.md@@ -13,7 +13,7 @@ The release builder replaces this marker. Do not change its generated identity;- Integration PR / source review / artifact expiry:- Template environment / Resource / locale / catalog publication version:- Supported OS / CPU / Node / npm / host versions:-- Acceptance owner / independent reviewer / release operator:+- Acceptance owner / reviewer (if used) / release operator:- Prior accepted compatible version or backup (or none):## Acceptance matrix@@ -39,7 +39,7 @@ Use PASS / FAIL / NOT RUN and link retained evidence. CI success alone cannot fi- Approved exact version and TGZ SHA256:- Reviewer / date / explicit release authorization:- Internal retained record revision / filename (keep this private):-- Independent reviewer confirms this exact candidate in Review deployments with the comment `PASS`, or rejects it. Never approve a failed or incomplete required check.+- The release operator enters this exact version in Motion test publication and confirms acceptance before dispatch. No independent approval environment is enabled. Never confirm a failed or incomplete required check.## Publication follow-up@@ -49,4 +49,4 @@ Use PASS / FAIL / NOT RUN and link retained evidence. CI success alone cannot fi- Default entry / previous entry / final publication phase:- Failure, recovery or user feedback:-Retain the completed acceptance revision; append publication follow-up separately against the same candidate identity. The public release record contains the run-scoped GitHub review receipt, not the private evidence or its digest. That receipt proves an approval was observed, not that every test was performed. Formal publication additionally requires the stable-package checks in the acceptance guide.+Retain the completed acceptance revision; append publication follow-up separately against the same candidate identity. The public release record contains the manual operator authorization, not the private evidence or its digest. That receipt records explicit operator confirmation, not independent review or proof that every test was performed. Formal publication additionally requires the stable-package checks in the acceptance guide.diff --git a/tests/install-guide.test.ts b/tests/install-guide.test.tsindex 52905052..31c41348 100644--- a/tests/install-guide.test.ts+++ b/tests/install-guide.test.ts@@ -148,12 +148,12 @@ test('unrecognized or conflicting same-version defaults require inspection inste}});-test('PR CI has no publication credentials; publication requires the separate manual protected workflow', async () => {+test('PR CI has no publication credentials; publication requires a separate manual accepted workflow', async () => {const ci = await readFile(new URL('../.github/workflows/ci.yml', import.meta.url), 'utf8');const workflow = await readFile(new URL('../.github/workflows/motion-publish-test.yml', import.meta.url), 'utf8');assert(!ci.includes('secrets.') && !ci.includes('publish-install-guide:'));assert(workflow.includes('workflow_dispatch:') && !workflow.includes('pull_request:') && !workflow.includes('push:'));- assert.equal([...workflow.matchAll(/^ environment:/gm)].length, 1, 'Only the npm job requests independent approval');- assert(workflow.includes('name: motion-test-publish'));+ assert(!workflow.includes('environment:'), 'No independent approval environment is enabled');+ assert(workflow.includes('accepted:') && workflow.includes('default: false'));assert(!workflow.split(' snapshot:\n')[0].includes('secrets.'));});diff --git a/tests/release-fixture.mjs b/tests/release-fixture.mjsindex 468bb2b8..b4988e20 100644--- a/tests/release-fixture.mjs+++ b/tests/release-fixture.mjs@@ -3,7 +3,7 @@ import os from 'node:os';import path from 'node:path';import { fileURLToPath } from 'node:url';import { runFile, sha256, writeJSON } from '../scripts/runtime-assets.mjs';-import { sealCandidate, repository, candidateWorkflow, approvalReceipt, publicationEnvironment } from '../.github/scripts/motion-release.mjs';+import { sealCandidate, repository, candidateWorkflow, publicationWorkflow, authorizationReceipt } from '../.github/scripts/motion-release.mjs';export async function candidateFixture(t) {const work = await mkdtemp(path.join(os.tmpdir(), 'motion-release-test-'));@@ -31,15 +31,16 @@ export async function candidateFixture(t) {const candidate = await sealCandidate(build, directory, root, env);const provenance = { head_sha: env.GITHUB_SHA, runId: 123, attempt: 1 };await writeJSON(path.join(directory, 'provenance.json'), provenance);- const inputs = { action: 'publish-test', expectedSHA256: candidate.tgzSHA256, candidateRun: '123' };- const publicationEnv = { GITHUB_RUN_ID: '800', GITHUB_SHA: env.GITHUB_SHA, GITHUB_WORKFLOW_REF: env.GITHUB_WORKFLOW_REF };- const reviews = [{ state: 'approved', comment: 'PASS', environments: [{ name: publicationEnvironment }], user: { login: 'reviewer' } }];- const approval = approvalReceipt(candidate, reviews, { id: 800, actor: { login: 'operator' } }, inputs.action);- await writeJSON(path.join(directory, 'approval.json'), approval);+ const inputs = { action: 'publish-test', version, accepted: true, expectedSHA256: candidate.tgzSHA256 };+ const publicationEnv = { GITHUB_REPOSITORY: repository, GITHUB_EVENT_NAME: 'workflow_dispatch', GITHUB_REF: 'refs/heads/main',+ GITHUB_RUN_ID: '800', GITHUB_SHA: env.GITHUB_SHA, GITHUB_WORKFLOW_REF: `${repository}/${publicationWorkflow}@refs/heads/main`,+ MOTION_VERSION: version, MOTION_ACCEPTED: 'true', MOTION_RELEASE_ACTION: 'publish-test' };+ const authorization = authorizationReceipt(candidate, { id: 800, run_attempt: 1, actor: { login: 'operator' } }, inputs.action);+ await writeJSON(path.join(directory, 'authorization.json'), authorization);for (const platform of ['darwin-arm64', 'win32-x64']) await writeJSON(path.join(directory, `registry-${platform}.json`), {status: 'passed', platform, version, sourceCommit: commit, tgzSHA256: candidate.tgzSHA256,registryColdInstall: 'passed', nativePreparation: 'passed', repeatSetup: 'passed', resources: 'passed', mcpTools: 11, skills: 5,});await writeJSON(path.join(directory, 'npm-publication.json'), { tgzSHA256: candidate.tgzSHA256, previousLatest: '0.5.0' });- return { work, root, build, directory, candidate, inputs, provenance, app, pkg, manifest, approval, env: publicationEnv };+ return { work, root, build, directory, candidate, inputs, provenance, app, pkg, manifest, authorization, env: publicationEnv };}diff --git a/tests/release-workflows.test.mjs b/tests/release-workflows.test.mjsindex 433ec73c..01c18606 100644--- a/tests/release-workflows.test.mjs+++ b/tests/release-workflows.test.mjs@@ -4,25 +4,19 @@ import { readFile, writeFile } from 'node:fs/promises';import path from 'node:path';import { createHash } from 'node:crypto';import { candidateFixture } from './release-fixture.mjs';-import { releaseInputs, resolveSource, validateSource, validateRun, verifyDownloaded, downloadCandidate, publishNpm, archiveRelease, repository, candidateWorkflow, recoveryWorkflow, publicationEnvironment, candidateJobName, validatePublicationEnvironment, approvalReceipt, recordApproval } from '../.github/scripts/motion-release.mjs';+import { releaseInputs, resolveSource, validateSource, validateRun, verifyDownloaded, downloadCandidate, publishNpm, archiveRelease, repository, candidateWorkflow, recoveryWorkflow, publicationWorkflow, candidateJobName, findCandidate, authorizationReceipt, recordAuthorization } from '../.github/scripts/motion-release.mjs';import { compareReleaseVersions } from '../scripts/release-version.mjs';import { consumerEnvironment } from '../.github/scripts/motion-registry-smoke.mjs';import { runFile } from '../scripts/runtime-assets.mjs';const config = { endpoint: 'https://example.r2.cloudflarestorage.com', bucket: 'example-releases', publicOrigin: 'https://download.example.invalid' };const valid = { GITHUB_REPOSITORY: repository, GITHUB_EVENT_NAME: 'workflow_dispatch', GITHUB_REF: 'refs/heads/main',- GITHUB_WORKFLOW_REF: `${repository}/${candidateWorkflow}@refs/heads/main`, MOTION_RELEASE_ACTION: 'publish-test', MOTION_EXPECTED_SHA256: 'a'.repeat(64), MOTION_CANDIDATE_RUN: '123' };+ GITHUB_WORKFLOW_REF: `${repository}/${publicationWorkflow}@refs/heads/main`, MOTION_VERSION: '0.6.4-test.99', MOTION_ACCEPTED: 'true', MOTION_RELEASE_ACTION: 'publish-test', MOTION_EXPECTED_SHA256: 'a'.repeat(64) };const origin = { id: 123, run_attempt: 1, event: 'workflow_dispatch', head_branch: 'main', head_repository: { full_name: repository }, status: 'completed', conclusion: 'success', path: candidateWorkflow, head_sha: 'b'.repeat(40) };-const artifact = { id: 456, name: 'motion-candidate-123-1', workflow_run: { id: 123 }, expired: false, size_in_bytes: 100, digest: 'sha256:' + 'a'.repeat(64) };-const producer = { name: candidateJobName, status: 'completed', conclusion: 'success', run_id: 123, head_sha: origin.head_sha };-const protectedEnvironment = { name: publicationEnvironment, can_admins_bypass: false,- protection_rules: [{ type: 'required_reviewers', prevent_self_review: true, reviewers: [{ type: 'User', reviewer: { login: 'reviewer' } }] }],- deployment_branch_policy: { custom_branch_policies: true, protected_branches: false } };-const branchPolicies = { branch_policies: [{ name: 'main', type: 'branch' }] };-+const artifact = { id: 456, name: 'motion-candidate-0.6.4-test.99', workflow_run: { id: 123 }, expired: false, size_in_bytes: 100, digest: 'sha256:' + 'a'.repeat(64) };test('manual entry and source selection reject untrusted callers, mutable refs and non-test versions', async () => {assert.equal(releaseInputs(valid).action, 'publish-test');- for (const [key, value] of Object.entries({ GITHUB_REPOSITORY: 'fork/repo', GITHUB_EVENT_NAME: 'push', GITHUB_REF: 'refs/heads/feature/motion', GITHUB_WORKFLOW_REF: `${repository}/evil.yml@refs/heads/main`, MOTION_EXPECTED_SHA256: 'bad', MOTION_CANDIDATE_RUN: '../123', MOTION_RELEASE_ACTION: 'stable' })) assert.throws(() => releaseInputs({ ...valid, [key]: value }));+ for (const [key, value] of Object.entries({ GITHUB_REPOSITORY: 'fork/repo', GITHUB_EVENT_NAME: 'push', GITHUB_REF: 'refs/heads/feature/motion', GITHUB_WORKFLOW_REF: `${repository}/evil.yml@refs/heads/main`, MOTION_EXPECTED_SHA256: 'bad', MOTION_ACCEPTED: 'false', MOTION_VERSION: '0.6.4', MOTION_RELEASE_ACTION: 'stable' })) assert.throws(() => releaseInputs({ ...valid, [key]: value }));const recovery = { ...valid, GITHUB_WORKFLOW_REF: `${repository}/${recoveryWorkflow}@refs/heads/main` };assert.throws(() => releaseInputs(recovery), /Recovery/);assert.equal(releaseInputs({ ...recovery, MOTION_RELEASE_ACTION: 'archive-only' }).action, 'archive-only');@@ -34,39 +28,40 @@ test('manual entry and source selection reject untrusted callers, mutable refs aassert.equal(resolved, 'a'.repeat(40));});-test('an in-progress release requires its successful exact candidate producer, including partial retries', () => {- validateRun(origin, artifact, producer, 1);- validateRun({ ...origin, status: 'in_progress', conclusion: null }, artifact, producer, 1);- validateRun({ ...origin, run_attempt: 2, conclusion: 'failure' }, artifact, producer, 1);- for (const patch of [{ event: 'pull_request' }, { head_branch: 'feature/motion' }, { path: '.github/workflows/other.yml' }, { head_repository: { full_name: 'fork/repo' } }]) assert.throws(() => validateRun({ ...origin, ...patch }, artifact, producer, 1));- for (const patch of [{ expired: true }, { name: 'motion-candidate-123-2' }, { digest: null }, { workflow_run: { id: 999 } }]) assert.throws(() => validateRun(origin, { ...artifact, ...patch }, producer, 1));- for (const patch of [{ status: 'in_progress' }, { conclusion: 'failure' }, { name: 'another job' }, { head_sha: 'f'.repeat(40) }, { run_id: 999 }]) assert.throws(() => validateRun(origin, artifact, { ...producer, ...patch }, 1));- assert.throws(() => validateRun(origin, artifact, producer, 2));-});--test('missing, bypassable or wrongly scoped environment protections block publication', () => {- validatePublicationEnvironment(protectedEnvironment, branchPolicies);- for (const patch of [{ protection_rules: [] }, { can_admins_bypass: true }, { deployment_branch_policy: null }, { protection_rules: [{ ...protectedEnvironment.protection_rules[0], prevent_self_review: false }] }]) assert.throws(() => validatePublicationEnvironment({ ...protectedEnvironment, ...patch }, branchPolicies));- assert.throws(() => validatePublicationEnvironment(protectedEnvironment, { branch_policies: [{ name: '*', type: 'branch' }] }));+test('only a completed successful registered candidate build can supply a version', () => {+ validateRun(origin, artifact, '0.6.4-test.99');+ for (const patch of [{ event: 'pull_request' }, { head_branch: 'feature/motion' }, { path: '.github/workflows/other.yml' }, { head_repository: { full_name: 'fork/repo' } }, { status: 'in_progress' }, { conclusion: 'failure' }]) assert.throws(() => validateRun({ ...origin, ...patch }, artifact, '0.6.4-test.99'));+ for (const patch of [{ expired: true }, { name: 'motion-candidate-0.6.4-test.100' }, { digest: null }, { workflow_run: { id: 999 } }]) assert.throws(() => validateRun(origin, { ...artifact, ...patch }, '0.6.4-test.99'));});-test('approval records identify actual independent reviewers without publishing private comments', async t => {- const f = await candidateFixture(t), approved = { state: 'approved', comment: 'PASS', environments: [{ name: publicationEnvironment }], user: { login: 'reviewer' } };- const run = { ...origin, id: 800, actor: { login: 'operator' }, triggering_actor: { login: 'rerunner' } };- assert.equal(approvalReceipt(f.candidate, [approved], run, 'publish-test').reviewers[0], 'reviewer');- for (const patch of [{ state: 'rejected' }, { comment: '' }, { comment: 'internal private material' }, { environments: [{ name: 'other' }] }, { user: { login: 'operator' } }, { user: { login: 'rerunner' } }]) assert.throws(() => approvalReceipt(f.candidate, [{ ...approved, ...patch }], run, 'publish-test'));+test('version lookup uses the exact artifact name and rejects missing, expired, ambiguous or incomplete results', async () => {const fetcher = async url => {- const value = String(url);- if (value.endsWith('/environments/' + publicationEnvironment)) return Response.json(protectedEnvironment);- if (value.includes('deployment-branch-policies')) return Response.json(branchPolicies);- if (value.endsWith('/approvals')) return Response.json([approved]);- return Response.json(run);+ const parsed = new URL(url);+ assert.equal(parsed.pathname, '/repos/' + repository + '/actions/artifacts');+ assert.equal(parsed.searchParams.get('name'), artifact.name);+ return Response.json({ total_count: 1, artifacts: [artifact] });};- await recordApproval(f.directory, f.inputs, fetcher, f.env);- const record = JSON.parse(await readFile(path.join(f.directory, 'approval.json')));+ assert.equal((await findCandidate('0.6.4-test.99', fetcher)).id, artifact.id);+ for (const artifacts of [[], [{ ...artifact, expired: true }], [artifact, { ...artifact, id: 457 }], [{ ...artifact, workflow_run: {} }]]) {+ await assert.rejects(findCandidate('0.6.4-test.99', async () => Response.json({ total_count: artifacts.length, artifacts })));+ }+ await assert.rejects(findCandidate('0.6.4-test.99', async () => Response.json({ total_count: 101, artifacts: [artifact] })), /incomplete/);+});++test('operator authorization requires explicit acceptance and records the actual manual caller without independent approval', async t => {+ const f = await candidateFixture(t);+ const run = { ...origin, id: 800, path: publicationWorkflow, actor: { login: 'operator' }, triggering_actor: { login: 'rerunner' } };+ assert.equal(authorizationReceipt(f.candidate, run, 'publish-test').actor, 'rerunner');+ assert.throws(() => authorizationReceipt(f.candidate, { ...run, actor: {}, triggering_actor: {} }, 'publish-test'));+ const fetcher = async url => { assert(String(url).endsWith('/actions/runs/800')); return Response.json(run); };+ await recordAuthorization(f.directory, f.inputs, fetcher, f.env);+ const record = JSON.parse(await readFile(path.join(f.directory, 'authorization.json')));assert.equal(record.publicationRun, 800); assert.equal(record.tgzSHA256, f.candidate.tgzSHA256);- assert(!JSON.stringify(record).includes('comment'));- await assert.rejects(recordApproval(f.directory, f.inputs, async url => String(url).endsWith('/approvals') ? Response.json([]) : fetcher(url), f.env), /independent/);+ assert.equal(record.actor, 'rerunner'); assert.equal(record.acceptanceConfirmed, true);+ await assert.rejects(recordAuthorization(f.directory, f.inputs, fetcher, { ...f.env, MOTION_ACCEPTED: 'false' }), /acceptance/);+ for (const patch of [{ id: 801 }, { event: 'push' }, { head_branch: 'feature/motion' }, { head_sha: 'f'.repeat(40) }, { path: candidateWorkflow }, { head_repository: { full_name: 'fork/repo' } }]) {+ await assert.rejects(recordAuthorization(f.directory, f.inputs, async () => Response.json({ ...run, ...patch }), f.env));+ }});test('the sealed candidate detects tgz, guide, identity and provenance tampering', async t => {@@ -74,7 +69,12 @@ test('the sealed candidate detects tgz, guide, identity and provenance tamperingassert.equal((await verifyDownloaded(directory, candidate.tgzSHA256)).version, candidate.version);const checklist = await readFile(path.join(directory, 'acceptance.md'), 'utf8');assert(checklist.includes(candidate.tgzSHA256) && checklist.includes(candidate.sourceCommit));+ const instructions = await readFile(path.join(directory, 'candidate-install.md'), 'utf8');+ assert(instructions.includes(candidate.tgz) && instructions.includes(candidate.tgzSHA256) && instructions.includes(candidate.sourceCommit));+ assert(instructions.includes('npx --yes --package "./' + candidate.tgz + '"'));+ assert(!instructions.includes('{{'));assert(!checklist.includes('<!-- CANDIDATE_IDENTITY -->'));+ await assert.rejects(verifyDownloaded(directory, candidate.tgzSHA256, '0.6.4-test.100'), /version/);assert(checklist.includes('NOT RUN'), 'Generated identity must not fabricate human acceptance');await assert.rejects(verifyDownloaded(directory, '0'.repeat(64)));const file = path.join(directory, 'install.md'), original = await readFile(file);@@ -90,16 +90,16 @@ test('artifact download verifies GitHub ZIP digest and does not forward the credconst fetcher = async (url, options) => {const value = String(url);if (value.endsWith('/actions/runs/123')) return Response.json(origin);- if (value.includes('/artifacts?')) return Response.json({ artifacts: [{ ...artifact, digest, size_in_bytes: bytes.length }] });- if (value.includes('/attempts/1/jobs')) return Response.json({ jobs: [producer] });+ if (value.includes('/artifacts?')) return Response.json({ total_count: 1, artifacts: [{ ...artifact, digest, size_in_bytes: bytes.length }] });if (value.endsWith('/456/zip')) return new Response(null, { status: 302, headers: { location: 'https://signed.example.invalid/candidate' } });assert.equal(value, 'https://signed.example.invalid/candidate'); assert.equal(options.headers, undefined);return new Response(bytes);};- assert.equal((await downloadCandidate('123', path.join(f.work, 'download'), f.candidate.tgzSHA256, fetcher)).tgzSHA256, f.candidate.tgzSHA256);+ assert.equal((await downloadCandidate(f.candidate.version, path.join(f.work, 'download'), f.candidate.tgzSHA256, fetcher)).tgzSHA256, f.candidate.tgzSHA256);const retryFetcher = (url, options) => String(url).endsWith('/actions/runs/123') ? Response.json({ ...origin, run_attempt: 2, conclusion: 'failure' }) : fetcher(url, options);- assert.equal((await downloadCandidate('123', path.join(f.work, 'retry'), undefined, retryFetcher, '456')).tgzSHA256, f.candidate.tgzSHA256, 'A partial retry derives the hash from its exact retained producer artifact');- await assert.rejects(downloadCandidate('123', path.join(f.work, 'corrupt'), f.candidate.tgzSHA256, async (url, options) => String(url).includes('signed.') ? new Response('tampered ZIP') : fetcher(url, options)));+ await assert.rejects(downloadCandidate(f.candidate.version, path.join(f.work, 'retry'), undefined, retryFetcher), /success/);+ assert.equal((await downloadCandidate(f.candidate.version, path.join(f.work, 'automatic'), undefined, fetcher)).tgzSHA256, f.candidate.tgzSHA256);+ await assert.rejects(downloadCandidate(f.candidate.version, path.join(f.work, 'corrupt'), f.candidate.tgzSHA256, async (url, options) => String(url).includes('signed.') ? new Response('tampered ZIP') : fetcher(url, options)));});function registry(candidate, exists = true, tag = candidate.version, latest = '0.5.0') {@@ -113,17 +113,17 @@ test('npm publishes only new exact bytes; identical retry and archive-only neverawait publishNpm(f.directory, f.inputs, { run, fetcher: registry(f.candidate, false), env: f.env }); assert.equal(calls, 1);await publishNpm(f.directory, f.inputs, { run, fetcher: registry(f.candidate), env: f.env });await assert.rejects(publishNpm(f.directory, f.inputs, { run, fetcher: registry({ ...f.candidate, integrity: 'different' }), env: f.env }), /different bytes/); assert.equal(calls, 1);- await writeFile(path.join(f.directory, 'approval.json'), JSON.stringify({ ...f.approval, action: 'archive-only' }));+ await writeFile(path.join(f.directory, 'authorization.json'), JSON.stringify({ ...f.authorization, action: 'archive-only' }));await publishNpm(f.directory, { ...f.inputs, action: 'archive-only' }, { run, fetcher: registry(f.candidate), env: f.env }); assert.equal(calls, 1);await assert.rejects(publishNpm(f.directory, { ...f.inputs, action: 'archive-only' }, { run, fetcher: registry(f.candidate, false), env: f.env }), /existing identical/);});-test('a stale candidate or approval from another run cannot publish or move npm test backward', async t => {+test('a stale candidate or authorization from another run cannot publish or move npm test backward', async t => {const f = await candidateFixture(t); let calls = 0;const run = async () => { calls++; };await assert.rejects(publishNpm(f.directory, f.inputs, { run, env: f.env, fetcher: registry(f.candidate, false, '0.6.4-test.100') }), /newer npm test/);await assert.rejects(publishNpm(f.directory, f.inputs, { run, env: { GITHUB_RUN_ID: '801' }, fetcher: registry(f.candidate, false) }), /another publication run/);- await writeFile(path.join(f.directory, 'approval.json'), JSON.stringify({ ...f.approval, tgzSHA256: '0'.repeat(64) }));+ await writeFile(path.join(f.directory, 'authorization.json'), JSON.stringify({ ...f.authorization, tgzSHA256: '0'.repeat(64) }));await assert.rejects(publishNpm(f.directory, f.inputs, { run, env: f.env, fetcher: registry(f.candidate, false) }));assert.equal(calls, 0);});@@ -147,7 +147,7 @@ test('partial publication retries use the retained producer artifact IDs acrossassert(jobs[id].includes(' id: artifact\n'));}for (const id of ['npm', 'registry-mac', 'registry-windows', 'snapshot']) {- assert(jobs[id].includes('if: ${{ always() && !cancelled() && needs.verify.result'), 'A skipped recovery build must not silently skip downstream jobs: ' + id);+ assert(jobs[id].includes('if: ${{ always() && !cancelled() && needs.verify.result'), 'Successful retained producers must still supply partial retry consumers: ' + id);}const downloads = id => [...jobs[id].matchAll(/artifact-ids: \$\{\{ needs\.([\w-]+)\.outputs\.artifact_id \}\}/g)].map(m => m[1]);assert.deepEqual(downloads('npm'), ['verify']);@@ -176,21 +176,23 @@ test('partial publication retries use the retained producer artifact IDs across}});-test('the daily entry builds before one approval; recovery can only reuse an existing candidate', async () => {+test('daily build and publication are separate manual entries without an independent environment gate', async () => {+ const build = await readFile(new URL('../.github/workflows/motion-candidate.yml', import.meta.url), 'utf8');const workflow = await readFile(new URL('../.github/workflows/motion-publish-test.yml', import.meta.url), 'utf8');const recovery = await readFile(new URL('../.github/workflows/motion-publication-recovery.yml', import.meta.url), 'utf8');const header = workflow.split('\njobs:\n')[0];- assert(header.includes('version:') && header.includes('source_sha:'));- for (const manualField of ['tgz_sha256:', 'acceptance_sha256:', 'approved:', 'action:']) assert(!header.includes(manualField));- assert(!header.includes('concurrency:'), 'Acceptance waits cannot hold a repository-wide build lock');- assert(workflow.includes('name: ' + candidateJobName));- assert(workflow.includes('ref: ${{ steps.source.outputs.source_sha }}'), 'Checkout the already frozen commit');- assert.equal([...workflow.matchAll(/^ environment:/gm)].length, 1);- assert(workflow.includes('motion-release.mjs environment') && workflow.includes('motion-release.mjs approval'));+ assert(build.includes('workflow_dispatch:') && build.includes('version:') && build.includes('source_sha:'));+ assert(build.includes('name: ' + candidateJobName) && build.includes('ref: ${{ steps.source.outputs.source_sha }}'));+ assert(build.includes('name: motion-candidate-${{ inputs.version }}') && build.includes('candidate-install.md'));+ assert(!build.includes('concurrency:') && !build.includes('secrets.') && !build.includes('id-token:'));+ assert(header.includes('version:') && header.includes('accepted:') && header.includes('default: false'));+ for (const manualField of ['candidate_run_id:', 'source_sha:', 'tgz_sha256:', 'acceptance_sha256:', 'approved:', 'action:']) assert(!header.includes(manualField));+ assert(!workflow.includes(' candidate:') && !workflow.includes('environment:'));+ assert(header.includes('group: motion-test-publication') && header.includes('cancel-in-progress: false'));+ assert(workflow.includes('motion-release.mjs authorize') && workflow.includes('authorization.json'));assert(workflow.includes('MOTION_EXPECTED_SHA256: ${{ needs.verify.outputs.tgz_sha256 }}'));- assert(!recovery.includes('publish-test\n') && !recovery.includes('version:') && !recovery.includes('source_sha:'));- assert(recovery.includes('uses: ./.github/workflows/motion-publish-test.yml'));- assert(workflow.includes("inputs.candidate_run_id != '' && 'archive-only' || 'publish-test'"));+ assert(recovery.includes('version:') && recovery.includes('accepted:') && recovery.includes('archive_only: true'));+ assert(recovery.includes('uses: ./.github/workflows/motion-publish-test.yml') && !recovery.includes('source_sha:'));});function storage(candidate) {@@ -223,7 +225,7 @@ test('interrupted archive resumes identical snapshots, verifies the exact publictest('archive-only never reads or writes the moving entry, and failed platform acceptance blocks all storage calls', async t => {const f = await candidateFixture(t), store = storage(f.candidate);- await writeFile(path.join(f.directory, 'approval.json'), JSON.stringify({ ...f.approval, action: 'archive-only' }));+ await writeFile(path.join(f.directory, 'authorization.json'), JSON.stringify({ ...f.authorization, action: 'archive-only' }));await archiveRelease(f.directory, { ...f.inputs, action: 'archive-only' }, config, store);assert(!store.reads.includes('open-motion/dev/install.md') && !store.writes.includes('open-motion/dev/install.md'));await writeFile(path.join(f.directory, 'registry-win32-x64.json'), JSON.stringify({ status: 'failed' }));@@ -258,30 +260,25 @@ test('an unexpected npm latest change stops promotion and consumer processes canassert.equal(env.npm_config_registry, 'https://registry.npmjs.org/');});-test('no-publication rehearsal carries one candidate through approval, npm and storage using simulated services only', async t => {+test('no-publication rehearsal carries one accepted candidate through npm and storage using simulated services only', async t => {const f = await candidateFixture(t), store = storage(f.candidate);- const run = { ...origin, id: 800, actor: { login: 'operator' } };- const reviews = [{ state: 'approved', comment: 'PASS', environments: [{ name: publicationEnvironment }], user: { login: 'reviewer' } }];- const github = async url => {- if (String(url).endsWith('/environments/' + publicationEnvironment)) return Response.json(protectedEnvironment);- if (String(url).includes('deployment-branch-policies')) return Response.json(branchPolicies);- if (String(url).endsWith('/approvals')) return Response.json(reviews);- return Response.json(run);- };- await writeFile(path.join(f.directory, 'approval.json'), '{}');+ const run = { ...origin, id: 800, path: publicationWorkflow, actor: { login: 'operator' } };+ const github = async url => { assert(String(url).endsWith('/actions/runs/800')); return Response.json(run); };+ await writeFile(path.join(f.directory, 'authorization.json'), '{}');let npmWrites = 0, published = false;const npm = { env: f.env, fetcher: () => registry(f.candidate, published)(), run: async (command, args) => {assert.equal(command, 'npm'); assert.equal(args[1], path.join(f.directory, f.candidate.tgz));npmWrites++; published = true;} };await assert.rejects(publishNpm(f.directory, f.inputs, npm));- assert.equal(npmWrites, 0, 'No approval means no registry write');- await recordApproval(f.directory, f.inputs, github, f.env);+ assert.equal(npmWrites, 0, 'No authorization means no registry write');+ await recordAuthorization(f.directory, f.inputs, github, f.env);await publishNpm(f.directory, f.inputs, npm);await archiveRelease(f.directory, f.inputs, config, store);assert.equal(npmWrites, 1);const release = JSON.parse(store.objects.get(`open-motion/dev/${f.candidate.version}/release-record.json`));- assert.equal(release.schemaVersion, 2); assert.deepEqual(release.approval.reviewers, ['reviewer']);+ assert.equal(release.schemaVersion, 2); assert.equal(release.authorization.actor, 'operator');+ assert.equal(release.authorization.acceptanceConfirmed, true);assert.equal(release.tgzSHA256, f.candidate.tgzSHA256);assert.equal(store.writes.at(-1), 'open-motion/dev/install.md');await publishNpm(f.directory, f.inputs, npm);