Skip to content

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.

feat(release): prepare stable npm candidates and publication

罗高7f1f09963e87
diff --git a/.github/scripts/motion-registry-smoke.mjs b/.github/scripts/motion-registry-smoke.mjs
index 90b79a2c..423491b7 100644
--- a/.github/scripts/motion-registry-smoke.mjs
+++ b/.github/scripts/motion-registry-smoke.mjs
@@ -7,6 +7,7 @@ import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { runFile, writeJSON } from '../../scripts/runtime-assets.mjs';
import { verifyRegistryDownload } from './motion-registry.mjs';
+import { releaseTemplateEnvironment } from '../../scripts/release-version.mjs';
import { verifyDownloaded } from './motion-release.mjs';
export function consumerEnvironment(work, source = process.env) {
@@ -75,7 +76,7 @@ export async function registrySmoke(directory) {
assert.equal(first.appRoot, second.appRoot); assert.equal((await readdir(path.join(home, 'apps'))).length, 1);
assert.match(await readFile(path.join(env.CODEX_HOME, 'config.toml'), 'utf8'), /keep-this-server/);
const manifest = JSON.parse(await readFile(path.join(directory, 'release-npm.json')));
- assert.equal(manifest.templateEnvironment, 'dev');
+ assert.equal(manifest.templateEnvironment, releaseTemplateEnvironment(c.version));
const state = JSON.parse(await readFile(path.join(home, 'install.json')));
assert.equal(state.templateEnvironment, manifest.templateEnvironment);
const templateConfig = JSON.parse(await readFile(path.join(first.appRoot, 'shared/template-config.json')));
diff --git a/.github/scripts/motion-registry.mjs b/.github/scripts/motion-registry.mjs
index 89ce5258..0afc49a4 100644
--- a/.github/scripts/motion-registry.mjs
+++ b/.github/scripts/motion-registry.mjs
@@ -37,7 +37,7 @@ export async function verifyRegistryDownload(directory, { destination, ...option
await rm(path.join(directory, 'registry-package.json'), { force: true });
const c = JSON.parse(await readFile(path.join(directory, 'candidate.json')));
assert.equal(c.packageName, '@openmotion/app');
- checkReleaseVersion(c.version); assert(c.version.includes('-test.'));
+ checkReleaseVersion(c.version);
assert.equal(c.tgz, `openmotion-app-${c.version}.tgz`);
assert.match(c.tgzSHA256, /^[a-f0-9]{64}$/);
const temporary = destination || await mkdtemp(path.join(os.tmpdir(), 'om-download-'));
diff --git a/.github/scripts/motion-release.mjs b/.github/scripts/motion-release.mjs
index d7b1f7fa..87fa63f0 100644
--- a/.github/scripts/motion-release.mjs
+++ b/.github/scripts/motion-release.mjs
@@ -7,7 +7,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 { checkReleaseVersion, compareReleaseVersions, testVersion } from '../../scripts/release-version.mjs';
+import { checkReleaseVersion, compareReleaseVersions, releaseTemplateEnvironment, testVersion } from '../../scripts/release-version.mjs';
import { generateInstallGuide } from '../../scripts/install-guide.mjs';
import { publishGuide, storagePlan } from './publish-install-guide.mjs';
import { scanPackage, scanSource } from './motion-scan.mjs';
@@ -29,18 +29,33 @@ function manualEntry(env, workflows) {
assert(workflows.some(p => env.GITHUB_WORKFLOW_REF === `${repository}/${p}@refs/heads/feature/motion`), 'Require a trusted manual entry');
}
+export function releaseChannel(version) {
+ checkReleaseVersion(version);
+ return version.includes('-test.') ? 'test' : 'stable';
+}
+
+function channelVersion(version, channel) {
+ assert(['test', 'stable'].includes(channel), 'Choose test or stable');
+ assert.equal(releaseChannel(version), channel, 'Version must match the selected release channel');
+}
+
export function releaseInputs(env = process.env) {
manualEntry(env, [publicationWorkflow, recoveryWorkflow]);
- assert(['publish-test', 'archive-only'].includes(env.MOTION_RELEASE_ACTION), 'Unknown release action');
+ assert(['publish-test', 'publish-stable', 'archive-only'].includes(env.MOTION_RELEASE_ACTION), 'Unknown release action');
const workflow = env.GITHUB_WORKFLOW_REF;
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);
- checkReleaseVersion(env.MOTION_VERSION); assert(env.MOTION_VERSION.includes('-test.'), 'Only test versions may use this entry');
- return { action: env.MOTION_RELEASE_ACTION, version: env.MOTION_VERSION, expectedSHA256: env.MOTION_EXPECTED_SHA256 };
+ const channel = env.MOTION_RELEASE_CHANNEL || 'test';
+ channelVersion(env.MOTION_VERSION, channel);
+ if (env.MOTION_RELEASE_ACTION !== 'archive-only') assert.equal(env.MOTION_RELEASE_ACTION, 'publish-' + channel);
+ return { action: env.MOTION_RELEASE_ACTION, channel, version: env.MOTION_VERSION, expectedSHA256: env.MOTION_EXPECTED_SHA256 };
}
export async function resolveCandidate(control, requested, version, env = process.env, run = runFile) {
manualEntry(env, [candidateWorkflow]);
+ const channel = env.MOTION_RELEASE_CHANNEL || 'test';
+ assert(['test', 'stable'].includes(channel), 'Choose test or stable');
+ assert(channel !== 'stable' || version, 'Enter an exact stable version; stable versions are never automatically assigned');
const commit = requested || env.GITHUB_SHA;
assert.match(commit, /^[a-f0-9]{40}$/, 'Use a full immutable source SHA');
if (!version) {
@@ -50,13 +65,13 @@ export async function resolveCandidate(control, requested, version, env = proces
version = testVersion(source.version, String(BigInt(env.GITHUB_RUN_NUMBER) + 5n), env.GITHUB_RUN_ATTEMPT);
if (env.GITHUB_RUN_ATTEMPT === '1') version = version.slice(0, -2);
}
- await validateSource(control, commit, version, run);
+ await validateSource(control, commit, version, run, channel);
return { commit, version };
}
-export async function validateSource(control, commit, version, run = runFile) {
+export async function validateSource(control, commit, version, run = runFile, channel = releaseChannel(version)) {
assert.match(commit || '', /^[a-f0-9]{40}$/, 'Use a full immutable source SHA');
- checkReleaseVersion(version); assert(version.includes('-test.'), 'This workflow builds test versions only');
+ channelVersion(version, channel);
await run('git', ['merge-base', '--is-ancestor', commit, 'refs/remotes/origin/feature/motion'], { cwd: control });
}
@@ -64,7 +79,8 @@ export async function sealCandidate(build, output, source, env = process.env) {
const manifest = await json(path.join(build, 'release-npm.json'));
assert.equal(manifest.commit, (await runFile('git', ['rev-parse', 'HEAD'], { cwd: source })).trim());
assert.equal(manifest.commit, env.MOTION_SOURCE_SHA); assert.equal(manifest.version, env.MOTION_VERSION);
- assert(manifest.version.includes('-test.') && manifest.templateEnvironment === 'dev', 'Test candidates require DEV template defaults');
+ channelVersion(manifest.version, env.MOTION_RELEASE_CHANNEL || 'test');
+ assert.equal(manifest.templateEnvironment, releaseTemplateEnvironment(manifest.version), 'Template defaults must match the release channel');
assert.match(env.GITHUB_SHA || '', /^[a-f0-9]{40}$/);
const workflowRef = candidateRefs.find(ref => env.GITHUB_WORKFLOW_REF === `${repository}/${candidateWorkflow}@${ref}`);
assert(workflowRef, 'Build candidates only from main or feature/motion');
@@ -85,6 +101,7 @@ export async function sealCandidate(build, output, source, env = process.env) {
await writeFile(path.join(output, 'acceptance.md'), template.replace('<!-- CANDIDATE_IDENTITY -->', '```json\n' + JSON.stringify(identity, null, 2) + '\n```'));
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,
+ TEMPLATE_ENVIRONMENT: guide.templateEnvironment,
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');
@@ -151,7 +168,7 @@ async function verifyAuthorization(directory, inputs, env = process.env) {
export async function verifyCandidate(directory, expectedSHA256, run) {
const candidate = await json(path.join(directory, 'candidate.json'));
assert.equal(candidate.schemaVersion, 2); assert.equal(candidate.kind, 'motion-candidate'); assert.equal(candidate.packageName, '@openmotion/app');
- checkReleaseVersion(candidate.version); assert(candidate.version.includes('-test.'));
+ checkReleaseVersion(candidate.version);
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}$/);
const ref = `refs/heads/${run.head_branch || 'main'}`; // Older main-only receipts omitted the branch.
@@ -164,7 +181,7 @@ export async function verifyCandidate(directory, expectedSHA256, run) {
assert.equal(integrity(await readFile(path.join(directory, candidate.tgz))), candidate.integrity);
const guide = await json(path.join(directory, 'install-record.json'));
assert.equal(guide.commit, candidate.sourceCommit); assert.equal(guide.version, candidate.version); assert.equal(guide.packageName, candidate.packageName);
- assert.equal(guide.tgzSHA256, expectedSHA256); assert.equal(guide.channel, 'test'); assert.equal(guide.templateEnvironment, 'dev');
+ assert.equal(guide.tgzSHA256, expectedSHA256); assert.equal(guide.channel, releaseChannel(candidate.version)); assert.equal(guide.templateEnvironment, releaseTemplateEnvironment(candidate.version));
assert.equal(guide.guideSHA256, candidate.files['install.md']); assert.equal(guide.candidate, false);
const manifest = await json(path.join(directory, 'release-npm.json'));
assert.equal(manifest.commit, candidate.sourceCommit); assert.equal(manifest.version, candidate.version);
@@ -182,7 +199,7 @@ export async function verifyDownloaded(directory, expectedSHA256, version) {
}
export async function findCandidate(version, fetcher = fetch) {
- checkReleaseVersion(version); assert(version.includes('-test.'));
+ checkReleaseVersion(version);
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');
@@ -232,15 +249,17 @@ 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 verifyAuthorization(directory, inputs, env);
+ channelVersion(candidate.version, inputs.channel || 'test');
const before = await registryPackage(candidate, fetcher);
+ if (inputs.action === 'publish-stable' && before.tags.latest) assert(compareReleaseVersions(candidate.version, before.tags.latest) >= 0, 'A newer stable version already exists; use snapshot recovery');
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');
const record = { schemaVersion: 1, version: candidate.version, tgzSHA256: candidate.tgzSHA256, action: inputs.action,
- previousLatest: before.tags.latest ?? null, status: before.version ? 'already-published-identical' : 'publish-started' };
+ previousLatest: before.tags.latest ?? null, previousTest: before.tags.test ?? null, status: before.version ? 'already-published-identical' : 'publish-started' };
await writeJSON(path.join(directory, 'npm-publication.json'), record);
if (!before.version) {
// OIDC authenticates this publisher; its workflow SHA may differ from the prebuilt application's source.
- await run('npm', ['publish', path.join(directory, candidate.tgz), '--access', 'public', '--tag', 'candidate', '--ignore-scripts', '--provenance=false', '--registry=https://registry.npmjs.org/']);
+ await run('npm', ['publish', path.join(directory, candidate.tgz), '--access', 'public', '--tag', releaseChannel(candidate.version) === 'stable' ? 'stage' : 'candidate', '--ignore-scripts', '--provenance=false', '--registry=https://registry.npmjs.org/']);
record.status = 'published-awaiting-registry'; await writeJSON(path.join(directory, 'npm-publication.json'), record);
}
return record;
@@ -257,6 +276,7 @@ export async function waitForRegistry(candidate, ready, { fetcher = fetch, wait
export async function promoteTest(directory, inputs, { fetcher = fetch, run = runFile, env = process.env, wait, attempts } = {}) {
const candidate = await verifyDownloaded(directory, inputs.expectedSHA256, inputs.version);
+ channelVersion(candidate.version, 'test');
await verifyAuthorization(directory, inputs, env);
const npm = await json(path.join(directory, 'npm-publication.json'));
assert.equal(npm.tgzSHA256, candidate.tgzSHA256);
@@ -278,11 +298,56 @@ export async function promoteTest(directory, inputs, { fetcher = fetch, run = ru
return record;
}
+export async function stableReports(directory, candidate) {
+ channelVersion(candidate.version, 'stable');
+ const reports = [];
+ for (const platform of ['darwin-arm64', 'win32-x64']) {
+ const file = path.join(directory, `registry-${platform}.json`), report = await json(file);
+ assert.equal(report.status, 'passed'); assert.equal(report.platform, platform);
+ for (const key of ['version', 'sourceCommit', 'tgzSHA256']) assert.equal(report[key], candidate[key], 'Native report mismatch: ' + key);
+ assert.equal(report.templateEnvironment, 'prod');
+ for (const key of ['registryColdInstall', 'nativePreparation', 'repeatSetup', 'resources']) assert.equal(report[key], 'passed', 'Native check failed: ' + key);
+ assert.equal(report.mcpTools, 11); assert.equal(report.skills, 5);
+ reports.push({ platform, reportSHA256: await sha256(file), report });
+ }
+ return reports;
+}
+
+export async function promoteStable(directory, inputs, { fetcher = fetch, run = runFile, env = process.env, wait, attempts } = {}) {
+ const candidate = await verifyDownloaded(directory, inputs.expectedSHA256, inputs.version);
+ channelVersion(candidate.version, 'stable'); assert.equal(inputs.channel, 'stable');
+ assert(['publish-stable', 'archive-only'].includes(inputs.action));
+ await verifyAuthorization(directory, inputs, env);
+ const platformVerification = await stableReports(directory, candidate);
+ const npm = await json(path.join(directory, 'npm-publication.json'));
+ assert.equal(npm.tgzSHA256, candidate.tgzSHA256);
+ const before = await waitForRegistry(candidate, state => !!state.version, { fetcher, wait, attempts });
+ assert.equal(before.tags.test ?? null, npm.previousTest, 'npm test changed during stable publication');
+ const superseded = before.tags.latest && compareReleaseVersions(before.tags.latest, candidate.version) > 0;
+ if (!superseded && before.tags.latest !== candidate.version) assert.equal(before.tags.latest ?? null, npm.previousLatest, 'npm latest changed unexpectedly');
+ let status = inputs.action === 'archive-only' ? 'archive-only' : superseded ? 'superseded' : 'already-promoted';
+ if (inputs.action === 'publish-stable' && !superseded && before.tags.latest !== candidate.version) {
+ await run('npm', ['dist-tag', 'add', `${candidate.packageName}@${candidate.version}`, 'latest', '--registry=https://registry.npmjs.org/']);
+ const after = await waitForRegistry(candidate, state => state.tags.latest === candidate.version, { fetcher, wait, attempts });
+ assert(after.version); assert.equal(after.tags.test ?? null, npm.previousTest, 'Stable promotion changed npm test');
+ status = 'promoted';
+ }
+ const record = { schemaVersion: 1, version: candidate.version, tgzSHA256: candidate.tgzSHA256, action: inputs.action,
+ publicationRun: env.GITHUB_RUN_ID, platformVerification, previousLatest: before.tags.latest ?? null, status };
+ await writeJSON(path.join(directory, 'stable-promotion.json'), record);
+ return record;
+}
+
export 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 authorization = await verifyAuthorization(directory, inputs, env);
- const promotion = await json(path.join(directory, 'test-promotion.json'));
+ const stable = releaseChannel(candidate.version) === 'stable';
+ channelVersion(candidate.version, inputs.channel || 'test');
+ const platforms = stable ? await stableReports(directory, candidate) : undefined;
+ const promotionName = stable ? 'stable-promotion.json' : 'test-promotion.json';
+ const promotion = await json(path.join(directory, promotionName));
+ if (stable) assert.deepEqual(promotion.platformVerification, platforms);
assert.equal(promotion.version, candidate.version); assert.equal(promotion.tgzSHA256, candidate.tgzSHA256);
assert.equal(promotion.action, inputs.action); assert.equal(promotion.publicationRun, env.GITHUB_RUN_ID);
assert((inputs.action === 'archive-only' ? ['archive-only'] : ['promoted', 'already-promoted', 'superseded']).includes(promotion.status), 'Require a successful channel verification');
@@ -291,7 +356,9 @@ export async function archiveRelease(directory, inputs, config, { run = runFile,
const registry = await registryPackage(candidate, fetcher); assert(registry.version, 'Exact npm version is not public');
const npm = await json(path.join(directory, 'npm-publication.json'));
assert.equal(npm.tgzSHA256, candidate.tgzSHA256);
- assert.equal(registry.tags.latest ?? null, npm.previousLatest, 'npm latest changed unexpectedly; stop and investigate before promoting a guide');
+ if (!stable || inputs.action === 'archive-only') assert.equal(registry.tags.latest ?? null, npm.previousLatest, 'npm latest changed unexpectedly; stop and investigate before promoting a guide');
+ if (stable) assert.equal(registry.tags.test ?? null, npm.previousTest, 'npm test changed during stable publication');
+ if (inputs.action === 'publish-stable' && registry.tags.latest !== candidate.version) assert(registry.tags.latest && compareReleaseVersions(registry.tags.latest, candidate.version) > 0, 'Unexpected stable channel; explicit recovery required');
if (inputs.action === 'publish-test' && registry.tags.test !== candidate.version) {
assert(registry.tags.test && compareReleaseVersions(registry.tags.test, candidate.version) > 0, 'npm test tag is missing or unexpectedly older; explicit channel recovery is required');
}
@@ -308,7 +375,7 @@ export async function archiveRelease(directory, inputs, config, { run = runFile,
tgzSHA256: candidate.tgzSHA256, integrity: candidate.integrity, candidateRun: candidate.workflow,
authorization, publicationRun: env.GITHUB_RUN_ID,
channelPromotion: promotion, templateEnvironment: record.templateEnvironment,
- nativeChecks: 'post-publication', status: 'registry-verified', publishedAt: new Date().toISOString() };
+ nativeChecks: stable ? 'passed-before-latest' : 'post-publication', ...(stable ? { platformVerification: platforms } : {}), status: 'registry-verified', publishedAt: new Date().toISOString() };
if (prior) {
const existing = JSON.parse(prior);
for (const key of ['packageName', 'version', 'sourceCommit', 'tgzSHA256', 'integrity']) assert.equal(existing[key], release[key], 'Existing release record differs: ' + key);
@@ -328,10 +395,10 @@ export async function archiveRelease(directory, inputs, config, { run = runFile,
const response = await fetcher(new URL('/' + object.key, plan.publicOrigin), { redirect: 'error', signal: AbortSignal.timeout(30_000), headers: { 'cache-control': 'no-cache' } });
assert(response.ok, 'Snapshot public readback failed'); assert(Buffer.from(await response.arrayBuffer()).equals(object.bytes), 'Snapshot public bytes differ');
}
- const promote = inputs.action === 'publish-test' && registry.tags.test === candidate.version;
+ const promote = inputs.action === 'publish-test' && registry.tags.test === candidate.version || inputs.action === 'publish-stable' && registry.tags.latest === candidate.version;
const publication = await publishGuide(directory, config, { run, fetcher, promote });
await writeJSON(path.join(directory, 'release-attempt.json'), { action: inputs.action, version: candidate.version,
- stage: inputs.action === 'archive-only' ? 'archive-only-verified' : !promote || publication.phase === 'superseded' ? 'archived-superseded' : 'test-entry-verified', runId: env.GITHUB_RUN_ID });
+ stage: inputs.action === 'archive-only' ? 'archive-only-verified' : !promote || publication.phase === 'superseded' ? 'archived-superseded' : `${releaseChannel(candidate.version)}-entry-verified`, runId: env.GITHUB_RUN_ID });
return release;
} finally { await rm(work, { recursive: true, force: true }); }
}
@@ -354,7 +421,7 @@ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.me
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);
+ await validateSource(extra, c.sourceCommit, c.version, runFile, inputs.channel);
const work = await mkdtemp(path.join(os.tmpdir(), 'motion-source-verify-'));
try {
await runFile('git', ['worktree', 'add', '--detach', work, c.sourceCommit], { cwd: extra });
@@ -364,6 +431,7 @@ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.me
} else if (command === 'verify') await verifyDownloaded(directory, inputs.expectedSHA256, inputs.version);
else if (command === 'npm') await publishNpm(directory, inputs);
else if (command === 'promote-test') await promoteTest(directory, inputs);
+ else if (command === 'promote-stable') await promoteStable(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);
await archiveRelease(directory, inputs, { endpoint: process.env.MOTION_R2_ENDPOINT, bucket: process.env.MOTION_R2_BUCKET, publicOrigin: process.env.MOTION_INSTALL_PUBLIC_ORIGIN });
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index caf7245c..1725062f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -126,7 +126,7 @@ jobs:
run: |
node .github/scripts/motion-scan.mjs install "$RUNNER_TEMP/scanner"
node .github/scripts/motion-scan.mjs source . "$RUNNER_TEMP/source-scan.json" "$RUNNER_TEMP/scanner/gitleaks"
- node --test tests/release-workflows.test.mjs tests/release-scan.test.mjs tests/registry-download.test.mjs
+ node --test tests/release-workflows.test.mjs tests/release-scan.test.mjs tests/registry-download.test.mjs tests/stable-release.test.mjs
- name: Install locked Motion dependencies
run: npm ci --no-audit --no-fund
- name: Check and build Studio
diff --git a/.github/workflows/motion-candidate.yml b/.github/workflows/motion-candidate.yml
index 8f83b1bf..64a98e5b 100644
--- a/.github/workflows/motion-candidate.yml
+++ b/.github/workflows/motion-candidate.yml
@@ -1,11 +1,16 @@
name: Motion candidate build
-run-name: Motion candidate · ${{ inputs.version || 'auto' }}
+run-name: Motion candidate · ${{ inputs.channel || 'test' }} · ${{ inputs.version || 'auto' }}
on:
workflow_dispatch:
inputs:
+ channel:
+ description: 'test builds DEV prereleases; stable builds prod with an explicit stable version'
+ type: choice
+ options: [test, stable]
+ default: test
version:
- description: 'Optional override; empty uses short next Motion patch-test.N (reruns add .attempt); build only'
+ description: 'test: optional short version override; stable: required MAJOR.MINOR.PATCH; build only'
type: string
required: false
default: ''
@@ -25,6 +30,8 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 45
env:
+ MOTION_RELEASE_CHANNEL: ${{ inputs.channel || 'test' }}
+ MOTION_TEMPLATE_ENVIRONMENT: ${{ inputs.channel == 'stable' && 'prod' || 'dev' }}
MOTION_SOURCE_SHA: ${{ inputs.source_sha }}
MOTION_VERSION: ${{ inputs.version }}
OPENMOTION_TELEMETRY: '0'
@@ -103,12 +110,12 @@ jobs:
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 DEV application tgz once and scan both archives
+ - name: Build the final application tgz once and scan both archives
env:
MOTION_SOURCE_SHA: ${{ steps.source.outputs.source_sha }}
MOTION_VERSION: ${{ steps.source.outputs.version }}
run: |
- node source/scripts/package-npm.mjs "$RUNNER_TEMP/build" "$MOTION_VERSION" --template-env=dev
+ node source/scripts/package-npm.mjs "$RUNNER_TEMP/build" "$MOTION_VERSION" --template-env="$MOTION_TEMPLATE_ENVIRONMENT"
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
@@ -126,5 +133,5 @@ jobs:
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. Verify host loading without waiting for background video-component preparation. Run prepare only when explicitly asked to wait or before requested media/capture/export acceptance checks. Record actual 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. To publish, manually open Motion test publication and enter ${c.version}; no acceptance checkbox is required. Nothing was published by this build.\n`);
+ 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. Verify host loading without waiting for background video-component preparation. Run prepare only when explicitly asked to wait or before requested media/capture/export acceptance checks. Record actual 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. To publish, manually open Motion npm publication, select the same channel and enter ${c.version}; no acceptance checkbox is required. Nothing was published by this build.\n`);
JS
diff --git a/.github/workflows/motion-install-check.yml b/.github/workflows/motion-install-check.yml
index fb7ef827..3d5adbb4 100644
--- a/.github/workflows/motion-install-check.yml
+++ b/.github/workflows/motion-install-check.yml
@@ -5,7 +5,7 @@ on:
workflow_dispatch:
inputs:
version:
- description: 'Existing public test version to check; no publication or channel changes'
+ description: 'Existing public exact version to check; no publication or channel changes'
type: string
required: true
default: '0.6.4-test.7'
diff --git a/.github/workflows/motion-publication-recovery.yml b/.github/workflows/motion-publication-recovery.yml
index f3da3976..ec660da7 100644
--- a/.github/workflows/motion-publication-recovery.yml
+++ b/.github/workflows/motion-publication-recovery.yml
@@ -3,6 +3,11 @@ name: Motion snapshot recovery
on:
workflow_dispatch:
inputs:
+ channel:
+ description: 'Channel of the existing version; snapshots only, no tag or default-guide changes'
+ type: choice
+ options: [test, stable]
+ default: test
version:
description: 'Exact existing candidate version; the identical package must already be public on npm'
type: string
@@ -31,6 +36,7 @@ jobs:
id-token: write
uses: ./.github/workflows/motion-publish-test.yml
with:
+ channel: ${{ inputs.channel || 'test' }}
version: ${{ inputs.version }}
archive_only: true
secrets: inherit
diff --git a/.github/workflows/motion-publish-test.yml b/.github/workflows/motion-publish-test.yml
index fa3e7c21..63e4cc16 100644
--- a/.github/workflows/motion-publish-test.yml
+++ b/.github/workflows/motion-publish-test.yml
@@ -1,15 +1,23 @@
-name: Motion test publication
-run-name: Motion test publication · ${{ inputs.version }}
+name: Motion npm publication
+run-name: Motion publication · ${{ inputs.channel || 'test' }} · ${{ inputs.version }}
on:
workflow_dispatch:
inputs:
+ channel:
+ description: 'test publishes DEV to test; stable publishes prod to stage, then verified latest'
+ type: choice
+ options: [test, stable]
+ default: test
version:
- description: 'Exact candidate version, e.g. 0.6.4-test.7; candidate identity is resolved automatically'
+ description: 'Exact candidate version: test e.g. 0.6.4-test.7; stable e.g. 0.6.4'
type: string
required: true
workflow_call:
inputs:
+ channel:
+ type: string
+ default: test
version:
type: string
required: true
@@ -26,8 +34,9 @@ concurrency:
cancel-in-progress: false
env:
+ MOTION_RELEASE_CHANNEL: ${{ inputs.channel || 'test' }}
MOTION_VERSION: ${{ inputs.version }}
- MOTION_RELEASE_ACTION: ${{ inputs.archive_only && 'archive-only' || 'publish-test' }}
+ MOTION_RELEASE_ACTION: ${{ inputs.archive_only && 'archive-only' || inputs.channel == 'stable' && 'publish-stable' || 'publish-test' }}
jobs:
verify:
@@ -122,11 +131,11 @@ jobs:
if-no-files-found: warn
registry-mac:
- if: ${{ always() && !cancelled() && needs.verify.result == 'success' && needs.snapshot.result == 'success' }}
+ if: ${{ always() && !cancelled() && needs.verify.result == 'success' && needs.npm.result == 'success' && (inputs.channel == 'stable' || needs.snapshot.result == 'success') }}
env:
MOTION_EXPECTED_SHA256: ${{ needs.verify.outputs.tgz_sha256 }}
- needs: [verify, snapshot]
- continue-on-error: true
+ needs: [verify, npm, snapshot]
+ continue-on-error: ${{ inputs.channel != 'stable' }}
runs-on: macos-26
timeout-minutes: 40
outputs:
@@ -154,8 +163,8 @@ jobs:
if: failure()
shell: bash
run: |
- echo '::warning::Post-publication native installation check failed. The published version and installation guide remain available; inspect this job before recommending it.'
- echo 'Native installation check failed after publication; see this job log.' >> "$GITHUB_STEP_SUMMARY"
+ echo '::warning::Native installation failed. Test delivery remains available; stable latest promotion is blocked. Inspect this job before recommending the version.'
+ echo 'Native installation failed; inspect the platform report. Stable latest promotion is blocked.' >> "$GITHUB_STEP_SUMMARY"
- uses: actions/[email protected]
id: artifact
if: always()
@@ -166,11 +175,11 @@ jobs:
if-no-files-found: warn
registry-windows:
- if: ${{ always() && !cancelled() && needs.verify.result == 'success' && needs.snapshot.result == 'success' }}
+ if: ${{ always() && !cancelled() && needs.verify.result == 'success' && needs.npm.result == 'success' && (inputs.channel == 'stable' || needs.snapshot.result == 'success') }}
env:
MOTION_EXPECTED_SHA256: ${{ needs.verify.outputs.tgz_sha256 }}
- needs: [verify, snapshot]
- continue-on-error: true
+ needs: [verify, npm, snapshot]
+ continue-on-error: ${{ inputs.channel != 'stable' }}
runs-on: windows-2025
timeout-minutes: 40
outputs:
@@ -198,8 +207,8 @@ jobs:
if: failure()
shell: bash
run: |
- echo '::warning::Post-publication native installation check failed. The published version and installation guide remain available; inspect this job before recommending it.'
- echo 'Native installation check failed after publication; see this job log.' >> "$GITHUB_STEP_SUMMARY"
+ echo '::warning::Native installation failed. Test delivery remains available; stable latest promotion is blocked. Inspect this job before recommending the version.'
+ echo 'Native installation failed; inspect the platform report. Stable latest promotion is blocked.' >> "$GITHUB_STEP_SUMMARY"
- uses: actions/[email protected]
id: artifact
if: always()
@@ -210,7 +219,7 @@ jobs:
if-no-files-found: warn
promote-test:
- if: ${{ always() && !cancelled() && needs.verify.result == 'success' && needs.npm.result == 'success' }}
+ if: ${{ inputs.channel != 'stable' && always() && !cancelled() && needs.verify.result == 'success' && needs.npm.result == 'success' }}
env:
MOTION_EXPECTED_SHA256: ${{ needs.verify.outputs.tgz_sha256 }}
needs: [verify, npm]
@@ -258,7 +267,7 @@ jobs:
if-no-files-found: warn
snapshot:
- if: ${{ always() && !cancelled() && needs.verify.result == 'success' && needs.npm.result == 'success' && needs.promote-test.result == 'success' }}
+ if: ${{ inputs.channel != 'stable' && always() && !cancelled() && needs.verify.result == 'success' && needs.npm.result == 'success' && needs.promote-test.result == 'success' }}
env:
MOTION_EXPECTED_SHA256: ${{ needs.verify.outputs.tgz_sha256 }}
MOTION_INSTALL_PUBLIC_ORIGIN: ${{ vars.CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN }}
@@ -323,3 +332,142 @@ jobs:
const origin = process.env.MOTION_INSTALL_PUBLIC_ORIGIN;
appendFileSync(process.env.GITHUB_STEP_SUMMARY, `## Test publication result\n\nVersion: ${c.version}\n\nSource: ${c.sourceCommit}\n\nResult: ${a.stage}\n\n[Exact-version installation guide](${origin}/open-motion/dev/${c.version}/install.md)\n\n[Default test guide](${origin}/open-motion/dev/install.md)\n\nThe default is advanced after registry and public readback; native cold-install checks run afterward; a superseded candidate keeps its version snapshot without moving the default. No stable release occurred.\n`);
JS
+
+ promote-stable:
+ if: ${{ inputs.channel == 'stable' && always() && !cancelled() && needs.verify.result == 'success' && needs.npm.result == 'success' && needs.registry-mac.result == 'success' && needs.registry-windows.result == 'success' }}
+ env:
+ MOTION_EXPECTED_SHA256: ${{ needs.verify.outputs.tgz_sha256 }}
+ needs: [verify, npm, registry-mac, registry-windows]
+ runs-on: ubuntu-24.04
+ timeout-minutes: 25
+ outputs:
+ artifact_id: ${{ steps.artifact.outputs.artifact-id }}
+ permissions:
+ contents: read
+ actions: read
+ id-token: write
+ steps:
+ - uses: actions/[email protected]
+ with:
+ ref: ${{ github.sha }}
+ persist-credentials: false
+ - uses: actions/setup-node@v6
+ with:
+ node-version: '26.11.1'
+ registry-url: 'https://registry.npmjs.org'
+ - name: Use the pinned npm CLI with trusted dist-tag support
+ run: npm install --global [email protected] --ignore-scripts --no-audit --no-fund
+ - uses: actions/[email protected]
+ with:
+ artifact-ids: ${{ needs.verify.outputs.artifact_id }}
+ github-token: ${{ github.token }}
+ run-id: ${{ github.run_id }}
+ path: ${{ runner.temp }}/candidate
+ - uses: actions/[email protected]
+ with:
+ artifact-ids: ${{ needs.npm.outputs.artifact_id }}
+ github-token: ${{ github.token }}
+ run-id: ${{ github.run_id }}
+ path: ${{ runner.temp }}/candidate
+ - uses: actions/[email protected]
+ with:
+ artifact-ids: ${{ needs.registry-mac.outputs.artifact_id }}
+ github-token: ${{ github.token }}
+ run-id: ${{ github.run_id }}
+ path: ${{ runner.temp }}/candidate
+ - uses: actions/[email protected]
+ with:
+ artifact-ids: ${{ needs.registry-windows.outputs.artifact_id }}
+ github-token: ${{ github.token }}
+ run-id: ${{ github.run_id }}
+ path: ${{ runner.temp }}/candidate
+ - name: Advance npm latest after both exact prod installations pass
+ run: node .github/scripts/motion-release.mjs promote-stable "$RUNNER_TEMP/candidate"
+ - name: Retain the verified channel result
+ id: artifact
+ if: always()
+ uses: actions/[email protected]
+ with:
+ name: stable-promotion-${{ github.run_id }}-${{ github.run_attempt }}
+ path: ${{ runner.temp }}/candidate/stable-promotion.json
+ retention-days: 30
+ if-no-files-found: warn
+
+ stable-snapshot:
+ if: ${{ inputs.channel == 'stable' && always() && !cancelled() && needs.verify.result == 'success' && needs.npm.result == 'success' && needs.promote-stable.result == 'success' }}
+ env:
+ MOTION_EXPECTED_SHA256: ${{ needs.verify.outputs.tgz_sha256 }}
+ MOTION_INSTALL_PUBLIC_ORIGIN: ${{ vars.CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN }}
+ needs: [verify, npm, promote-stable, registry-mac, registry-windows]
+ runs-on: ubuntu-24.04
+ timeout-minutes: 15
+ steps:
+ - uses: actions/[email protected]
+ with:
+ ref: ${{ github.sha }}
+ persist-credentials: false
+ - uses: actions/setup-node@v6
+ with:
+ node-version: '26.11.1'
+ - uses: actions/[email protected]
+ with:
+ artifact-ids: ${{ needs.verify.outputs.artifact_id }}
+ github-token: ${{ github.token }}
+ run-id: ${{ github.run_id }}
+ path: ${{ runner.temp }}/candidate
+ - uses: actions/[email protected]
+ with:
+ artifact-ids: ${{ needs.npm.outputs.artifact_id }}
+ github-token: ${{ github.token }}
+ run-id: ${{ github.run_id }}
+ path: ${{ runner.temp }}/candidate
+ - uses: actions/[email protected]
+ with:
+ artifact-ids: ${{ needs.promote-stable.outputs.artifact_id }}
+ github-token: ${{ github.token }}
+ run-id: ${{ github.run_id }}
+ path: ${{ runner.temp }}/candidate
+ - uses: actions/[email protected]
+ with:
+ artifact-ids: ${{ needs.registry-mac.outputs.artifact_id }}
+ github-token: ${{ github.token }}
+ run-id: ${{ github.run_id }}
+ path: ${{ runner.temp }}/candidate
+ - uses: actions/[email protected]
+ with:
+ artifact-ids: ${{ needs.registry-windows.outputs.artifact_id }}
+ github-token: ${{ github.token }}
+ run-id: ${{ github.run_id }}
+ path: ${{ runner.temp }}/candidate
+ - name: Archive exact-version snapshots, verify canonical public bytes, then promote the default guide last
+ env:
+ AWS_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_R2_RELEASES_AK }}
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_RELEASES_SK }}
+ AWS_EC2_METADATA_DISABLED: 'true'
+ AWS_PAGER: ''
+ MOTION_R2_ENDPOINT: ${{ vars.CLOUDFLARE_R2_RELEASES_URL }}
+ MOTION_R2_BUCKET: ${{ vars.CLOUDFLARE_R2_RELEASES_BUCKET }}
+ MOTION_INSTALL_PUBLIC_ORIGIN: ${{ vars.CLOUDFLARE_R2_RELEASES_PUBLIC_ORIGIN }}
+ run: node .github/scripts/motion-release.mjs archive "$RUNNER_TEMP/candidate"
+ - name: Retain the attempt, immutable release identity and previous default guide
+ if: always()
+ uses: actions/[email protected]
+ with:
+ name: release-record-${{ github.run_id }}-${{ github.run_attempt }}
+ path: |
+ ${{ runner.temp }}/candidate/release-record.json
+ ${{ runner.temp }}/candidate/release-attempt.json
+ ${{ runner.temp }}/candidate/publication.json
+ ${{ runner.temp }}/candidate/previous-install.md
+ retention-days: 30
+ if-no-files-found: warn
+ - name: Show the exact-version result and default guide status
+ if: success()
+ 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 a = JSON.parse(readFileSync(process.env.RUNNER_TEMP + '/candidate/release-attempt.json'));
+ const origin = process.env.MOTION_INSTALL_PUBLIC_ORIGIN;
+ appendFileSync(process.env.GITHUB_STEP_SUMMARY, `## Stable publication result\n\nVersion: ${c.version}\n\nSource: ${c.sourceCommit}\n\nResult: ${a.stage}\n\n[Exact-version installation guide](${origin}/open-motion/${c.version}/install.md)\n\n[Default stable guide](${origin}/open-motion/install.md)\n\nThe stable default follows verified latest and both prod native checks; a superseded candidate keeps its version snapshot without moving the default. The test channel is not changed by stable publication.\n`);
+ JS
diff --git a/AGENTS.md b/AGENTS.md
index 32b4d43a..a3b7d5dd 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -53,6 +53,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): separate manual candidate-build and test-publication entries, plus snapshot-only recovery. Select `feature/motion` for all three entries; `main` only registers them and is rejected as an execution ref. Blank candidate versions use short workflow-counter `test.N` numbering; keep full run/source identities in the records. Use candidate-install.md for local testing and keep results private. The publication operator enters the exact version and starts the manual workflow; no acceptance checkbox or manual testing gate is required. Record failed and unrun checks honestly. 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 DEV 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 npm-publication entries, plus snapshot-only recovery. Select `feature/motion` for all entries; `main` only registers them and is rejected as an execution ref. Select `test` (default, DEV templates) or `stable` (prod templates). Blank test versions use short workflow-counter `test.N` numbering; stable requires an explicit new `MAJOR.MINOR.PATCH`. Keep full run/source identities in the records. Use candidate-install.md for local testing and keep results private. The publication operator enters the exact version and starts the manual workflow; no acceptance checkbox or independent approval environment is enabled. Public candidates must use an exact reviewed source SHA integrated into `feature/motion`. 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. Publish under `candidate` first; the credential-isolated promotion job moves npm `test` after registry propagation, then archives and updates the guide. Mac/Windows cold installs run afterward as non-blocking checks with visible warnings. Stable publication, npm `latest` promotion and platform/marketplace Skills distribution are not implemented by these entries. 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. The read-only Motion installation check (motion-install-check.yml) can recheck an exact public test version independently, without publishing, changing npm tags or writing storage. Never overwrite published versions, put private template payloads/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.
+Publication uses the accepted candidate bytes, never a rebuild. Test publishes under `candidate`, promotes `test` after registry propagation, archives and updates the DEV guide, then runs non-blocking Mac/Windows cold installs. Stable publishes publicly under `stage`, requires both exact prod cold installs to pass, then promotes `latest`, archives and updates the stable guide last; it preserves `test`. A stage tag does not make the package private. The existing `motion-publish-test.yml` filename remains the npm Trusted Publisher identity for both channels. Only separately authorized manual publication/recovery may receive npm OIDC or R2 credentials; consumer jobs receive neither. Archive-only work must not publish npm, move tags or access default entries. The read-only Motion installation check can recheck an exact public test or stable version independently. Never overwrite published versions, put private template payloads/internal acceptance material into public artifacts, or infer merge/publication authorization from green CI. Real prod template, Agent and audiovisual acceptance remain release responsibilities; hosted installation checks do not establish them. Skills marketplace publication, main registration, npm trust, main cutover and repository rename remain separate operations.
diff --git a/CLAUDE.md b/CLAUDE.md
index b86aa27d..8d2c93ac 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -4,9 +4,9 @@ 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): separate manual candidate-build and test-publication entries, plus snapshot-only recovery. Select `feature/motion` for all three entries; `main` only registers them and is rejected as an execution ref. Blank candidate versions use short workflow-counter `test.N` numbering; keep full run/source identities in the records. Use candidate-install.md for local testing and keep results private. The publication operator enters the exact version and starts the manual workflow; no acceptance checkbox or manual testing gate is required. Record failed and unrun checks honestly. 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 DEV 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 npm-publication entries, plus snapshot-only recovery. Select `feature/motion` for all entries; `main` only registers them and is rejected as an execution ref. Select `test` (default, DEV templates) or `stable` (prod templates). Blank test versions use short workflow-counter `test.N` numbering; stable requires an explicit new `MAJOR.MINOR.PATCH`. Keep full run/source identities in the records. Use candidate-install.md for local testing and keep results private. The publication operator enters the exact version and starts the manual workflow; no acceptance checkbox or independent approval environment is enabled. Public candidates must use an exact reviewed source SHA integrated into `feature/motion`. 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. Publish under `candidate` first; the credential-isolated promotion job moves npm `test` after registry propagation, then archives and updates the guide. Mac/Windows cold installs run afterward as non-blocking checks with visible warnings. Stable publication, npm `latest` promotion and platform/marketplace Skills distribution are not implemented by these entries. 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. The read-only Motion installation check (motion-install-check.yml) can recheck an exact public test version independently, without publishing, changing npm tags or writing storage. Never overwrite published versions, put private template payloads/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.
+Publication uses the accepted candidate bytes, never a rebuild. Test publishes under `candidate`, promotes `test` after registry propagation, archives and updates the DEV guide, then runs non-blocking Mac/Windows cold installs. Stable publishes publicly under `stage`, requires both exact prod cold installs to pass, then promotes `latest`, archives and updates the stable guide last; it preserves `test`. A stage tag does not make the package private. The existing `motion-publish-test.yml` filename remains the npm Trusted Publisher identity for both channels. Only separately authorized manual publication/recovery may receive npm OIDC or R2 credentials; consumer jobs receive neither. Archive-only work must not publish npm, move tags or access default entries. The read-only Motion installation check can recheck an exact public test or stable version independently. Never overwrite published versions, put private template payloads/internal acceptance material into public artifacts, or infer merge/publication authorization from green CI. Real prod template, Agent and audiovisual acceptance remain release responsibilities; hosted installation checks do not establish them. Skills marketplace publication, main registration, npm trust, main cutover and repository rename remain separate operations.
## Product documentation
diff --git a/docs/product/architecture.md b/docs/product/architecture.md
index a537ad7c..637427d5 100644
--- a/docs/product/architecture.md
+++ b/docs/product/architecture.md
@@ -266,9 +266,11 @@ Explicit test/DEV and stable/prod builds produce publishable artifact metadata w
## 演进约束
-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 → optional local testing → manual publish. Candidate build, test publication and snapshot recovery run only from feature/motion; main registers their manual entries without aliasing Motion operations. The build freezes the selected dispatch commit (or an explicitly integrated source SHA) and automatically numbers an empty version as the next source patch plus short test.N using the candidate workflow counter with its historical offset, without rewriting the source baseline. Reruns add an attempt suffix; an explicit test-version override remains available. It builds one immutable DEV 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 records the manual publication operator without requiring an acceptance checkbox. No independent approval environment is enabled; the manual operator receipt is not proof of private tests or independent review. The same tgz is published under npm candidate, promoted to test in an npm-OIDC-only job with bounded propagation retries, then archived before conditionally advancing the default guide. Anonymous Mac/Windows cold installs run afterward as non-blocking checks. Failed native checks report warnings without undoing publication. A separate read-only installation workflow can recheck the exact public test version without entering publication; it shares bounded registry-download retries with the post-publication checks. R2 failure after tag promotion can leave the guide on the earlier accepted version. 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. DEV configuration is public; private template contents and credentials remain outside the artifacts. 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).
+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 npm-publication entries implement build → local testing → manual publish. Candidate build, npm publication and snapshot recovery run only from feature/motion; main registers their manual entries without aliasing Motion operations. The build freezes the selected dispatch commit (or an explicitly integrated source SHA). Test builds use DEV; an empty test version uses the next source patch plus short test.N from the workflow counter and historical offset, without rewriting the source baseline. Reruns add an attempt suffix. Stable builds require an explicit new version and prod configuration. Each immutable candidate includes candidate-install.md and an identity-filled acceptance checklist. Publication resolves a unique unexpired artifact from a successful registered build, checks official ZIP/file hashes and source integration, then records the actual operator. No acceptance checkbox or independent approval environment is enabled; the receipt is not proof of private tests or review.
-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; stable candidate/publication, npm latest promotion and Skills marketplace/platform publication are not implemented. The bundled Skills are installed into local hosts only.
+Test publishes the same tgz under npm candidate, promotes test in an npm-OIDC-only job with bounded propagation retries, then archives and advances the DEV guide. Mac/Windows cold installs follow as non-blocking checks with visible warnings. Stable uses the same trusted workflow filename and publicly stages the exact prod tgz under stage. Both matching Mac/Windows installation reports must pass before latest advances; test is preserved, prod snapshots follow, and the stable guide advances last. Stage is public. A separate read-only installation workflow can recheck an exact public test or stable version using the shared registry-download retries. npm and R2 are not atomic; storage failure can leave the guide on the earlier version. Builds can continue during acceptance; publication serialization, version checks and ETag writes prevent an older completion from regressing the guide. Snapshot-only recovery requires an identical existing npm version and never moves tags or the default. No private template contents or credentials are bundled. Default-branch registration and npm trust remain separate activation prerequisites. Live prod templates, real Agent creation and human playback remain release acceptance responsibilities, separate from build and native-install 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. Test and stable share source/hash/scanning and retry controls; stable release records additionally retain both matching native reports. Skills marketplace/platform publication is not implemented. The bundled Skills are installed into local hosts only.
已确认方向是继续支持多 Agent 接入、可编辑工程与一个工作区内的发现/制作闭环。
diff --git a/docs/release-guide.md b/docs/release-guide.md
index 7683ccc7..09a60251 100644
--- a/docs/release-guide.md
+++ b/docs/release-guide.md
@@ -6,11 +6,11 @@ This is the maintainer and tester manual for the application npm format. It defi
Record package name/exact version, full source SHA, CI run/attempt, tgz SHA256 and npm integrity when available, application/manifest and both lock hashes, template environment/Resource/locale/catalog version, OS/CPU/Node/npm/Agent versions, installation paths, results and evidence links, known problems, acceptance owner and prior usable version. Keep internal logs, credentials and user material outside public packages.
-Use `0.6.4-test.1`, `0.6.4-test.2`, then `0.6.4` as examples, not previously published versions. Any changed release bytes require a new candidate identity. Never overwrite a published version or reuse a Git tag. Software channel and template environment are separate: new public test packages default to DEV and stable packages to prod; isolated local builds remain available. Existing published prod test versions are not rewritten.
+Version examples such as `0.6.4-test.1` and `0.6.4` illustrate the format; query npm before selecting any new release number. Any changed release bytes require a new candidate identity. Never overwrite a published version or reuse a Git tag. Software channel and template environment are separate: new public test packages default to DEV and stable packages to prod; isolated local builds remain available. Existing published prod test versions are not rewritten.
### Published test candidate: 0.6.4-test.6
-Published on 2026-11-09: [`@openmotion/[email protected]`](https://www.npmjs.com/package/@openmotion/app/v/0.6.4-test.6), selected by npm `test`. Accepted source: `3d7051ae0e2f47373ff49b0dd1ed5f0f3e343cab`, merged by [#187](https://github.com/nexu-io/html-anything/pull/187) into `feature/motion` as `1a04db765e2e994d21b540557d545c3ce28eb79a` with the same Git tree. The [source CI](https://github.com/nexu-io/html-anything/actions/runs/42628050173) passed. Neither `main` nor `legacy` changed.
+Historical record, published on 2026-11-09: [`@openmotion/[email protected]`](https://www.npmjs.com/package/@openmotion/app/v/0.6.4-test.6), selected by npm `test` at that time (tags are mutable). Accepted source: `3d7051ae0e2f47373ff49b0dd1ed5f0f3e343cab`, merged by [#187](https://github.com/nexu-io/html-anything/pull/187) into `feature/motion` as `1a04db765e2e994d21b540557d545c3ce28eb79a` with the same Git tree. The [source CI](https://github.com/nexu-io/html-anything/actions/runs/42628050173) passed. Neither `main` nor `legacy` changed.
The accepted tgz and the anonymous registry download have SHA256 `73abb7c87f3b11b4649462e8df882216e20a76c382ecb2b474e2fd3c9a032936`; registry integrity is `sha512-SLwSXvnslKCyLeVUZ2CrKBNz6S7zHoGGVmlvcxobllGyho5tTZVdrVQ2ErfxUtyVhEy0577G1XfQiCweIWrGdw==`. The same bytes passed isolated macOS fresh installation, test.5 upgrade, repeat setup, native Chromium/FFmpeg/ffprobe preparation, eleven Tools, five Skills and a technical MP4 export with audio. A fresh anonymous registry installation separately verified hashes, Codex registration, MCP discovery/resources and repeat setup. These checks do not establish a real model turn or human audiovisual acceptance; Windows remains unverified.
@@ -37,14 +37,14 @@ Mac arm64 and Windows x64 require separate results; absent runners are not passe
2. Freeze stable source, dependencies and prod configuration. Build the stable version without `-test` once. The version change changes bytes: verify the **stable tgz** rather than renaming a test archive or copying its hash. Record the source/config delta against the accepted test candidate.
3. Repeat stable-package cold installation, prepare, template creation, preview/edit/save/export on all promised targets. Test upgrade from the prior test or stable release with existing projects/material/config retained; exercise compatible rollback or backup/restore. Do not promise older versions can read a migrated format without proof.
4. Confirm the exact public package/scope and authorized publisher. Explicit test/DEV and stable/prod artifacts are publishable; source/unversioned/channel-environment-mismatched manifests stay private. The build does not publish. Test-candidate metadata selects `candidate`; test promotion precedes non-blocking native registry checks; stable metadata selects temporary `stage`, not `latest`.
-5. Only after separate publication authorization: publish the verified stable tgz, install that exact registry version, then move `latest` after the registry check passes and announce supported platforms/known issues. A stage tag does not hide a public package. npm tags do not update machines already installed.
+5. After separate publication authorization, use Motion npm publication with `channel=stable` and that exact candidate version. It publishes under public `stage`, requires matching macOS ARM64 and Windows x64 prod installation reports, then advances `latest` and the prod guide. The pipeline does not perform a real Agent task, live prod-template acceptance or human playback; complete those against the stable candidate beforehand and record them privately. Announce only supported platforms and known issues. A stage tag does not hide a public package. npm tags do not update machines already installed.
Maintainer commands below are examples, not automatically executed release steps:
```sh
# The manual test workflow performs these two steps with registry propagation verification between them:
npm publish /absolute/final-test.tgz --access public --tag candidate
-# After both exact-version native checks pass:
+# After test registry propagation (native checks follow test delivery):
npm dist-tag add @openmotion/app@<exact-test-version> test
npm publish /absolute/final-stable.tgz --access public --tag stage
# After exact stable registry-install acceptance and channel authorization:
@@ -65,9 +65,9 @@ Each defect needs exact package/source/OS/host/environment/catalog identity, pro
Ordinary npm/DEV CI builds generate a **candidate-only** guide and retain it as an Actions artifact for 14 days. The publisher rejects candidate previews. Public guides require test/DEV or stable/prod identity; private builds cannot produce them.
-Maintainers follow [build → download and accept → publish](release-workflows.md): first run Motion candidate build from `feature/motion` with version empty for automatic numbering (or an explicit 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. Run Motion test publication from `feature/motion` with that exact version. Starting the manual workflow authorizes publication; no acceptance checkbox is required. Candidate lookup and hashes are automatic; no independent approval environment is enabled. The same candidate bytes receive immutable snapshots before the moving guide advances; anonymous native registry checks follow publication and report failures separately. 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.
+Maintainers follow [build → download and accept → publish](release-workflows.md): first run Motion candidate build from `feature/motion` with `channel=test` and version empty for automatic numbering (or an explicit new test version), or `channel=stable` with an explicit new stable 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. Run Motion npm publication from `feature/motion` with the same channel and that exact version. Starting the manual workflow authorizes publication; no acceptance checkbox is required. Candidate lookup and hashes are automatic; no independent approval environment is enabled. The same candidate bytes receive immutable snapshots before the moving guide advances; test native registry checks follow delivery and report warnings; stable requires both checks before `latest`. 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, npm `latest` promotion and Skills platform/marketplace distribution still require separate implementation and authorization. Bundling five Skills and registering them locally does not publish them to a platform. 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.
+The entries support test/DEV and stable/prod candidates. Stable uses stage → both native checks → latest → prod snapshots/default guide. Skills platform/marketplace distribution remains outside this implementation; each real publication requires separate authorization. Bundling five Skills and registering them locally does not publish them to a platform. 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.
The short test/stable version URL contract and historical `/versions/` URLs remain as documented in that manual. New test software uses DEV template defaults. DEV service access still depends on network/authentication; private template snapshots and credentials must never be embedded. The earlier test.6 retains prod defaults.
@@ -75,4 +75,4 @@ The configured destination bucket is `open-design-releases` and the public origi
The new entries require separate trusted default-branch registration 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).
-Default installation guides use floating npm tags (`@test` for DEV, `@latest` for stable) and state the current version separately. Versioned guides remain pinned for reproduction. Native cold-install results are post-publication evidence, not a test-channel promotion gate.
+Default installation guides use floating npm tags (`@test` for DEV, `@latest` for stable) and state the current version separately. Versioned guides remain pinned for reproduction. Native cold-install results are post-delivery evidence for test and a required gate before stable `latest`. Neither establishes real creation or human acceptance.
diff --git a/docs/release-workflows.md b/docs/release-workflows.md
index 40379d51..b7f665f3 100644
--- a/docs/release-workflows.md
+++ b/docs/release-workflows.md
@@ -1,20 +1,20 @@
-# Motion test release: build, test, publish
+# Motion releases: build, test, publish
-Use two manual Actions entries: **Motion candidate build**, then **Motion test publication**. The daily flow is **build → optional local testing → manual publish**. Neither entry runs on pushes, PR merges, tags or a schedule. The entries are registered on `main`; Motion application development stays on `feature/motion`. Merging a workflow change does not publish a package, configure npm permissions or switch the product main branch.
+Use two manual Actions entries: **Motion candidate build**, then **Motion npm publication**. The daily flow is **build → optional local testing → manual publish**. Neither entry runs on pushes, PR merges, tags or a schedule. The entries are registered on `main`; Motion application development stays on `feature/motion`. Merging a workflow change does not publish a package, configure npm permissions or switch the product main branch.
| Operator step | Automated work |
| --- | --- |
-| Build: select `feature/motion`, normally leave version empty | Freeze the current `feature/motion` SHA, check/build/scan once, retain the candidate and show download/install instructions |
+| Build: select `feature/motion` and channel; leave test version empty or enter a stable version | Freeze the current `feature/motion` SHA and template environment, check/build/scan once, retain the candidate and show download/install instructions |
| Optional local testing | Use `candidate-install.md` and the local tgz in an isolated host; retain completed `acceptance.md` internally |
-| Publish: enter the exact candidate version | Find the unique candidate automatically, verify its source/hashes, publish the same tgz under `candidate`, advance npm `test`, archive snapshots and update the default guide; native installation checks run afterward |
+| Publish: select the same channel and enter the exact candidate version | Find the unique candidate, verify source/hashes and publish the same tgz. Test advances `test` before non-blocking native checks; stable requires both native checks before `latest`. Archive snapshots and update the corresponding guide last |
-**No acceptance checkbox or manual testing gate is required.** Starting the trusted manual workflow authorizes the selected test publication. The operator receipt records who started it and the candidate identity; it does not claim human acceptance. Automated source, hash and scan checks remain mandatory. Native installation checks run after publication and report warnings without blocking delivery.
+**No acceptance checkbox or manual testing gate is required.** Starting the trusted manual workflow authorizes the selected channel publication. The operator receipt records who started it and the candidate identity; it does not claim human acceptance. Automated source, hash and scan checks remain mandatory. Native checks report warnings after test delivery; stable requires both to pass before `latest` and the default prod guide can advance.
-New public test packages use **DEV templates**; stable packages use prod. The `dev` URL path selects the test software channel, whose newly built packages now embed DEV configuration. Package visibility does not grant DEV network access or authorization; no private catalog snapshot or credential is embedded. Existing prod-based test versions are immutable and remain unchanged. Stable publication, npm `latest` promotion and Skills marketplace/platform upload are separate follow-ups; the five Skills are only included in the npm application and registered locally.
+New public test packages use **DEV templates**; stable packages use prod. The `dev` URL path selects the test software channel, whose newly built packages now embed DEV configuration. Package visibility does not grant DEV network access or authorization; no private catalog snapshot or credential is embedded. Existing prod-based test versions are immutable and remain unchanged. Stable uses an explicit version and prod configuration in these same entries. Skills marketplace/platform upload remains outside this flow; the five Skills are included in the npm application and registered locally.
## First-time administrator setup
-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. For candidate build, test publication and snapshot recovery, select **Use workflow from: feature/motion**. Selecting `main`, `legacy`, a tag or another feature/fix branch fails explicitly before checkout or release work. Older valid candidates built from `main` remain readable; new operations execute the reviewed controls on `feature/motion`. Application source always comes from a commit integrated into `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).
+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. For candidate build, npm publication and snapshot recovery, select **Use workflow from: feature/motion**. Selecting `main`, `legacy`, a tag or another feature/fix branch fails explicitly before checkout or release work. Older valid candidates built from `main` remain readable; new operations execute the reviewed controls on `feature/motion`. Application source always comes from a commit integrated into `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:
@@ -24,7 +24,7 @@ Register these files together:
Protect changes to the trusted control files and `feature/motion`; keep default-branch registration aligned. There is no `motion-test-publish` GitHub Environment prerequisite or Review deployments step in this version.
-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** plus **Allow npm dist-tag**. The latter is separately required to advance `test` after registry propagation; enabling publish alone is insufficient. 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; credentialed npm jobs explicitly install npm 11.21.2 for OIDC dist-tag support and `id-token: write`; no stored npm token is needed. The recovery caller never calls npm publish or dist-tag. npm does not support a dist-tag dry-run; do not test that command against the real registry without channel-write authorization. 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** plus **Allow npm dist-tag**. The latter is separately required to advance `test` or `latest` after registry propagation; enabling publish alone is insufficient. 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; credentialed npm jobs explicitly install npm 11.21.2 for OIDC dist-tag support and `id-token: write`; no stored npm token is needed. The recovery caller never calls npm publish or dist-tag. npm does not support a dist-tag dry-run; do not test that command against the real registry without channel-write authorization. See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/).
Reuse the existing R2 settings. Only the final snapshot step receives the storage credentials:
@@ -37,7 +37,7 @@ Reuse the existing R2 settings. Only the final snapshot step receives the storag
## 1. Build
-Open **Actions → Motion candidate build → Run workflow**, select **`feature/motion`**, leave **version** empty and run. Use this same branch for publication and recovery; `main` only registers the manual Actions entries.
+Open **Actions → Motion candidate build → Run workflow**, select **`feature/motion`** and a **channel**. For `test`, normally leave **version** empty. For `stable`, enter an explicit new version such as `0.6.4` (no suffix); empty or mismatched versions fail before building. Use this same branch for publication and recovery; `main` only registers the manual Actions entries.
An empty version uses the frozen Motion source's `package.json`, increments its patch and appends a short `-test.N`. `N` is the candidate workflow's `GITHUB_RUN_NUMBER` plus **5**: candidate run #1 used the retired long format, and run #2 continues after historical `test.6` as **`0.6.4-test.7`**, then run #3 produces **`0.6.4-test.8`**. Failed builds and explicit overrides still consume run numbers, so gaps are expected. A rerun adds its attempt only after the first attempt, for example `0.6.4-test.7.2`; start a new build if an older rerun is rejected by the no-regression check. Do not reset or move the workflow file without reviewing this numbering offset. Full run ID, attempt and source SHA remain in candidate.json and acceptance.md. See [GitHub run variables](https://docs.github.com/en/actions/reference/workflows-and-actions/variables).
@@ -47,7 +47,7 @@ To override numbering, enter a new `MAJOR.MINOR.PATCH-test.N[.N]`. Do not reuse
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 DEV 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 build scans tracked source before dependency installation, runs the technical checks/Studio regression/eleven-Tool ZIP E2E, builds the final channel-specific 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 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`.
@@ -67,11 +67,11 @@ Keep completed evidence against the generated candidate identity. Do not edit/re
## 3. Publish the candidate version
-Open **Actions → Motion test publication → Run workflow**, select **`feature/motion`**, enter the exact candidate **version**, and click **Run workflow**. No acceptance checkbox or later independent approval dialog is required.
+Open **Actions → Motion npm publication → Run workflow**, select **`feature/motion`**, choose the same **channel** as the build, enter the exact candidate **version**, and click **Run workflow**. The workflow filename remains `motion-publish-test.yml`, so existing npm trust is reused. `test` is the default; stable must be selected explicitly. No acceptance checkbox or later independent approval dialog is required.
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` or `feature/motion` in this repository. Missing, ambiguous, expired or failed candidates stop instead of choosing a different run. Copy the exact version from the successful build summary. Entering `0.6.4-test.7` cannot rename an existing `0.6.4-test.42818506484.1` candidate: build `test.7` separately and accept its new bytes first. 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 publication action are retained in `authorization.json`.
-It then automatically:
+For **test**, it then automatically:
1. Publishes only the accepted tgz with `--tag candidate --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. Advances npm `test` in a separate npm-OIDC-only job. Registry version/tag propagation is polled for up to ten minutes; a successful tag write is not repeated while waiting. Identical retries do not retag, and newer versions are never regressed.
@@ -81,13 +81,26 @@ It then automatically:
OIDC authenticates the publisher. Automatic npm provenance remains disabled because the trusted publication workflow SHA may differ from the selected prebuilt application source SHA. Candidate/manifest/lock/hash records provide traceability, not a signed build attestation.
+### Stable publication
+
+Before dispatch, complete [stable acceptance](release-guide.md#stable-acceptance) against the exact new stable tgz, including prod templates, real Agent use and human playback. No new checkbox enforces that work; the operator remains responsible for it. Changing a test version to a stable version changes bytes and requires a new candidate build and acceptance.
+
+With `channel=stable`, the workflow:
+
+1. Publishes the exact prod tgz under **`stage`** (or verifies identical existing bytes). This is already a **public npm version**; `stage` is a temporary tag, not access control. An older version than current `latest` is rejected at publication entry.
+2. Runs macOS ARM64 and Windows x64 anonymous exact-version cold installs, native preparation, repeat setup, MCP/Skills and resource discovery. The same version/source/hash and prod defaults must match in both reports. Either failure blocks `latest` and the default stable guide; the stage version remains public for diagnosis. These jobs do not test the live prod template catalog, a model turn or human playback.
+3. Uses a separate npm-OIDC-only job to advance **`latest`** after both reports pass, with bounded metadata propagation waits. Stable publication does not move **`test`**. The checked version can be rechecked using the read-only installation workflow.
+4. Archives immutable prod snapshots and release identity, including both native reports, then verifies public bytes and advances **`/open-motion/install.md`** last. Its commands use `@latest`; **`/open-motion/<version>/install.md`** stays pinned. The snapshot job has only R2 credentials, no npm OIDC.
+
+npm and R2 cannot commit atomically. If native checks fail, rerun the failed jobs after diagnosing infrastructure; changed application bytes need a new version. If R2 fails after `latest` advances, use the same publication run’s failed-job retry to finish updating the guide. Snapshot-only recovery never updates the moving guide. There is no automatic tag rollback. Do not mistake a historical prerelease on `latest` for an accepted stable fallback; before the first stable release there may be no stable rollback version. Channel rollback requires separate authorization and a verified compatible version.
+
## Independent installation rechecks
-Use **Motion installation check** (`motion-install-check.yml`) to check an existing public test version without starting publication. After its manual entry is registered on the default branch, select `feature/motion`, enter the exact version, and run. This entry has only `contents: read` and `actions: read`; it has no npm OIDC or R2 credentials and cannot publish, move tags or write install.md. Only candidate resolution receives the read-only GitHub token; installed consumer processes receive an allowlisted environment and isolated application/data/Skills/host directories.
+Use **Motion installation check** (`motion-install-check.yml`) to check an existing public test or stable version without starting publication. After its manual entry is registered on the default branch, select `feature/motion`, enter the exact version, and run. This entry has only `contents: read` and `actions: read`; it has no npm OIDC or R2 credentials and cannot publish, move tags or write install.md. Only candidate resolution receives the read-only GitHub token; installed consumer processes receive an allowlisted environment and isolated application/data/Skills/host directories.
-The workflow verifies the original successful candidate's ZIP/file hashes and integrated source, then downloads the exact npm bytes on macOS ARM64 and Windows x64. It checks fresh/repeated setup, unrelated MCP-setting preservation, DEV configuration, Chromium/FFmpeg/ffprobe preparation, eleven Tools, five Skills and resources. Both platforms complete independently (`fail-fast: false`). Metadata/tarball requests retry 404/408/429/5xx and transient network errors for up to 15 minutes per request. Authorization errors, malformed metadata and hash mismatches fail immediately. A failed retry cannot retain an old successful download report.
+The workflow verifies the original successful candidate's ZIP/file hashes and integrated source, then downloads the exact npm bytes on macOS ARM64 and Windows x64. It checks fresh/repeated setup, unrelated MCP-setting preservation, the version’s DEV/prod configuration, Chromium/FFmpeg/ffprobe preparation, eleven Tools, five Skills and resources. Both platforms complete independently (`fail-fast: false`). Metadata/tarball requests retry 404/408/429/5xx and transient network errors for up to 15 minutes per request. Authorization errors, malformed metadata and hash mismatches fail immediately. A failed retry cannot retain an old successful download report.
-Read each platform's job summary and `installation-<platform>-<run>-<attempt>` artifacts. Failure stays visible in this independent run and cannot resume publishing. The existing post-publication jobs still run and remain non-blocking. Reports record the tested package source/SHA256 separately from the check-code SHA; registry download alone does not certify native installation. Real model creation, template service access, Windows 11 desktop behavior and human playback remain separate acceptance checks.
+Read each platform's job summary and `installation-<platform>-<run>-<attempt>` artifacts. Failure stays visible in this independent run and cannot resume publishing. The existing test post-publication jobs still run and remain non-blocking; stable checks gate latest. Reports record the tested package source/SHA256 separately from the check-code SHA; registry download alone does not certify native installation. Real model creation, template service access, Windows 11 desktop behavior and human playback remain separate acceptance checks.
A same-repository PR changing this workflow, registry helpers or their tests runs the fixed test.7 regression case without publication; fork PRs are skipped. This PR regression must be refreshed before its original candidate artifact expires. Production operation requires the separately reviewed default-branch entry registration; this change does not register or run anything on main.
@@ -98,22 +111,22 @@ A same-repository PR changing this workflow, registry helpers or their tests run
| Test software, DEV templates | `/open-motion/dev/install.md` | `/open-motion/dev/<version>/install.md` |
| Stable software, prod templates | `/open-motion/install.md` | `/open-motion/<version>/install.md` |
-This 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.
+Stable uses the prod paths above and npm `latest`; test keeps the DEV paths and npm `test`. Existing legacy `/versions/<version>/install.md` objects remain immutable.
-Each test version archives the exact tgz, manifests, generated blank acceptance checklist, both installation guides, scans, candidate identity, the schema-2 release record; later platform reports are retained as Actions artifacts. 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. `test-promotion.json` retains the prior tag, exact package, promotion outcome. The immutable release record includes channel verification and template environment, and marks native checks as post-publication. Snapshot recovery preserves a prior immutable release record while retaining its own fresh operator authorization in its attempt artifact.
+Each version archives the exact tgz, manifests, generated blank acceptance checklist, both installation guides, scans, candidate identity, the schema-2 release record; later platform reports are retained as Actions artifacts. 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. `test-promotion.json` retains the prior tag, exact package, promotion outcome. The immutable release record includes channel verification and template environment. Test marks native checks as post-publication; stable records both matching native reports and their hashes as `passed-before-latest`. These reports explicitly retain unrun model/human checks. Snapshot recovery preserves a prior immutable release record while retaining its own fresh operator authorization in its attempt artifact.
-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.
+Builds have no publication lock, so another version can build during acceptance. Test/stable 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. 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 clicking publish: building, downloading and testing publish nothing. Discard an unwanted candidate. Fix code under a new version when bytes change.
-- After clicking publish: the exact version and `candidate` tag are public even before native validation. Native checks run after publication. Once tag readback passes, `test` can advance before R2 finishes; if R2 fails it points to a verified version while the guide can remain on the previous version. npm and R2 are not one transaction. Inspect retained npm state and release-attempt/publication files; do not rebuild or blindly republish.
+- After clicking publish for test: the exact version and `candidate` tag are public even before native validation. Native checks run after publication. Once tag readback passes, `test` can advance before R2 finishes; if R2 fails it points to a verified version while the guide can remain on the previous version. npm and R2 are not one transaction. 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 `feature/motion`, enter the existing candidate version and start snapshot-only recovery. It requires an already published identical npm version, fills missing immutable snapshots and subsequently runs native checks. It never builds, publishes npm, moves npm tags or accesses the moving guide. Missing/expired/ambiguous candidates stop.
+- **Motion snapshot recovery** is a separate maintenance entry. Select `feature/motion`, choose the channel, enter the existing candidate version and start snapshot-only recovery. It requires an already published identical npm version. Test fills missing immutable snapshots and subsequently runs native checks; stable checks both exact prod installations before filling 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.
+- An unexpected npm tag change stops promotion; a newer accepted stable version is preserved and only the older version snapshot is archived. This workflow does not silently repair tags. Channel rollback is a separate reviewed operation and does not downgrade installed clients or restore their data.
Source/package scans are not a scan of every historical Git object or business classification of all binary assets; reviewers still check content, dependencies, licenses and telemetry boundaries. The historical `0.6.4-test.6` predates these candidate records: do not invent a trusted run for it or republish it to fill this format.
diff --git a/docs/templates/candidate-install.md b/docs/templates/candidate-install.md
index 8777a918..6ec66377 100644
--- a/docs/templates/candidate-install.md
+++ b/docs/templates/candidate-install.md
@@ -1,6 +1,6 @@
# 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 DEV templates. The source address is public configuration; access still requires the DEV service network/authentication. The package contains no private catalog snapshot or credentials.
+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. This candidate defaults to **{{TEMPLATE_ENVIRONMENT}} templates** (test uses DEV; stable uses prod). The source address is public configuration; service access still requires the appropriate network/authentication. The package contains no private catalog snapshot or credentials.
## Frozen identity
@@ -20,7 +20,7 @@ This is a **local candidate installation guide**. It installs the complete `{{TG
```
Replace `HOST` with `codex`, `claude`, `deepseek` or `workbuddy`. Carry the explicit `--home`, `--data-dir`, `--skills-dir` and host-specific options from the platform recipe. Setup starts checked video-component downloads in the background. Do not run or wait for prepare to connect MCP, create/edit projects or open ordinary preview. 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, DEV 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.
+4. Follow this host's discovery/reload action. Verify the actual application version, **{{TEMPLATE_ENVIRONMENT}} 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.
Report installation/host loading and video-component readiness separately. Installation alone does not authorize creating a video or exporting an MP4.
diff --git a/docs/templates/release-record.md b/docs/templates/release-record.md
index 5396bce0..ab87d1df 100644
--- a/docs/templates/release-record.md
+++ b/docs/templates/release-record.md
@@ -39,13 +39,13 @@ 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):
-- 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.
+- The release operator selects the matching test/stable channel and this exact version in Motion npm publication. No acceptance checkbox or independent approval environment is enabled; the operator remains responsible for completing required stable checks before dispatch. Record failures and unrun checks honestly.
## Publication follow-up
- Publication run / npm exact version / registry hash and integrity:
- Native registry cold-install report per platform, including embedded/installed template environment:
-- Verified npm test promotion / prior test version / promotion run:
+- Verified npm test/latest promotion / prior channel version / promotion run:
- Immutable R2 version / release-record / guide URL and verified hash:
- Default entry / previous entry / final publication phase:
- Failure, recovery or user feedback:
diff --git a/tests/npm-package.test.ts b/tests/npm-package.test.ts
index d4dbfdd4..1638ef1c 100644
--- a/tests/npm-package.test.ts
+++ b/tests/npm-package.test.ts
@@ -17,7 +17,9 @@ test('shared Agent instructions keep the release controls synchronized', async (
return text.split('## Candidate and publication controls\n')[1].split('\n## ')[0].trim();
};
const shared = await section('AGENTS.md');
- assert(shared.includes('DEV template defaults') && shared.includes('Publish under `candidate` first') && shared.includes('cold installs run afterward as non-blocking checks'));
+ assert(shared.includes('test` (default, DEV templates)') && shared.includes('stable` (prod templates)'));
+ assert(shared.includes('Test publishes under `candidate`') && shared.includes('non-blocking Mac/Windows cold installs'));
+ assert(shared.includes('Stable publishes publicly under `stage`') && shared.includes('requires both exact prod cold installs to pass'));
assert.equal(await section('CLAUDE.md'), shared, 'CLAUDE.md must mirror the AGENTS.md release controls');
});
diff --git a/tests/release-fixture.mjs b/tests/release-fixture.mjs
index c8db4ded..df212671 100644
--- a/tests/release-fixture.mjs
+++ b/tests/release-fixture.mjs
@@ -5,19 +5,20 @@ import { fileURLToPath } from 'node:url';
import { runFile, sha256, writeJSON } from '../scripts/runtime-assets.mjs';
import { sealCandidate, repository, candidateWorkflow, publicationWorkflow, authorizationReceipt } from '../.github/scripts/motion-release.mjs';
-export async function candidateFixture(t, branch = 'main') {
+export async function candidateFixture(t, branch = 'main', options = {}) {
const work = await mkdtemp(path.join(os.tmpdir(), 'motion-release-test-'));
t.after(() => rm(work, { recursive: true, force: true }));
const root = fileURLToPath(new URL('../', import.meta.url)), build = path.join(work, 'build'), directory = path.join(work, 'candidate');
- const commit = (await runFile('git', ['rev-parse', 'HEAD'], { cwd: root })).trim(), version = '0.6.4-test.99';
+ const commit = (await runFile('git', ['rev-parse', 'HEAD'], { cwd: root })).trim(), version = options.version || '0.6.4-test.99';
+ const channel = version.includes('-test.') ? 'test' : 'stable', templateEnvironment = channel === 'test' ? 'dev' : 'prod';
const app = path.join(work, 'app'), pkg = path.join(work, 'package');
await mkdir(path.join(app, 'scripts'), { recursive: true }); await mkdir(path.join(app, 'shared')); await mkdir(path.join(pkg, 'payload'), { recursive: true }); await mkdir(build);
await writeJSON(path.join(app, 'package.json'), { version }); await writeJSON(path.join(app, 'package-lock.json'), {});
await writeJSON(path.join(app, 'scripts/runtime-lock.json'), {});
- await writeJSON(path.join(app, 'shared/template-config.json'), { environment: 'dev' });
- const application = path.join(pkg, 'payload', `openmotion-application-${version}-dev.tar.gz`);
+ await writeJSON(path.join(app, 'shared/template-config.json'), { environment: templateEnvironment });
+ const application = path.join(pkg, 'payload', `openmotion-application-${version}-${templateEnvironment}.tar.gz`);
await runFile('tar', ['-czf', application, '-C', app, '.']);
- const manifest = { schemaVersion: 1, version, format: 'npm', templateEnvironment: 'dev', commit,
+ const manifest = { schemaVersion: 1, version, format: 'npm', templateEnvironment, commit,
application: { url: './' + path.basename(application), sha256: await sha256(application) },
locks: { npm: await sha256(path.join(app, 'package-lock.json')), native: await sha256(path.join(app, 'scripts/runtime-lock.json')) },
runtime: { targets: { mac: { platform: 'darwin', arch: 'arm64', minimumOS: '26.0' } } } };
@@ -27,19 +28,19 @@ export async function candidateFixture(t, branch = 'main') {
await runFile('tar', ['-czf', tgz, '-C', work, 'package']);
await writeJSON(path.join(build, 'release-npm.json'), { ...manifest, installer: { url: './' + path.basename(tgz), sha256: await sha256(tgz) } });
for (const name of ['source-scan.json', 'package-scan.json']) await writeJSON(path.join(build, name), { status: 'passed' });
- const env = { MOTION_SOURCE_SHA: commit, MOTION_VERSION: version, GITHUB_SHA: 'b'.repeat(40),
+ const env = { MOTION_RELEASE_CHANNEL: channel, MOTION_SOURCE_SHA: commit, MOTION_VERSION: version, GITHUB_SHA: 'b'.repeat(40),
GITHUB_WORKFLOW_REF: `${repository}/${candidateWorkflow}@refs/heads/${branch}`, GITHUB_RUN_ID: '123', GITHUB_RUN_ATTEMPT: '1' };
const candidate = await sealCandidate(build, directory, root, env);
const provenance = { head_branch: branch, head_sha: env.GITHUB_SHA, runId: 123, attempt: 1 };
await writeJSON(path.join(directory, 'provenance.json'), provenance);
- const inputs = { action: 'publish-test', version, expectedSHA256: candidate.tgzSHA256 };
+ const inputs = { action: 'publish-' + channel, channel, version, expectedSHA256: candidate.tgzSHA256 };
const publicationEnv = { GITHUB_REPOSITORY: repository, GITHUB_EVENT_NAME: 'workflow_dispatch', GITHUB_REF: 'refs/heads/feature/motion',
GITHUB_RUN_ID: '800', GITHUB_SHA: env.GITHUB_SHA, GITHUB_WORKFLOW_REF: `${repository}/${publicationWorkflow}@refs/heads/feature/motion`,
- MOTION_VERSION: version, MOTION_RELEASE_ACTION: 'publish-test' };
+ MOTION_VERSION: version, MOTION_RELEASE_CHANNEL: channel, MOTION_RELEASE_ACTION: inputs.action };
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', templateEnvironment: 'dev', platform, version, sourceCommit: commit, tgzSHA256: candidate.tgzSHA256,
+ status: 'passed', templateEnvironment, 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' });
diff --git a/tests/release-workflows.test.mjs b/tests/release-workflows.test.mjs
index 5e71d92a..417ac977 100644
--- a/tests/release-workflows.test.mjs
+++ b/tests/release-workflows.test.mjs
@@ -24,7 +24,7 @@ test('manual entry and source selection reject untrusted callers, mutable refs a
assert.equal(releaseInputs({ ...recovery, MOTION_RELEASE_ACTION: 'archive-only' }).action, 'archive-only');
let called = false;
await validateSource('.', 'a'.repeat(40), '0.6.4-test.7', async (_, args) => { called = true; assert(args.includes('refs/remotes/origin/feature/motion')); }); assert(called);
- for (const [sha, version] of [['main', '0.6.4-test.7'], ['a'.repeat(40), '0.6.4'], ['a'.repeat(40), '0.6.4-test.0']]) await assert.rejects(validateSource('.', sha, version, async () => { throw Error('must not run'); }));
+ for (const [sha, version] of [['main', '0.6.4-test.7'], ['a'.repeat(40), '0.6.4-test.0']]) await assert.rejects(validateSource('.', sha, version, async () => { throw Error('must not run'); }));
await assert.rejects(validateSource('.', 'a'.repeat(40), '0.6.4-test.7', async () => { throw Error('not integrated'); }), /not integrated/);
const buildEnv = { ...valid, GITHUB_SHA: 'a'.repeat(40), GITHUB_WORKFLOW_REF: `${repository}/${candidateWorkflow}@refs/heads/feature/motion` };
const resolved = await resolveCandidate('.', '', '0.6.4-test.7', buildEnv, async (_, args) => { assert.notEqual(args[0], 'rev-parse'); });
@@ -228,7 +228,7 @@ test('partial publication retries use the retained producer artifact IDs across
assert(jobs[id].includes(' id: artifact\n'));
}
for (const id of ['npm', 'registry-mac', 'registry-windows', 'promote-test', 'snapshot']) {
- assert(jobs[id].includes('if: ${{ always() && !cancelled() && needs.verify.result'), 'Successful retained producers must still supply partial retry consumers: ' + id);
+ assert(jobs[id].includes('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']);
@@ -239,8 +239,8 @@ test('partial publication retries use the retained producer artifact IDs across
assert(jobs.snapshot.includes('needs: [verify, npm, promote-test]'));
assert(!jobs['promote-test'].includes('needs.registry-'));
for (const id of ['registry-mac', 'registry-windows']) {
- assert(jobs[id].includes('needs: [verify, snapshot]'));
- assert(jobs[id].includes('continue-on-error: true'));
+ assert(jobs[id].includes('needs: [verify, npm, snapshot]'));
+ assert(jobs[id].includes("continue-on-error: ${{ inputs.channel != 'stable' }}"));
}
assert(jobs['promote-test'].includes('id-token: write') && !jobs.snapshot.includes('id-token: write'));
assert(jobs['promote-test'].includes('[email protected]'));
@@ -279,7 +279,8 @@ test('daily build and publication are separate manual entries without an indepen
assert(guard.includes("exit 1"));
}
assert(recovery.includes('needs: select-ref'));
- assert(build.includes('--template-env=dev') && !build.includes('--template-env=prod'));
+ assert(build.includes('--template-env="$MOTION_TEMPLATE_ENVIRONMENT"'));
+ assert(build.includes("inputs.channel == 'stable' && 'prod' || 'dev'"));
assert(build.includes('tests/native-runtime.test.ts'), 'Candidate checks include the integrated native-preparation regression');
assert(build.includes('HYPERFRAMES_BROWSER_PATH: /usr/bin/google-chrome') && build.includes('\"$HYPERFRAMES_BROWSER_PATH\" --version'));
assert(!/apt-get install[^\n]*\bchromium\b/.test(build), 'Candidate builds must not install Ubuntu desktop snaps');
diff --git a/tests/stable-release.test.mjs b/tests/stable-release.test.mjs
new file mode 100644
index 00000000..a11c7af4
--- /dev/null
+++ b/tests/stable-release.test.mjs
@@ -0,0 +1,101 @@
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { readFile, writeFile } from 'node:fs/promises';
+import path from 'node:path';
+import { candidateFixture } from './release-fixture.mjs';
+import { releaseInputs, resolveCandidate, sealCandidate, publishNpm, promoteStable, promoteTest, archiveRelease } from '../.github/scripts/motion-release.mjs';
+
+const config = { endpoint: 'https://example.r2.cloudflarestorage.com', bucket: 'example-releases', publicOrigin: 'https://download.example.invalid' };
+
+function services(f) {
+ let published = false, latest = '0.5.0';
+ const writes = [], objects = new Map();
+ const registry = () => Response.json({ versions: published ? { [f.candidate.version]: { dist: { integrity: f.candidate.integrity } } } : {},
+ 'dist-tags': { test: '0.6.4-test.8', latest } });
+ const fetcher = async url => String(url).includes('registry.npmjs.org') ? registry() : new Response(objects.get(new URL(url).pathname.slice(1)) || '', { status: objects.has(new URL(url).pathname.slice(1)) ? 200 : 404 });
+ const run = async (command, args) => {
+ if (command === 'npm') {
+ writes.push(args);
+ if (args[0] === 'publish') { assert.equal(args[args.indexOf('--tag') + 1], 'stage'); published = true; }
+ else { assert.equal(args[3], 'latest'); latest = f.candidate.version; }
+ return '';
+ }
+ assert.equal(command, 'aws');
+ const op = args[args.indexOf('s3api') + 1], key = args[args.indexOf('--key') + 1];
+ if (op === 'get-object') {
+ if (!objects.has(key)) throw Error('NoSuchKey');
+ await writeFile(args.at(-1), objects.get(key)); return '{"ETag":"etag"}';
+ }
+ assert.equal(op, 'put-object'); assert(args.includes('--if-none-match') || args.includes('--if-match'));
+ objects.set(key, await readFile(args[args.indexOf('--body') + 1])); return '{}';
+ };
+ return { run, fetcher, env: f.env, writes, objects, setLatest: value => { latest = value; }, getLatest: () => latest };
+}
+
+test('stable selection is explicit and rejects prerelease/prod or stable/DEV channel mismatches', async t => {
+ const f = await candidateFixture(t, 'feature/motion', { version: '0.6.4' });
+ assert.equal(releaseInputs(f.env).channel, 'stable');
+ for (const patch of [{ MOTION_RELEASE_CHANNEL: 'test' }, { MOTION_VERSION: '0.6.4-test.9' }, { MOTION_RELEASE_ACTION: 'publish-test' }]) assert.throws(() => releaseInputs({ ...f.env, ...patch }));
+ await assert.rejects(resolveCandidate('.', '', '', { ...f.env, GITHUB_WORKFLOW_REF: f.env.GITHUB_WORKFLOW_REF.replace('motion-publish-test', 'motion-candidate') }, async () => {}), /exact stable version/);
+ await assert.rejects(promoteTest(f.directory, f.inputs), /channel/);
+ assert.equal(f.candidate.version, '0.6.4');
+ const guide = JSON.parse(await readFile(path.join(f.directory, 'install-record.json')));
+ assert.equal(guide.templateEnvironment, 'prod'); assert.equal(guide.channel, 'stable');
+ assert((await readFile(path.join(f.directory, 'candidate-install.md'), 'utf8')).includes('**prod template environment**'));
+ await writeFile(path.join(f.build, 'release-npm.json'), JSON.stringify({ ...f.manifest, templateEnvironment: 'dev' }));
+ await assert.rejects(sealCandidate(f.build, path.join(f.work, 'wrong-environment'), f.root, {
+ ...f.env, MOTION_SOURCE_SHA: f.candidate.sourceCommit,
+ }), /Template defaults must match/);
+});
+
+test('stable stage, native acceptance, latest and exact/prod guides use the same immutable bytes', async t => {
+ const f = await candidateFixture(t, 'feature/motion', { version: '0.6.4' }), store = services(f);
+ await publishNpm(f.directory, f.inputs, store);
+ assert.equal(store.getLatest(), '0.5.0');
+ const native = path.join(f.directory, 'registry-win32-x64.json'), original = await readFile(native, 'utf8');
+ for (const patch of [{ status: 'failed' }, { templateEnvironment: 'dev' }, { tgzSHA256: '0'.repeat(64) }, { nativePreparation: 'failed' }, { resources: 'failed' }]) {
+ await writeFile(native, JSON.stringify({ ...JSON.parse(original), ...patch }));
+ await assert.rejects(promoteStable(f.directory, f.inputs, store)); assert.equal(store.getLatest(), '0.5.0');
+ assert.equal(store.writes.length, 1, 'Only stage publication has occurred');
+ }
+ await writeFile(native, original);
+ assert.equal((await promoteStable(f.directory, f.inputs, store)).status, 'promoted');
+ assert.equal(store.getLatest(), '0.6.4');
+ await archiveRelease(f.directory, f.inputs, config, store);
+ const exact = store.objects.get('open-motion/0.6.4/install.md').toString();
+ const moving = store.objects.get('open-motion/install.md').toString();
+ assert(exact.includes('@openmotion/[email protected]')); assert(moving.includes('@openmotion/app@latest'));
+ assert(![...store.objects.keys()].some(key => key.startsWith('open-motion/dev/')));
+ const record = JSON.parse(store.objects.get('open-motion/0.6.4/release-record.json'));
+ assert.equal(record.nativeChecks, 'passed-before-latest'); assert.equal(record.platformVerification.length, 2);
+ await publishNpm(f.directory, f.inputs, store); await promoteStable(f.directory, f.inputs, store); await archiveRelease(f.directory, f.inputs, config, store);
+ assert.equal(store.writes.length, 2, 'Retry does not republish or move latest again');
+});
+
+test('stable recovery never publishes, changes tags or touches the moving guide; newer latest is preserved', async t => {
+ const f = await candidateFixture(t, 'feature/motion', { version: '0.6.4' }), store = services(f);
+ await publishNpm(f.directory, f.inputs, store);
+ store.setLatest('0.7.0');
+ assert.equal((await promoteStable(f.directory, f.inputs, store)).status, 'superseded');
+ await archiveRelease(f.directory, f.inputs, config, store);
+ assert(!store.objects.has('open-motion/install.md')); assert(store.objects.has('open-motion/0.6.4/install.md'));
+ await writeFile(path.join(f.directory, 'authorization.json'), JSON.stringify({ ...f.authorization, action: 'archive-only' }));
+ const inputs = { ...f.inputs, action: 'archive-only' }, before = store.writes.length;
+ await publishNpm(f.directory, inputs, store); await promoteStable(f.directory, inputs, store);
+ await archiveRelease(f.directory, inputs, config, store);
+ assert.equal(store.writes.length, before); assert(!store.objects.has('open-motion/install.md')); assert.equal(store.getLatest(), '0.7.0');
+});
+
+test('stable uses the existing trusted publisher filename and native failures block latest, not test delivery', async () => {
+ const workflow = await readFile(new URL('../.github/workflows/motion-publish-test.yml', import.meta.url), 'utf8');
+ assert(workflow.includes('options: [test, stable]')); assert(!workflow.includes('accepted:') && !workflow.includes('environment:'));
+ assert(workflow.includes(' promote-stable:') && workflow.includes(' stable-snapshot:'));
+ assert(workflow.includes("continue-on-error: ${{ inputs.channel != 'stable' }}"));
+ const stable = workflow.split(' promote-stable:\n')[1].split(' stable-snapshot:')[0];
+ assert(stable.includes('needs.registry-mac.result') && stable.includes('needs.registry-windows.result'));
+ assert(stable.includes('id-token: write') && !stable.includes('secrets.'));
+ const snapshot = workflow.split(' stable-snapshot:\n')[1];
+ assert(!snapshot.includes('id-token: write') && snapshot.includes('CLOUDFLARE_R2_RELEASES_SK'));
+ const candidate = await readFile(new URL('../.github/workflows/motion-candidate.yml', import.meta.url), 'utf8');
+ assert(candidate.includes("inputs.channel == 'stable' && 'prod' || 'dev'"));
+});