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.

fix(release): select Motion directly and shorten candidate versions

罗高b84e0f5cd09c
diff --git a/.github/scripts/motion-release.mjs b/.github/scripts/motion-release.mjs
index af4a41e7..ce070a8b 100644
--- a/.github/scripts/motion-release.mjs
+++ b/.github/scripts/motion-release.mjs
@@ -22,13 +22,17 @@ const exec = promisify(execFile), hashPattern = /^[a-f0-9]{64}$/;
const json = async file => JSON.parse(await readFile(file, 'utf8'));
const integrity = bytes => 'sha512-' + createHash('sha512').update(bytes).digest('base64');
-export function releaseInputs(env = process.env) {
+function manualEntry(env, workflows) {
assert.equal(env.GITHUB_REPOSITORY, repository, 'Wrong repository');
assert.equal(env.GITHUB_EVENT_NAME, 'workflow_dispatch', 'Manual invocation required');
- assert.equal(env.GITHUB_REF, 'refs/heads/main', 'Run the trusted workflow registered on main');
+ assert.equal(env.GITHUB_REF, 'refs/heads/feature/motion', 'Select feature/motion in Run workflow for Motion operations');
+ assert(workflows.some(p => env.GITHUB_WORKFLOW_REF === `${repository}/${p}@refs/heads/feature/motion`), 'Require a trusted manual entry');
+}
+
+export function releaseInputs(env = process.env) {
+ manualEntry(env, [publicationWorkflow, recoveryWorkflow]);
assert(['publish-test', 'archive-only'].includes(env.MOTION_RELEASE_ACTION), 'Unknown release action');
const workflow = env.GITHUB_WORKFLOW_REF;
- assert([publicationWorkflow, recoveryWorkflow].some(p => workflow === `${repository}/${p}@refs/heads/main`), 'Require a trusted manual entry');
if (workflow.includes(recoveryWorkflow)) assert.equal(env.MOTION_RELEASE_ACTION, 'archive-only', 'Recovery never publishes or moves a channel');
if (env.MOTION_EXPECTED_SHA256) assert.match(env.MOTION_EXPECTED_SHA256, hashPattern);
assert.equal(env.MOTION_ACCEPTED, 'true', 'Explicit operator acceptance confirmation is required');
@@ -37,13 +41,15 @@ export function releaseInputs(env = process.env) {
}
export async function resolveCandidate(control, requested, version, env = process.env, run = runFile) {
- const commit = requested || (await run('git', ['rev-parse', 'refs/remotes/origin/feature/motion'], { cwd: control })).trim();
+ manualEntry(env, [candidateWorkflow]);
+ const commit = requested || env.GITHUB_SHA;
assert.match(commit, /^[a-f0-9]{40}$/, 'Use a full immutable source SHA');
if (!version) {
- assert(/^[1-9]\d*$/.test(env.GITHUB_RUN_ATTEMPT || ''), 'A positive GitHub run attempt is required');
- // main still contains the legacy application; read the frozen Motion source instead.
+ assert(/^[1-9]\d*$/.test(env.GITHUB_RUN_NUMBER || '') && /^[1-9]\d*$/.test(env.GITHUB_RUN_ATTEMPT || ''), 'Positive GitHub run and attempt numbers are required');
const source = JSON.parse(await run('git', ['show', `${commit}:package.json`], { cwd: control }));
- version = testVersion(source.version, env.GITHUB_RUN_ID, env.GITHUB_RUN_ATTEMPT);
+ // Continue after historical test.6: candidate run #1 used the retired long format.
+ 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);
return { commit, version };
@@ -126,7 +132,7 @@ export async function recordAuthorization(directory, inputs, fetcher = fetch, en
assert.equal(authorized.action, inputs.action); assert.equal(authorized.version, inputs.version);
const candidate = await verifyDownloaded(directory, inputs.expectedSHA256, inputs.version);
const run = await github(`/actions/runs/${env.GITHUB_RUN_ID}`, fetcher);
- assert.equal(String(run.id), env.GITHUB_RUN_ID); assert.equal(run.head_branch, 'main'); assert.equal(run.event, 'workflow_dispatch');
+ assert.equal(String(run.id), env.GITHUB_RUN_ID); assert.equal(run.head_branch, 'feature/motion'); assert.equal(run.event, 'workflow_dispatch');
assert.equal(run.head_repository?.full_name, repository); assert.equal(run.head_sha, env.GITHUB_SHA);
assert.equal(run.path.split('@')[0], env.GITHUB_WORKFLOW_REF.slice(repository.length + 1).split('@')[0]);
await writeJSON(path.join(directory, 'authorization.json'), authorizationReceipt(candidate, run, inputs.action));
@@ -198,7 +204,7 @@ export async function findCandidate(version, fetcher = fetch) {
const result = await github(`/actions/artifacts?name=${encodeURIComponent(name)}&per_page=100`, fetcher);
assert(result.total_count <= 100, 'Too many matching artifacts; refusing an incomplete lookup');
const matches = result.artifacts.filter(a => a.name === name && !a.expired);
- assert.equal(matches.length, 1, 'Candidate missing, expired or ambiguous; build a new unique version');
+ assert.equal(matches.length, 1, `Expected one unexpired candidate for ${version}; found ${matches.length}. Copy the exact version from a successful Motion candidate build. Changing this publication field cannot rename a candidate; build and accept a new unique version if needed.`);
assert(Number.isSafeInteger(matches[0].workflow_run?.id) && matches[0].workflow_run.id > 0);
return matches[0];
}
@@ -250,7 +256,7 @@ export async function publishNpm(directory, inputs, { fetcher = fetch, run = run
previousLatest: before.tags.latest ?? 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 main SHA is not the prebuilt application's source.
+ // 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/']);
record.status = 'published-awaiting-registry'; await writeJSON(path.join(directory, 'npm-publication.json'), record);
}
diff --git a/.github/workflows/motion-candidate.yml b/.github/workflows/motion-candidate.yml
index 9e0c9b2d..994d0d1f 100644
--- a/.github/workflows/motion-candidate.yml
+++ b/.github/workflows/motion-candidate.yml
@@ -5,12 +5,12 @@ on:
workflow_dispatch:
inputs:
version:
- description: 'Optional override; empty uses next Motion patch-test.<run ID>.<attempt>; build only'
+ description: 'Optional override; empty uses short next Motion patch-test.N (reruns add .attempt); build only'
type: string
required: false
default: ''
source_sha:
- description: 'Optional reviewed full SHA integrated into feature/motion; empty freezes its current head'
+ description: 'Optional reviewed full SHA integrated into feature/motion; empty freezes the selected dispatch commit'
type: string
required: false
default: ''
@@ -21,7 +21,7 @@ permissions:
jobs:
candidate:
name: Build immutable candidate
- if: github.repository == 'nexu-io/html-anything' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feature/motion')
+ if: github.repository == 'nexu-io/html-anything'
runs-on: ubuntu-24.04
timeout-minutes: 45
env:
@@ -32,6 +32,12 @@ jobs:
HYPERFRAMES_FFMPEG_PATH: /usr/bin/ffmpeg
HYPERFRAMES_FFPROBE_PATH: /usr/bin/ffprobe
steps:
+ - name: Require Motion integration branch
+ run: |
+ if [ "$GITHUB_REF" != 'refs/heads/feature/motion' ]; then
+ echo '::error::Select feature/motion in Run workflow for Motion operations.'
+ exit 1
+ fi
- uses: actions/[email protected]
with:
path: control
diff --git a/.github/workflows/motion-publication-recovery.yml b/.github/workflows/motion-publication-recovery.yml
index 42ae95cd..6463a0e3 100644
--- a/.github/workflows/motion-publication-recovery.yml
+++ b/.github/workflows/motion-publication-recovery.yml
@@ -18,8 +18,18 @@ permissions:
actions: read
jobs:
+ select-ref:
+ if: github.repository == 'nexu-io/html-anything'
+ runs-on: ubuntu-24.04
+ steps:
+ - name: Require Motion integration branch
+ run: |
+ if [ "$GITHUB_REF" != 'refs/heads/feature/motion' ]; then
+ echo '::error::Select feature/motion in Run workflow for Motion operations.'
+ exit 1
+ fi
recover:
- if: github.repository == 'nexu-io/html-anything' && github.ref == 'refs/heads/main'
+ needs: select-ref
permissions:
contents: read
actions: read
diff --git a/.github/workflows/motion-publish-test.yml b/.github/workflows/motion-publish-test.yml
index 9b9e26c7..fb20cfbb 100644
--- a/.github/workflows/motion-publish-test.yml
+++ b/.github/workflows/motion-publish-test.yml
@@ -40,13 +40,19 @@ env:
jobs:
verify:
- if: github.repository == 'nexu-io/html-anything' && github.ref == 'refs/heads/main'
+ if: github.repository == 'nexu-io/html-anything'
runs-on: ubuntu-24.04
timeout-minutes: 15
outputs:
artifact_id: ${{ steps.artifact.outputs.artifact-id }}
tgz_sha256: ${{ steps.download.outputs.tgz_sha256 }}
steps:
+ - name: Require Motion integration branch
+ run: |
+ if [ "$GITHUB_REF" != 'refs/heads/feature/motion' ]; then
+ echo '::error::Select feature/motion in Run workflow for Motion operations.'
+ exit 1
+ fi
- uses: actions/[email protected]
with:
ref: ${{ github.sha }}
diff --git a/AGENTS.md b/AGENTS.md
index 0ac96036..01344b6f 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. Download and accept the local tgz using candidate-install.md; keep completed acceptance.md private. The publication operator enters the accepted version and explicitly confirms acceptance, without manually copying hashes. No independent approval environment is enabled at this stage. Public candidates must use an exact reviewed source SHA integrated into `feature/motion`, a new test version and 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 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. Download and accept the local tgz using candidate-install.md; keep completed acceptance.md private. The publication operator enters the accepted version and explicitly confirms acceptance, without manually copying hashes. No independent approval environment is enabled at this stage. Public candidates must use an exact reviewed source SHA integrated into `feature/motion`, a new test version and 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.
Publication uses the accepted candidate bytes, never a rebuild. Publish under `candidate` first; only the credential-isolated promotion job may move npm `test` after both matching DEV native reports pass. 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. 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.
diff --git a/CLAUDE.md b/CLAUDE.md
index 54dd4228..97bc2a97 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -4,7 +4,7 @@ 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. Download and accept the local tgz using candidate-install.md; keep completed acceptance.md private. The publication operator enters the accepted version and explicitly confirms acceptance, without manually copying hashes. No independent approval environment is enabled at this stage. Public candidates must use an exact reviewed source SHA integrated into `feature/motion`, a new test version and 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 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. Download and accept the local tgz using candidate-install.md; keep completed acceptance.md private. The publication operator enters the accepted version and explicitly confirms acceptance, without manually copying hashes. No independent approval environment is enabled at this stage. Public candidates must use an exact reviewed source SHA integrated into `feature/motion`, a new test version and 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.
Publication uses the accepted candidate bytes, never a rebuild. Publish under `candidate` first; only the credential-isolated promotion job may move npm `test` after both matching DEV native reports pass. 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. 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.
diff --git a/docs/npm-installation.md b/docs/npm-installation.md
index 6a9ff14b..dfa76131 100644
--- a/docs/npm-installation.md
+++ b/docs/npm-installation.md
@@ -4,7 +4,7 @@ The npm tgz contains the installer, a prebuilt Motion application archive and it
`@openmotion/[email protected]` is available from npm through the `test` channel. It was published separately after authorization; ordinary CI still does not publish packages. Its anonymous registry download, isolated macOS Codex setup, repeat setup, eleven MCP Tools and five Skills have been verified. Use the exact version for reproduction. See the [delivery record and known limitations](release-guide.md#published-test-candidate-064-test6), including the production template catalog and the registry's unexpected `latest` tag.
-Source `package.json` is the development baseline; the published artifact can have a different version. For example, source `0.6.3` can produce `0.6.4-test.6` without a stable `0.6.4` release. Packaging changes output identities only. Manual [candidate builds](release-workflows.md#1-build) accept an empty version and automatically generate the next patch plus a unique GitHub run ID/attempt; publication keeps the exact accepted version.
+Source `package.json` is the development baseline; the published artifact can have a different version. For example, source `0.6.3` can produce `0.6.4-test.6` without a stable `0.6.4` release. Packaging changes output identities only. Manual [candidate builds](release-workflows.md#1-build) accept an empty version and automatically generate the next patch plus a short `test.N` workflow counter (with an attempt suffix on reruns); publication keeps the exact accepted version.
## Requirements and package contents
diff --git a/docs/product/architecture.md b/docs/product/architecture.md
index 35f97440..c4f1f607 100644
--- a/docs/product/architecture.md
+++ b/docs/product/architecture.md
@@ -266,7 +266,7 @@ 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 → download/accept → publish. Candidate builds can run from feature/motion or main, while publication/recovery remain main-only. The build freezes an integrated Motion source SHA and automatically numbers an empty version as the next source patch plus test.<GitHub run ID>.<attempt>, without rewriting the source baseline; 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 requires explicit operator acceptance. No independent approval environment is enabled; the manual operator receipt is not proof of private tests or independent review. The same tgz is published under npm candidate, checked anonymously on separate Mac/Windows runners, then promoted to test in an npm-OIDC-only job before archiving and conditionally advancing the default guide. Failed native checks leave test unchanged; the exact candidate version is already public. 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 test-publication entries implement build → download/accept → 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 requires explicit operator acceptance. No independent approval environment is enabled; the manual operator receipt is not proof of private tests or independent review. The same tgz is published under npm candidate, checked anonymously on separate Mac/Windows runners, then promoted to test in an npm-OIDC-only job before archiving and conditionally advancing the default guide. Failed native checks leave test unchanged; the exact candidate version is already public. 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).
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.
diff --git a/docs/release-guide.md b/docs/release-guide.md
index 11a999d0..5763995e 100644
--- a/docs/release-guide.md
+++ b/docs/release-guide.md
@@ -65,7 +65,7 @@ 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. After acceptance, run Motion test publication with that exact version and confirm acceptance. Candidate lookup and hashes are automatic; no independent approval environment is enabled. The same accepted bytes receive anonymous native registry checks and immutable snapshots before the moving test guide can advance. Snapshot-only recovery is a separate maintenance entry. The former CI guide-only upload route is removed so it cannot bypass these checks. Ordinary PR CI remains read-only.
+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. After acceptance, run Motion test publication from `feature/motion` with that exact version and confirm acceptance. Candidate lookup and hashes are automatic; no independent approval environment is enabled. The same accepted bytes receive anonymous native registry checks and immutable snapshots before the moving test guide can advance. Snapshot-only recovery is a separate maintenance entry. The former CI guide-only upload route is removed so it cannot bypass these checks. Ordinary PR CI remains read-only.
These manual entries support test versions only. Stable package construction and the stable URL contract exist, but stable candidate/publication, 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.
diff --git a/docs/release-workflows.md b/docs/release-workflows.md
index bfa4b6c4..d8334ad9 100644
--- a/docs/release-workflows.md
+++ b/docs/release-workflows.md
@@ -14,7 +14,7 @@ New public test packages use **DEV templates**; stable packages use prod. The `d
## 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 **Motion candidate build**, select **Use workflow from: feature/motion**; `main` also remains supported. Only these two integrated branches can produce publishable candidates. Publication and snapshot recovery still require **main**; arbitrary feature/fix branches cannot supply a release candidate. 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, 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).
Register these files together:
@@ -22,7 +22,7 @@ Register these files together:
- `.github/scripts/motion-release.mjs`, `motion-scan.mjs`, `motion-registry-smoke.mjs`, `publish-install-guide.mjs` and `.github/gitleaks.toml`.
- `scripts/runtime-assets.mjs`, `release-version.mjs`, `install-guide.mjs`, `docs/install.md`, `docs/templates/release-record.md` and `docs/templates/candidate-install.md`.
-Protect changes to the trusted control files and `main`. There is no `motion-test-publish` GitHub Environment prerequisite or Review deployments step in this version.
+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 native acceptance; 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/).
@@ -37,11 +37,11 @@ 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. `main` remains supported for candidate builds; publication/recovery still run only from `main`.
+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.
-An empty version uses the frozen Motion source's `package.json`, increments its patch and appends `-test.<GITHUB_RUN_ID>.<GITHUB_RUN_ATTEMPT>`. For example, source `0.6.3`, run `42812345678`, attempt `1` produces **`0.6.4-test.42812345678.1`**. The run ID is unique within the repository, and the attempt changes on a rerun. These are unique build identifiers, not consecutive `test.7`, `test.8` counters. See [GitHub run variables](https://docs.github.com/en/actions/reference/variables-reference#default-environment-variables). An older rerun can still be rejected by the existing no-regression publication check; start a new build instead.
+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).
-The checkout version is a development baseline, not the last published package version. Packaging stamps the resolved version into the output package, application, lock and plugin metadata without rewriting source manifests. Thus source `0.6.3` and the historical npm `0.6.4-test.6` can coexist; no stable `0.6.4` is implied. The legacy `main` package version is never used for automatic Motion numbering. After a stable release, maintainers must advance the Motion source baseline for the next patch series.
+The checkout version is a development baseline, not the last published package version. Packaging stamps the resolved version into the output package, application, lock and plugin metadata without rewriting source manifests. Thus source `0.6.3` and the historical npm `0.6.4-test.6` can coexist; no stable `0.6.4` is implied. With `source_sha` empty, source is frozen to `GITHUB_SHA` of the selected `feature/motion` dispatch, even if the branch advances while the run queues. The legacy `main` package version is never used for automatic Motion numbering. After a stable release, maintainers must advance the Motion source baseline for the next patch series.
To override numbering, enter a new `MAJOR.MINOR.PATCH-test.N[.N]`. Do not reuse an existing candidate/published version or choose one older than the current npm `test` channel. Never change bytes under an existing published version. The successful summary and artifact name show the resolved version; copy that exact version into the publication form after accepting its bytes. Publication never generates a new number.
@@ -67,19 +67,19 @@ Keep completed evidence against the generated candidate identity. Do not edit/re
## 3. Publish the accepted version
-Open **Actions → Motion test publication → Run workflow**, select `main`, enter the exact accepted **version**, and tick **accepted** only after its required acceptance passes. Click **Run workflow**. This is the explicit publication action; there is no later independent approval dialog. Leaving the checkbox false fails before any publication.
+Open **Actions → Motion test publication → Run workflow**, select **`feature/motion`**, enter the exact accepted **version**, and tick **accepted** only after its required acceptance passes. Click **Run workflow**. This is the explicit publication action; there is no later independent approval dialog. Leaving the checkbox false fails before any publication.
-The 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. The official ZIP digest, frozen file hashes and source integration are checked; source and package scans run again. The current manual run's actual operator, candidate identity and acceptance confirmation are retained in `authorization.json`.
+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 acceptance confirmation are retained in `authorization.json`.
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. On separate macOS arm64 and Windows x64 runners without publication credentials, anonymously downloads the exact registry version, verifies its hashes, prepares Chromium/FFmpeg/ffprobe, runs isolated setup/repeat setup and checks the eleven Tools/resources and five Skills. These are native technical checks, not real-model or human playback acceptance.
3. In a separate npm-OIDC-only job, requires both successful reports for the same tgz/source and DEV environment before advancing `test`. Verifies the registry result; an identical retry does not retag, and a newer `test` is never regressed.
-4. Archives immutable R2 snapshots and checks canonical public bytes. Only then conditionally advances the default test guide. The snapshot job consumes the operator authorization and both native reports, executes trusted `main` controls and never executes the candidate application.
+4. Archives immutable R2 snapshots and checks canonical public bytes. Only then conditionally advances the default test guide. The snapshot job consumes the operator authorization and both native reports, executes the selected trusted `feature/motion` controls and never executes the candidate application.
5. Shows the exact version, publication phase, versioned installation guide and default guide in the run summary.
-OIDC authenticates the publisher. Automatic npm provenance remains disabled because this trusted control workflow's `main` SHA differs from the selected application source SHA. Candidate/manifest/lock/hash records provide traceability, not a signed build attestation.
+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.
## Versions and records
@@ -101,7 +101,7 @@ Actions artifacts and attempt records expire after **30 days**. R2 snapshots fol
- 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. A failed native check leaves `test` and the default guide unchanged. Once native checks and tag readback pass, `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 `main`, enter the existing candidate version and confirm snapshot-only recovery. It requires an already published identical npm version, repeats native checks and fills missing immutable snapshots. It never builds, publishes npm, moves npm tags or accesses the moving guide. Missing/expired/ambiguous candidates stop.
+- **Motion snapshot recovery** is a separate maintenance entry. Select `feature/motion`, enter the existing candidate version and confirm snapshot-only recovery. It requires an already published identical npm version, repeats native checks and fills missing immutable snapshots. It never builds, publishes npm, moves npm tags or accesses the moving guide. Missing/expired/ambiguous candidates stop.
- Version writes use conditional create and byte comparison. Same bytes resume; different immutable bytes stop. A public readback error blocks promotion. A failure after `fixed-write-attempted` may mean the moving write completed: inspect storage and its canonical URL before retrying.
- An unexpected npm `latest` change stops promotion. This workflow does not silently repair tags. Channel rollback is a separate reviewed operation and does not downgrade installed clients or restore their data.
diff --git a/docs/test-packages.md b/docs/test-packages.md
index 721cda2e..0f590516 100644
--- a/docs/test-packages.md
+++ b/docs/test-packages.md
@@ -19,7 +19,7 @@ MCP 公开入口由包内 `shared/mcp-release.json` 固化,详见[一期注册
Ordinary builds retain candidate installation-guide artifacts for review; they do not publish npm, Release or R2 objects. Separate manual guide publication follows the release guide; 两种格式误勾 `publish` 均会失败。本地构建的制品位于 `dist/`,The tgz alone is sufficient for setup; adjacent application/manifest files are evidence and an explicit-manifest fallback. See [installation](npm-installation.md) and [test/stable acceptance](release-guide.md).
-Explicit builds accept stable `MAJOR.MINOR.PATCH` or `MAJOR.MINOR.PATCH-test.N[.N]`. The shared helper selects next-patch `test.<run>.<attempt>` (for example, 0.6.3 → 0.6.4-test.42.1). The separate [Motion candidate build](release-workflows.md#1-build) accepts `feature/motion` or `main` and uses the repository-wide GitHub run ID/attempt when version is empty, for example `0.6.4-test.42812345678.1`; ordinary check builds retain their workflow-local numbering. Candidate publication uses the accepted version unchanged. All embedded identities agree; output directories cannot be overwritten and source versions do not change. Explicit test npm builds default to DEV and candidate; stable npm builds default to prod and stage. Unversioned and channel/environment-mismatched builds remain private. The backup ZIP builder still defaults to prod unless explicitly selected. Publication remains disabled.
+Explicit builds accept stable `MAJOR.MINOR.PATCH` or `MAJOR.MINOR.PATCH-test.N[.N]`. The shared helper selects next-patch `test.<run>.<attempt>` (for example, 0.6.3 → 0.6.4-test.42.1). The separate [Motion candidate build](release-workflows.md#1-build) runs from `feature/motion` and uses short workflow-counter versions when version is empty, for example `0.6.4-test.7` (rerun `0.6.4-test.7.2`); ordinary check builds retain their workflow-local numbering. Candidate publication uses the accepted version unchanged. All embedded identities agree; output directories cannot be overwritten and source versions do not change. Explicit test npm builds default to DEV and candidate; stable npm builds default to prod and stage. Unversioned and channel/environment-mismatched builds remain private. The backup ZIP builder still defaults to prod unless explicitly selected. Publication remains disabled.
PR / main 工作流执行清单、类型、Studio 构建与回归、安装/打包测试,以及十一个 Tool 的真实 ZIP E2E。Linux 是组装与测试环境,不是已支持的用户运行平台。Mac / Windows 的最终安装和真实出片仍须在对应系统验收;当前 本仓库工作流没有 Windows 或 Mac 原生验收 job,不把产包成功写成通过。
diff --git a/tests/release-fixture.mjs b/tests/release-fixture.mjs
index 8a45aece..c354dccc 100644
--- a/tests/release-fixture.mjs
+++ b/tests/release-fixture.mjs
@@ -33,8 +33,8 @@ export async function candidateFixture(t, branch = 'main') {
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, accepted: true, expectedSHA256: candidate.tgzSHA256 };
- const publicationEnv = { GITHUB_REPOSITORY: repository, GITHUB_EVENT_NAME: 'workflow_dispatch', GITHUB_REF: 'refs/heads/main',
- GITHUB_RUN_ID: '800', GITHUB_SHA: env.GITHUB_SHA, GITHUB_WORKFLOW_REF: `${repository}/${publicationWorkflow}@refs/heads/main`,
+ 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_ACCEPTED: 'true', MOTION_RELEASE_ACTION: 'publish-test' };
const authorization = authorizationReceipt(candidate, { id: 800, run_attempt: 1, actor: { login: 'operator' } }, inputs.action);
await writeJSON(path.join(directory, 'authorization.json'), authorization);
diff --git a/tests/release-workflows.test.mjs b/tests/release-workflows.test.mjs
index aec9ca47..0db9aa77 100644
--- a/tests/release-workflows.test.mjs
+++ b/tests/release-workflows.test.mjs
@@ -12,25 +12,29 @@ import { consumerEnvironment } from '../.github/scripts/motion-registry-smoke.mj
import { runFile } from '../scripts/runtime-assets.mjs';
const config = { endpoint: 'https://example.r2.cloudflarestorage.com', bucket: 'example-releases', publicOrigin: 'https://download.example.invalid' };
-const valid = { GITHUB_REPOSITORY: repository, GITHUB_EVENT_NAME: 'workflow_dispatch', GITHUB_REF: 'refs/heads/main',
- GITHUB_WORKFLOW_REF: `${repository}/${publicationWorkflow}@refs/heads/main`, MOTION_VERSION: '0.6.4-test.99', MOTION_ACCEPTED: 'true', MOTION_RELEASE_ACTION: 'publish-test', MOTION_EXPECTED_SHA256: 'a'.repeat(64) };
+const valid = { GITHUB_REPOSITORY: repository, GITHUB_EVENT_NAME: 'workflow_dispatch', GITHUB_REF: 'refs/heads/feature/motion',
+ GITHUB_WORKFLOW_REF: `${repository}/${publicationWorkflow}@refs/heads/feature/motion`, MOTION_VERSION: '0.6.4-test.99', MOTION_ACCEPTED: 'true', MOTION_RELEASE_ACTION: 'publish-test', MOTION_EXPECTED_SHA256: 'a'.repeat(64) };
const origin = { id: 123, run_attempt: 1, event: 'workflow_dispatch', head_branch: 'main', head_repository: { full_name: repository }, status: 'completed', conclusion: 'success', path: candidateWorkflow, head_sha: 'b'.repeat(40) };
const artifact = { id: 456, name: 'motion-candidate-0.6.4-test.99', workflow_run: { id: 123 }, expired: false, size_in_bytes: 100, digest: 'sha256:' + 'a'.repeat(64) };
test('manual entry and source selection reject untrusted callers, mutable refs and non-test versions', async () => {
assert.equal(releaseInputs(valid).action, 'publish-test');
- for (const [key, value] of Object.entries({ GITHUB_REPOSITORY: 'fork/repo', GITHUB_EVENT_NAME: 'push', GITHUB_REF: 'refs/heads/feature/motion', GITHUB_WORKFLOW_REF: `${repository}/evil.yml@refs/heads/main`, MOTION_EXPECTED_SHA256: 'bad', MOTION_ACCEPTED: 'false', MOTION_VERSION: '0.6.4', MOTION_RELEASE_ACTION: 'stable' })) assert.throws(() => releaseInputs({ ...valid, [key]: value }));
- const recovery = { ...valid, GITHUB_WORKFLOW_REF: `${repository}/${recoveryWorkflow}@refs/heads/main` };
+ for (const [key, value] of Object.entries({ GITHUB_REPOSITORY: 'fork/repo', GITHUB_EVENT_NAME: 'push', GITHUB_REF: 'refs/heads/main', GITHUB_WORKFLOW_REF: `${repository}/evil.yml@refs/heads/feature/motion`, MOTION_EXPECTED_SHA256: 'bad', MOTION_ACCEPTED: 'false', MOTION_VERSION: '0.6.4', MOTION_RELEASE_ACTION: 'stable' })) assert.throws(() => releaseInputs({ ...valid, [key]: value }));
+ const recovery = { ...valid, GITHUB_WORKFLOW_REF: `${repository}/${recoveryWorkflow}@refs/heads/feature/motion` };
assert.throws(() => releaseInputs(recovery), /Recovery/);
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'); }));
await assert.rejects(validateSource('.', 'a'.repeat(40), '0.6.4-test.7', async () => { throw Error('not integrated'); }), /not integrated/);
- const resolved = await resolveCandidate('.', '', '0.6.4-test.7', {}, async (_, args) => args[0] === 'rev-parse' ? 'a'.repeat(40) + '\n' : '');
+ 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'); });
assert.deepEqual(resolved, { commit: 'a'.repeat(40), version: '0.6.4-test.7' });
- await assert.rejects(resolveCandidate('.', 'main', '', {}, async () => { throw Error('must not run'); }), /immutable/);
- for (const env of [{}, { GITHUB_RUN_ID: '42812345678', GITHUB_RUN_ATTEMPT: '0' }, { GITHUB_RUN_ID: 'bad', GITHUB_RUN_ATTEMPT: '1' }]) {
- await assert.rejects(resolveCandidate('.', 'a'.repeat(40), '', env, async () => JSON.stringify({ version: '0.6.3' })), /positive/);
+ await assert.rejects(resolveCandidate('.', 'main', '', buildEnv, async () => { throw Error('must not run'); }), /immutable/);
+ for (const env of [{}, { GITHUB_RUN_NUMBER: '2', GITHUB_RUN_ATTEMPT: '0' }, { GITHUB_RUN_NUMBER: 'bad', GITHUB_RUN_ATTEMPT: '1' }]) {
+ await assert.rejects(resolveCandidate('.', 'a'.repeat(40), '', { ...buildEnv, ...env }, async () => JSON.stringify({ version: '0.6.3' })), /Positive/);
+ }
+ for (const patch of [{ GITHUB_REF: 'refs/heads/main' }, { GITHUB_REF: 'refs/heads/codex/unreviewed' }, { GITHUB_WORKFLOW_REF: `${repository}/${candidateWorkflow}@refs/heads/main` }]) {
+ await assert.rejects(resolveCandidate('.', '', '0.6.4-test.7', { ...buildEnv, ...patch }, async () => { throw Error('Must reject before git'); }));
}
});
@@ -47,14 +51,15 @@ test('candidate CLI numbers the frozen Motion source, not the legacy control che
await writeFile(path.join(directory, 'package.json'), JSON.stringify({ version: '0.1.0' }));
const output = path.join(directory, 'output'), script = fileURLToPath(new URL('../.github/scripts/motion-release.mjs', import.meta.url));
for (const [source, version, run, attempt, expected] of [
- ['', '', '42812345678', '1', '0.6.4-test.42812345678.1'],
- [commit, '', '42812345678', '2', '0.6.4-test.42812345678.2'],
- ['', '', '42812345679', '1', '0.6.4-test.42812345679.1'],
+ ['', '', '2', '1', '0.6.4-test.7'],
+ [commit, '', '2', '2', '0.6.4-test.7.2'],
+ ['', '', '3', '1', '0.6.4-test.8'],
[commit, '0.6.5-test.1', '', '', '0.6.5-test.1'],
]) {
await writeFile(output, '');
await runFile(process.execPath, [script, 'source', directory], { env: { ...process.env, GITHUB_OUTPUT: output,
- MOTION_SOURCE_SHA: source, MOTION_VERSION: version, GITHUB_RUN_ID: run, GITHUB_RUN_ATTEMPT: attempt } });
+ ...valid, GITHUB_SHA: commit, GITHUB_WORKFLOW_REF: `${repository}/${candidateWorkflow}@refs/heads/feature/motion`,
+ MOTION_SOURCE_SHA: source, MOTION_VERSION: version, GITHUB_RUN_ID: '42812345678', GITHUB_RUN_NUMBER: run, GITHUB_RUN_ATTEMPT: attempt } });
assert.equal(await readFile(output, 'utf8'), `source_sha=${commit}\nversion=${expected}\n`);
assert(compareReleaseVersions(expected, '0.6.4-test.6') > 0);
}
@@ -79,12 +84,13 @@ test('version lookup uses the exact artifact name and rejects missing, expired,
for (const artifacts of [[], [{ ...artifact, expired: true }], [artifact, { ...artifact, id: 457 }], [{ ...artifact, workflow_run: {} }]]) {
await assert.rejects(findCandidate('0.6.4-test.99', async () => Response.json({ total_count: artifacts.length, artifacts })));
}
+ await assert.rejects(findCandidate('0.6.4-test.7', async () => Response.json({ total_count: 0, artifacts: [] })), /0\.6\.4-test\.7; found 0[\s\S]*cannot rename/);
await assert.rejects(findCandidate('0.6.4-test.99', async () => Response.json({ total_count: 101, artifacts: [artifact] })), /incomplete/);
});
test('operator authorization requires explicit acceptance and records the actual manual caller without independent approval', async t => {
const f = await candidateFixture(t);
- const run = { ...origin, id: 800, path: publicationWorkflow, actor: { login: 'operator' }, triggering_actor: { login: 'rerunner' } };
+ const run = { ...origin, head_branch: 'feature/motion', id: 800, path: publicationWorkflow, actor: { login: 'operator' }, triggering_actor: { login: 'rerunner' } };
assert.equal(authorizationReceipt(f.candidate, run, 'publish-test').actor, 'rerunner');
assert.throws(() => authorizationReceipt(f.candidate, { ...run, actor: {}, triggering_actor: {} }, 'publish-test'));
const fetcher = async url => { assert(String(url).endsWith('/actions/runs/800')); return Response.json(run); };
@@ -93,7 +99,7 @@ test('operator authorization requires explicit acceptance and records the actual
assert.equal(record.publicationRun, 800); assert.equal(record.tgzSHA256, f.candidate.tgzSHA256);
assert.equal(record.actor, 'rerunner'); assert.equal(record.acceptanceConfirmed, true);
await assert.rejects(recordAuthorization(f.directory, f.inputs, fetcher, { ...f.env, MOTION_ACCEPTED: 'false' }), /acceptance/);
- for (const patch of [{ id: 801 }, { event: 'push' }, { head_branch: 'feature/motion' }, { head_sha: 'f'.repeat(40) }, { path: candidateWorkflow }, { head_repository: { full_name: 'fork/repo' } }]) {
+ for (const patch of [{ id: 801 }, { event: 'push' }, { head_branch: 'main' }, { head_sha: 'f'.repeat(40) }, { path: candidateWorkflow }, { head_repository: { full_name: 'fork/repo' } }]) {
await assert.rejects(recordAuthorization(f.directory, f.inputs, async () => Response.json({ ...run, ...patch }), f.env));
}
});
@@ -156,7 +162,7 @@ function registry(candidate, exists = true, tag = candidate.version, latest = '0
test('npm publishes only new exact bytes; identical retry and archive-only never write, mismatches fail', async t => {
const f = await candidateFixture(t); let calls = 0;
assert.notEqual(f.candidate.sourceCommit, f.candidate.workflow.sha, 'Application and workflow source identities are independent');
- const run = async (command, args) => { calls++; assert.equal(command, 'npm'); assert(args.includes('--ignore-scripts') && args.includes('candidate')); assert(args.includes('--provenance=false'), 'Do not attest the publication main SHA as the prebuilt application source'); assert.equal(args[1], path.join(f.directory, f.candidate.tgz)); };
+ const run = async (command, args) => { calls++; assert.equal(command, 'npm'); assert(args.includes('--ignore-scripts') && args.includes('candidate')); assert(args.includes('--provenance=false'), 'Do not attest the publication workflow SHA as the prebuilt application source'); assert.equal(args[1], path.join(f.directory, f.candidate.tgz)); };
await publishNpm(f.directory, f.inputs, { run, fetcher: registry(f.candidate, false), env: f.env }); assert.equal(calls, 1);
await publishNpm(f.directory, f.inputs, { run, fetcher: registry(f.candidate), env: f.env });
await assert.rejects(publishNpm(f.directory, f.inputs, { run, fetcher: registry({ ...f.candidate, integrity: 'different' }), env: f.env }), /different bytes/); assert.equal(calls, 1);
@@ -265,7 +271,13 @@ test('daily build and publication are separate manual entries without an indepen
const header = workflow.split('\njobs:\n')[0];
assert(build.includes('workflow_dispatch:') && build.includes('version:') && build.includes('source_sha:'));
assert(build.includes('name: ' + candidateJobName) && build.includes('ref: ${{ steps.source.outputs.source_sha }}'));
- assert(build.includes("github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feature/motion'"));
+ for (const entry of [build, workflow, recovery]) {
+ assert(entry.includes('name: Require Motion integration branch'));
+ assert(entry.includes("Select feature/motion in Run workflow"));
+ const guard = entry.split(' - name: Require Motion integration branch\n')[1].split(/\n - |\n [a-z]/)[0];
+ 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('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'));
@@ -285,6 +297,19 @@ test('daily build and publication are separate manual entries without an indepen
assert(recovery.includes('uses: ./.github/workflows/motion-publish-test.yml') && !recovery.includes('source_sha:'));
});
+test('each manual entry accepts only feature/motion before checkout or publication', async () => {
+ for (const name of ['motion-candidate', 'motion-publish-test', 'motion-publication-recovery']) {
+ const workflow = await readFile(new URL(`../.github/workflows/${name}.yml`, import.meta.url), 'utf8');
+ const step = workflow.split(' - name: Require Motion integration branch\n')[1].split(/\n - |\n [a-z]/)[0];
+ const script = step.split(' run: |\n')[1].split('\n').map(line => line.replace(/^ {10}/, '')).join('\n');
+ const run = ref => runFile('bash', ['-e', '-o', 'pipefail', '-c', script], { env: { ...process.env, GITHUB_REF: ref } });
+ await run('refs/heads/feature/motion');
+ for (const ref of ['refs/heads/main', 'refs/heads/legacy', 'refs/heads/codex/unreviewed', 'refs/tags/feature/motion']) {
+ await assert.rejects(run(ref), /Select feature\/motion/);
+ }
+ }
+});
+
test('rendering tools reuse installed packages, bound apt networking and stop on installation failure', async t => {
const directory = await mkdtemp(path.join(os.tmpdir(), 'motion-render-tools-'));
t.after(() => rm(directory, { recursive: true, force: true }));
@@ -380,7 +405,7 @@ test('an unexpected npm latest change stops promotion and consumer processes can
test('no-publication rehearsal carries one accepted candidate through npm and storage using simulated services only', async t => {
const f = await candidateFixture(t), store = storage(f.candidate);
- const run = { ...origin, id: 800, path: publicationWorkflow, actor: { login: 'operator' } };
+ const run = { ...origin, head_branch: 'feature/motion', id: 800, path: publicationWorkflow, actor: { login: 'operator' } };
const github = async url => { assert(String(url).endsWith('/actions/runs/800')); return Response.json(run); };
await writeFile(path.join(f.directory, 'authorization.json'), '{}');
let npmWrites = 0, tagWrites = 0, published = false, testTag = '0.6.4-test.1';