diff --git a/.github/scripts/motion-release-notes.mjs b/.github/scripts/motion-release-notes.mjs index 05609080a..3f893da87 100644 --- a/.github/scripts/motion-release-notes.mjs +++ b/.github/scripts/motion-release-notes.mjs @@ -4,7 +4,7 @@ import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { releaseInputs, verifyDownloaded, repository, releaseChannel, candidateNoteIdentity } from './motion-release.mjs'; import { sha256 } from '../../scripts/runtime-assets.mjs'; -import { compareReleaseVersions } from '../../scripts/release-version.mjs'; +import { comparePublicationVersions } from '../../scripts/release-version.mjs'; function githubApi(env, fetcher) { return async (route, method = 'GET', data, allowMissing = false) => { @@ -33,8 +33,8 @@ async function listReleases(api) { function previousRelease(releases, version, prerelease) { return releases.filter(r => !r.draft && r.prerelease === prerelease && /^v\d+\.\d+\.\d+(?:-test\.[1-9]\d*(?:\.[1-9]\d*)*)?$/.test(r.tag_name)) - .filter(r => compareReleaseVersions(r.tag_name.slice(1), version) < 0) - .sort((a, b) => compareReleaseVersions(b.tag_name.slice(1), a.tag_name.slice(1)))[0]; + .filter(r => comparePublicationVersions(r.tag_name.slice(1), version) < 0) + .sort((a, b) => comparePublicationVersions(b.tag_name.slice(1), a.tag_name.slice(1)))[0]; } export async function prepareCandidateNotes(directory, { env = process.env, fetcher = fetch } = {}) { diff --git a/.github/scripts/motion-release.mjs b/.github/scripts/motion-release.mjs index b8775390c..7edbedc98 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, releaseTemplateEnvironment, testVersion } from '../../scripts/release-version.mjs'; +import { checkReleaseVersion, comparePublicationVersions, 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'; @@ -76,7 +76,7 @@ export async function resolveCandidate(control, requested, version, env = proces const published = tags[tag]; if (!published) continue; checkReleaseVersion(published); - if (compareReleaseVersions(version, published) > 0) continue; + if (comparePublicationVersions(version, published) > 0) continue; // Advance the published core's patch series rather than only its test counter, so the // result stays newer than every `${core}-test.*` version and remains run-unique. version = automaticVersion(published.split('-test.')[0]); @@ -284,9 +284,9 @@ export async function publishNpm(directory, inputs, { fetcher = fetch, run = run 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 === 'publish-stable' && before.tags.latest) assert(comparePublicationVersions(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'); + if (inputs.action === 'publish-test' && before.tags.test) assert(comparePublicationVersions(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, previousTest: before.tags.test ?? null, status: before.version ? 'already-published-identical' : 'publish-started' }; await writeJSON(path.join(directory, 'npm-publication.json'), record); @@ -316,7 +316,7 @@ export async function promoteTest(directory, inputs, { fetcher = fetch, run = ru const before = await waitForRegistry(candidate, state => !!state.version, { fetcher, wait, attempts }); assert(before.version, 'Exact npm version is not public'); assert.equal(before.tags.latest ?? null, npm.previousLatest, 'npm latest changed unexpectedly; stop before channel promotion'); - const superseded = before.tags.test && compareReleaseVersions(before.tags.test, candidate.version) > 0; + const superseded = before.tags.test && comparePublicationVersions(before.tags.test, candidate.version) > 0; let status = inputs.action === 'archive-only' ? 'archive-only' : superseded ? 'superseded' : 'already-promoted'; if (inputs.action === 'publish-test' && !superseded && before.tags.test !== candidate.version) { await run('npm', ['dist-tag', 'add', `${candidate.packageName}@${candidate.version}`, 'test', '--registry=https://registry.npmjs.org/']); @@ -355,7 +355,7 @@ export async function promoteStable(directory, inputs, { fetcher = fetch, run = 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; + const superseded = before.tags.latest && comparePublicationVersions(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) { @@ -390,9 +390,9 @@ export async function archiveRelease(directory, inputs, config, { run = runFile, assert.equal(npm.tgzSHA256, candidate.tgzSHA256); 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-stable' && registry.tags.latest !== candidate.version) assert(registry.tags.latest && comparePublicationVersions(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'); + assert(registry.tags.test && comparePublicationVersions(registry.tags.test, candidate.version) > 0, 'npm test tag is missing or unexpectedly older; explicit channel recovery is required'); } const prefix = path.posix.dirname(plan.versionKey), work = await mkdtemp(path.join(os.tmpdir(), 'motion-snapshot-')); const aws = async (operation, rest) => JSON.parse(await run('aws', ['--endpoint-url', plan.endpoint, '--region', 'auto', 's3api', operation, '--bucket', plan.bucket, ...rest]) || '{}'); diff --git a/.github/scripts/publish-install-guide.mjs b/.github/scripts/publish-install-guide.mjs index a96a879c5..18847d16a 100644 --- a/.github/scripts/publish-install-guide.mjs +++ b/.github/scripts/publish-install-guide.mjs @@ -5,7 +5,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 { compareReleaseVersions } from '../../scripts/release-version.mjs'; +import { comparePublicationVersions } from '../../scripts/release-version.mjs'; export function storagePlan(record, { endpoint, bucket, publicOrigin }) { const api = new URL(endpoint), origin = new URL(publicOrigin); @@ -68,7 +68,7 @@ export async function publishGuide(directory, config, { run = runFile, fetcher = await writeFile(path.join(directory, 'previous-install.md'), previous.bytes); const version = previous.bytes.toString('utf8').match(/^# Install OpenMotion (\S+)\s*$/m)?.[1]; assert(version, 'Existing default guide has no recognizable version; inspect it before promotion'); - if (compareReleaseVersions(version, record.version) > 0) { + if (comparePublicationVersions(version, record.version) > 0) { const publication = { ...record, ...plan, phase: 'superseded', promoted: false, currentVersion: version }; await writeJSON(path.join(directory, 'publication.json'), publication); return publication; diff --git a/AGENTS.md b/AGENTS.md index a3613b063..10877cedd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -110,6 +110,8 @@ New repository installations use the source bootstrap in install.md by default. Follow [the release workflow manual](docs/release-workflows.md): separate manual candidate-build and npm-publication entries, plus snapshot-only recovery. Select `main` for all entries; other execution refs are rejected for new release work. 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 `main`. 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 ordering reserves the historical 0.6.x namespace and starts the active series at 0.0.1. Use the shared publication comparator for npm channel protection, guide promotion, automatic test baselines and Notes history; retain standard SemVer comparison separately. Historical versions/snapshots remain immutable, and stale historical candidates must not replace active versions. Source 0.0.1 automatically builds 0.0.2-test.N when test version is empty. Existing range dependencies/lockfiles require explicit migration; no live tags or guides change until separately authorized publication. Start new publication/recovery dispatches from the latest main after cutover; do not rerun historical control snapshots that predate this ordering policy. + Stable release descriptions follow the [changelog authoring guide](https://github.com/nexu-io/openmotion/blob/main/docs/CHANGELOG/README.md). Maintain English and Chinese Unreleased drafts, then archive the selected exact stable version before building. Candidate preparation reads only that frozen source SHA; missing copy warns and retains an automatic draft, while malformed supplied copy fails. Publication reuses sealed Notes and preserves published maintainer edits. Changelog sources stay outside application/npm/plugin distribution; never rewrite a retained candidate to add copy or infer publication from a draft. 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. npm publication and release snapshot recovery require separate manual authorization. Main-branch template synchronization is explicitly authorized to run automatically using the existing R2 release-bucket credentials, scoped in the workflow to the final upload step; it does not publish npm, move tags or update installation guides. These are shared bucket credentials, not template-only credentials. Consumer jobs receive neither npm OIDC nor R2 credentials. 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/CHANGELOG.md b/CHANGELOG.md index 566dc9b19..e0c8190b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ OpenMotion's stable release descriptions are maintained in [docs/CHANGELOG](docs These drafts describe work integrated into `main`, not a published version or completed acceptance. Before building a stable candidate, select its version, review the drafts and archive them under `docs/CHANGELOG/v{version}/` as described in the [authoring guide](docs/CHANGELOG/README.md). +## 0.0.1 — candidate description (not a publication record) + +- [English](docs/CHANGELOG/v0.0.1/en.md) · [简体中文](docs/CHANGELOG/v0.0.1/zh-CN.md) +- The active version series restarts at 0.0.1. Historical 0.6.x versions remain available; publication and acceptance require their own evidence. + ## Published versions [GitHub Releases](https://github.com/nexu-io/openmotion/releases) is the publication record. Existing npm versions remain available on [npm](https://www.npmjs.com/package/@openmotion/app?activeTab=versions); this index does not invent release dates or reconstruct unverified historical notes. diff --git a/CLAUDE.md b/CLAUDE.md index 2e257c5ee..1fa75592f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -23,6 +23,8 @@ New repository installations use the source bootstrap in install.md by default. Follow [the release workflow manual](docs/release-workflows.md): separate manual candidate-build and npm-publication entries, plus snapshot-only recovery. Select `main` for all entries; other execution refs are rejected for new release work. 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 `main`. 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 ordering reserves the historical 0.6.x namespace and starts the active series at 0.0.1. Use the shared publication comparator for npm channel protection, guide promotion, automatic test baselines and Notes history; retain standard SemVer comparison separately. Historical versions/snapshots remain immutable, and stale historical candidates must not replace active versions. Source 0.0.1 automatically builds 0.0.2-test.N when test version is empty. Existing range dependencies/lockfiles require explicit migration; no live tags or guides change until separately authorized publication. Start new publication/recovery dispatches from the latest main after cutover; do not rerun historical control snapshots that predate this ordering policy. + Stable release descriptions follow the [changelog authoring guide](https://github.com/nexu-io/openmotion/blob/main/docs/CHANGELOG/README.md). Maintain English and Chinese Unreleased drafts, then archive the selected exact stable version before building. Candidate preparation reads only that frozen source SHA; missing copy warns and retains an automatic draft, while malformed supplied copy fails. Publication reuses sealed Notes and preserves published maintainer edits. Changelog sources stay outside application/npm/plugin distribution; never rewrite a retained candidate to add copy or infer publication from a draft. 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. npm publication and release snapshot recovery require separate manual authorization. Main-branch template synchronization is explicitly authorized to run automatically using the existing R2 release-bucket credentials, scoped in the workflow to the final upload step; it does not publish npm, move tags or update installation guides. These are shared bucket credentials, not template-only credentials. Consumer jobs receive neither npm OIDC nor R2 credentials. 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/docs/CHANGELOG/README.md b/docs/CHANGELOG/README.md index 188dec22d..f4e2958b9 100644 --- a/docs/CHANGELOG/README.md +++ b/docs/CHANGELOG/README.md @@ -11,7 +11,7 @@ Test candidates continue to generate automatic commit-based notes. They do not r ## Prepare a stable version 1. Update [the English draft](unreleased/en.md) and [the Chinese draft](unreleased/zh-CN.md) with user-visible highlights, additions, changes, fixes, upgrade notes, known issues and acceptance focus. Link relevant public PRs; keep private test results outside the repository. -2. Select the next stable version. Copy the reviewed drafts into `docs/CHANGELOG/v{version}/en.md` and `zh-CN.md`, change their first lines to `# OpenMotion {version}`, and replace the draft notice with the reviewed version scope. Use absolute public HTTPS links so the same Markdown works in GitHub Releases. For example, a selected `0.6.9` uses `v0.6.9/` and `# OpenMotion 0.6.9`; this is an example, not a reserved or published version. +2. Select the next stable version. Copy the reviewed drafts into `docs/CHANGELOG/v{version}/en.md` and `zh-CN.md`, change their first lines to `# OpenMotion {version}`, and replace the draft notice with the reviewed version scope. Use absolute public HTTPS links so the same Markdown works in GitHub Releases. For example, a selected `0.0.2` uses `v0.0.2/` and `# OpenMotion 0.0.2`; this is an example, not a reserved or published version. 3. Submit those files through a PR to `main`. Build that exact stable version from a source SHA containing the descriptions. Review the sealed Notes in the candidate Summary alongside the package identity. 4. After the separately authorized publication succeeds, add the confirmed version/date and source/Release links to the root index through a PR. Begin the next Unreleased draft. Never label a draft or candidate as published. diff --git a/docs/CHANGELOG/v0.0.1/en.md b/docs/CHANGELOG/v0.0.1/en.md new file mode 100644 index 000000000..b79eec7a3 --- /dev/null +++ b/docs/CHANGELOG/v0.0.1/en.md @@ -0,0 +1,34 @@ +# OpenMotion 0.0.1 + +Prepared description for the 0.0.1 stable candidate. The active version series starts here; historical 0.6.x packages and fixed downloads remain available. Publication status is recorded separately in GitHub Releases. + +## Highlights + +- Connect a supported local Agent to OpenMotion using its own host configuration, including hosts outside the predefined integrations. ([#460](https://github.com/nexu-io/openmotion/pull/460)) +- Keep generated media in workspace assets, preview alternatives and adopt a chosen result into the editable project. ([#413](https://github.com/nexu-io/openmotion/pull/413), [#448](https://github.com/nexu-io/openmotion/pull/448)) +- Use supported OpenDesign account models for image editing and music generation; available models and usage depend on the signed-in account. ([#423](https://github.com/nexu-io/openmotion/pull/423), [#445](https://github.com/nexu-io/openmotion/pull/445)) + +## Added and improved + +- Preview audio inline with compact waveform controls. ([#391](https://github.com/nexu-io/openmotion/pull/391)) +- Choose explicit npm application installation alongside the default source installation route. Candidate builds retain package identity and release-note drafts for review. ([#444](https://github.com/nexu-io/openmotion/pull/444), [#447](https://github.com/nexu-io/openmotion/pull/447), [#464](https://github.com/nexu-io/openmotion/pull/464)) + +## Fixed + +- Recover Windows host setup and legacy workspace installation paths. ([#434](https://github.com/nexu-io/openmotion/pull/434)) +- Retry socket-buffer rendering failures with fewer workers. ([#443](https://github.com/nexu-io/openmotion/pull/443)) + +## Upgrade notes + +- Install using `@openmotion/app@latest` after publication, or pin `@openmotion/app@0.0.1`. Existing 0.6.x version ranges and lockfiles require an explicit migration; the tag change does not update existing installations. + +- Select one installation route explicitly. Preserve existing projects, credentials and host settings; avoid mixing a source checkout with an npm installation. +- Stable packages use prod template configuration; test packages use DEV. Service access and account configuration remain necessary. + +## Known issues + +Package-specific acceptance is not established by this description. Before publication, record the actual outstanding issues and supported platforms. Live template access, paid model execution and human audio/video playback are not established by build success. + +## Acceptance focus + +Verify the selected package's local Agent connection, template access, asset adoption, audio preview and MP4 export. Check an upgrade with existing projects and host settings, and watch/listen to the final output at normal speed. Keep actual results in a private acceptance record; mark unrun checks NOT RUN. diff --git a/docs/CHANGELOG/v0.0.1/zh-CN.md b/docs/CHANGELOG/v0.0.1/zh-CN.md new file mode 100644 index 000000000..7319f7270 --- /dev/null +++ b/docs/CHANGELOG/v0.0.1/zh-CN.md @@ -0,0 +1,34 @@ +# OpenMotion 0.0.1 + +为 0.0.1 正式候选包准备的版本说明。新的版本序列从这里开始;历史 0.6.x 包和固定下载地址继续保留。实际发布状态以 GitHub Releases 为准。 + +## 亮点 + +- 使用本机 Agent 自己的宿主配置连接 OpenMotion,也可连接预设集成列表之外的受支持本地 Agent。([#460](https://github.com/nexu-io/openmotion/pull/460)) +- 生成的媒体保存在工作区素材中,可以预览候选结果,再把选中的素材应用到可编辑工程。([#413](https://github.com/nexu-io/openmotion/pull/413)、[#448](https://github.com/nexu-io/openmotion/pull/448)) +- 使用受支持的 OpenDesign 账号模型编辑图片、生成音乐;可用模型和用量取决于已登录账号。([#423](https://github.com/nexu-io/openmotion/pull/423)、[#445](https://github.com/nexu-io/openmotion/pull/445)) + +## 新增与改进 + +- 通过紧凑的波形控件直接预听音频。([#391](https://github.com/nexu-io/openmotion/pull/391)) +- 在默认源码安装之外,可明确选择 npm 应用安装。候选构建保留包身份和版本说明草稿,便于检查。([#444](https://github.com/nexu-io/openmotion/pull/444)、[#447](https://github.com/nexu-io/openmotion/pull/447)、[#464](https://github.com/nexu-io/openmotion/pull/464)) + +## 修复 + +- 修复 Windows 宿主配置及旧工作区安装路径的恢复。([#434](https://github.com/nexu-io/openmotion/pull/434)) +- 渲染遇到套接字缓冲区故障时,减少并发后重试。([#443](https://github.com/nexu-io/openmotion/pull/443)) + +## 升级注意事项 + +- 发布后使用 `@openmotion/app@latest` 安装,或固定为 `@openmotion/app@0.0.1`。已有 0.6.x 版本范围和锁文件需要明确迁移;修改标签不会自动更新现有安装。 + +- 明确选择一种安装方式,保留原有工程、凭据和宿主配置,避免混用源码与 npm 安装。 +- 正式包使用 prod 模板配置,测试包使用 DEV;仍需具备对应服务的访问条件和账号配置。 + +## 已知问题 + +本说明不代表已经完成这份安装包的实际验收。发布前需补充实际未解决问题和支持的平台范围。构建成功不代表线上模板可用、付费模型执行通过或成片声画已完成人工验收。 + +## 验收重点 + +验证选定安装包的本地 Agent 连接、模板访问、素材应用、音频预听和 MP4 导出。检查升级后原有工程和宿主配置是否保留,并以正常速度观看、收听最终成片。实际结果保存在内部验收记录中,未测项标为 NOT RUN。 diff --git a/docs/product/architecture.md b/docs/product/architecture.md index 1d5350b14..a8ffc247c 100644 --- a/docs/product/architecture.md +++ b/docs/product/architecture.md @@ -422,7 +422,7 @@ Test publishes the same tgz under npm candidate, promotes test in an npm-OIDC-on 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. -The manual publication definition includes an isolated GitHub-only Release-notes job after successful npm and guide delivery. It creates an exact-source draft before publishing; test is a Pre-release and an unsuperseded stable release may become Latest. For new candidates, Notes reuse the sealed draft and add install links, source/hash and verification scope; a separate github-release-notes.md holds the final body so immutable candidate files are unchanged. Older schema-2 candidates retain publication-time generation. First-channel notes declare their history-range limitation. Conflicting tags/releases are preserved; retries keep published maintainer prose. Notes failures warn without undoing package delivery, and archive-only recovery never creates Releases. This extension does not change npm workflow activation itself. Automatic test numbering additionally reads published npm latest/test/candidate tags and advances beyond them, so a source-version reset cannot reset public package numbering; explicit versions retain the existing path. +The manual publication definition includes an isolated GitHub-only Release-notes job after successful npm and guide delivery. It creates an exact-source draft before publishing; test is a Pre-release and an unsuperseded stable release may become Latest. For new candidates, Notes reuse the sealed draft and add install links, source/hash and verification scope; a separate github-release-notes.md holds the final body so immutable candidate files are unchanged. Older schema-2 candidates retain publication-time generation. First-channel notes declare their history-range limitation. Conflicting tags/releases are preserved; retries keep published maintainer prose. Notes failures warn without undoing package delivery, and archive-only recovery never creates Releases. This extension does not change npm workflow activation itself. Publication ordering treats the reserved historical 0.6.x namespace as older than the active series beginning at 0.0.1; standard SemVer comparison remains separate. npm channel guards, default-guide supersession and Release-note history share that order. Automatic test numbering reads latest/test/candidate tags and ignores historical tags as active baselines, so source 0.0.1 produces 0.0.2-test.N. Old candidates cannot overwrite active channel entries; same-series downgrades still fail. Existing packages, immutable snapshots, version ranges and lockfiles retain their original semantics. Only separately authorized publication may move latest and the default guide; merging this policy does not do so. 已确认方向是继续支持多 Agent 接入、可编辑工程与一个工作区内的发现/制作闭环。 diff --git a/docs/release-guide.md b/docs/release-guide.md index 177e7dbba..48b9dcb54 100644 --- a/docs/release-guide.md +++ b/docs/release-guide.md @@ -80,3 +80,7 @@ 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-delivery evidence for test and a required gate before stable `latest`. Neither establishes real creation or human acceptance. + +## Active version series + +The active stable series starts at 0.0.1; 0.6.x is reserved for historical packages. Follow the release manual for publication ordering. Stable still requires both exact prod native checks before latest and the default guide advance. Existing ^0.6.x dependencies and lockfiles require an explicit version migration; use the latest-tag guide or an exact new version. No old package or snapshot is overwritten. diff --git a/docs/release-workflows.md b/docs/release-workflows.md index 8d2268d72..bd6749a47 100644 --- a/docs/release-workflows.md +++ b/docs/release-workflows.md @@ -47,11 +47,13 @@ This automatic workflow is an explicitly authorized exception to the manual rele ## 1. Build -Open **Actions → Motion candidate build → Run workflow**, select **`main`** 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` registers the manual Actions entries; release operations still execute from `main`. +Open **Actions → Motion candidate build → Run workflow**, select **`main`** and a **channel**. For `test`, normally leave **version** empty. For `stable`, enter an explicit new version such as `0.0.1` (no suffix); empty or mismatched versions fail before building. Use this same branch for publication and recovery; `main` registers the manual Actions entries; release operations still execute from `main`. -An empty version starts from the frozen Motion source's next patch and a short `-test.N`, then reads npm `latest`, `test` and `candidate` to keep the result newer than published channel versions. A source-version reset does not reset public package numbering; for example source `0.0.1` with npm stable `0.6.7` produces the `0.6.8-test.N` series. A published version that is not older advances that version's patch series instead of reusing an identity, for example a published `0.6.8-test.20` yields `0.6.9-test.`; the run number in `N` keeps concurrent candidates on distinct versions. Registry errors or invalid tags stop automatic selection; an explicit version remains available. `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). +Publication ordering explicitly reserves the historical **0.6.x** namespace (including its test versions). The active series starts at **0.0.1** and always follows that historical line. Within either line, normal numeric/prerelease ordering still applies. This lets a separately authorized stable publication move historical npm `latest=0.6.7` and its default guide to `0.0.1`, while a stale 0.6.x candidate can never replace an active-series version. New active versions must skip the reserved 0.6.x namespace when they eventually reach it; 0.7.0 and later remain available. Package version validation and standard SemVer comparison are unchanged. npm itself does not know this repository policy: existing `^0.6.x` ranges and lockfiles do not migrate to 0.0.1. Use the explicit `@latest` guide or pin the new exact version. -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 `main` dispatch, even if the branch advances while the run queues. The legacy `main` package version is never used for automatic Motion numbering. Source development versions and published package versions remain separate; automatic candidate numbering respects both source and registry baselines. +An empty test version starts from the frozen source's next patch and a short `-test.N`, then reads npm `latest`, `test` and `candidate` using this publication order. For source `0.0.1`, historical tags such as `0.6.7` and `0.6.8-test.21` do not raise the core version: the result is **0.0.2-test.N**. A current-series tag that is not older advances its core's patch, for example `0.0.2-test.20` can advance to `0.0.3-test.N`; the run number keeps concurrent candidates distinct. Registry errors or invalid tags still stop automatic selection. `N` remains `GITHUB_RUN_NUMBER + 5`; gaps are expected and retries add an attempt suffix. Full run ID, attempt and source SHA remain in the candidate records. Explicit stable `0.0.1` is never automatically published or substituted by a test version. + +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 `main` dispatch, even if the branch advances while the run queues. The legacy `main` package version is never used for automatic Motion numbering. Source development versions and published package versions remain separate; automatic candidate numbering respects the source and active publication-series registry baselines. 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. @@ -131,6 +133,15 @@ Builds have no publication lock, so another version can build during acceptance. 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. + +## Publishing the first active stable version + +Before cutover, ensure no historical publication or recovery run is queued or running. After the policy is merged, start new manual runs from the latest main; do not rerun pre-reset publication/recovery runs, whose frozen control scripts still use the old ordering. Existing candidate artifacts may be consumed by the new controller with their original identity. + +After this policy change is reviewed and merged, prepare the `0.0.1` English/Chinese description, then run **Motion candidate build** from `main`, choose `stable` and enter `0.0.1`. Inspect that exact prod package and its sealed Notes. When separately authorized, run **Motion npm publication** from `main`, choose `stable` and enter the same `0.0.1`. + +The existing sequence stays **public stage → both native checks → latest → immutable snapshots → default guide → GitHub Release notes**. Source/hash verification, native-check gating, conditional R2 writes, race/supersession protection, retry identity and archive-only boundaries are unchanged. Stable publication preserves the test tag. Later `0.0.2` can advance `0.0.1`; an older `0.0.1` cannot replace `0.0.2`. Historical snapshots are never deleted or rewritten. No force flag, new workflow input, manual pre-move of npm tags, or new permission is needed. + ## 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. diff --git a/scripts/release-version.mjs b/scripts/release-version.mjs index d2aad7ec5..6ed35dc50 100644 --- a/scripts/release-version.mjs +++ b/scripts/release-version.mjs @@ -30,3 +30,11 @@ export function compareReleaseVersions(left, right) { } return 0; } + +export function comparePublicationVersions(left, right) { + const order = compareReleaseVersions(left, right); + // The published 0.6.x line is historical; the current release series restarts at 0.0.1. + const historical = version => version.startsWith('0.6.'); + if (historical(left) !== historical(right)) return historical(left) ? -1 : 1; + return order; +} diff --git a/tests/install-guide.test.ts b/tests/install-guide.test.ts index b15150082..8087650d7 100644 --- a/tests/install-guide.test.ts +++ b/tests/install-guide.test.ts @@ -163,12 +163,14 @@ test('archive-only guide publication never accesses the moving default', async t }); test('late completion archives its exact version without rolling a newer default back', async t => { - const { directory, record } = await fixture(t), newer = '# Install OpenMotion 0.6.4-test.10\n'; - const store = storage(directory, record, newer); - const result = await publishGuide(directory, config, store); - assert.equal(result.phase, 'superseded'); assert.equal(result.promoted, false); - assert.deepEqual(store.writes.map(x => x.key), [store.plan.versionKey]); - assert.equal(store.objects.get(store.plan.fixedKey)!.toString(), newer); + const { directory, record } = await fixture(t); + for (const version of ['0.6.4-test.10', '0.0.2-test.22']) { + const newer = '# Install OpenMotion ' + version + '\n', store = storage(directory, record, newer); + const result = await publishGuide(directory, config, store); + assert.equal(result.phase, 'superseded'); assert.equal(result.promoted, false); + assert.deepEqual(store.writes.map(x => x.key), [store.plan.versionKey]); + assert.equal(store.objects.get(store.plan.fixedKey)!.toString(), newer); + } }); test('unrecognized or conflicting same-version defaults require inspection instead of replacement', async t => { diff --git a/tests/release-fixture.mjs b/tests/release-fixture.mjs index 78df98edc..e82397e79 100644 --- a/tests/release-fixture.mjs +++ b/tests/release-fixture.mjs @@ -46,7 +46,7 @@ export async function candidateFixture(t, branch = 'main', options = {}) { status: 'passed', templateEnvironment, platform, version, sourceCommit: commit, tgzSHA256: candidate.tgzSHA256, registryColdInstall: 'passed', nativePreparation: 'passed', repeatSetup: 'passed', resources: 'passed', mcpTools: manifest.mcp.tools.length, skills: manifest.skills.length, }); - await writeJSON(path.join(directory, 'npm-publication.json'), { tgzSHA256: candidate.tgzSHA256, previousLatest: '0.5.0' }); + await writeJSON(path.join(directory, 'npm-publication.json'), { tgzSHA256: candidate.tgzSHA256, previousLatest: '0.6.3' }); await writeJSON(path.join(directory, 'test-promotion.json'), { version, tgzSHA256: candidate.tgzSHA256, action: inputs.action, publicationRun: publicationEnv.GITHUB_RUN_ID, status: 'already-promoted' }); return { work, root, build, directory, candidate, inputs, provenance, app, pkg, manifest, authorization, env: publicationEnv }; } diff --git a/tests/release-notes.test.mjs b/tests/release-notes.test.mjs index bb53f34ac..6e1f63268 100644 --- a/tests/release-notes.test.mjs +++ b/tests/release-notes.test.mjs @@ -192,6 +192,33 @@ function noteResponse(filename, text) { return Response.json({ type: 'file', path: filename, encoding: 'base64', size: bytes.length, content: bytes.toString('base64') }); } +test('the prepared 0.0.1 descriptions are selected from the exact candidate source', async t => { + const f = await fixture(t, '0.0.1'); await rm(path.join(f.build, 'release-notes.md')); + const body = await prepareCandidateNotes(f.build, { env: { MOTION_VERSION: '0.0.1', MOTION_SOURCE_SHA: f.candidate.sourceCommit }, fetcher: async url => { + const parsed = new URL(url), filename = parsed.pathname.split('/contents/')[1]; + assert.equal(parsed.searchParams.get('ref'), f.candidate.sourceCommit); + assert(filename.startsWith('docs/CHANGELOG/v0.0.1/')); + return noteResponse(filename, await readFile(new URL('../' + filename, import.meta.url), 'utf8')); + } }); + assert(body.includes('# OpenMotion 0.0.1') && body.includes('templates: prod')); + assert(body.includes('## English') && body.includes('## 简体中文')); + assert(body.includes('@openmotion/app@0.0.1') && body.includes('0.6.x')); + assert(body.includes(f.candidate.tgzSHA256)); +}); + +for (const [version, previous] of [['0.0.1', 'v0.6.7'], ['0.0.2', 'v0.0.1']]) test(`${version} automatic notes select the previous publication series correctly`, async t => { + const f = await fixture(t, version); await rm(path.join(f.build, 'release-notes.md')); + const base = 'a'.repeat(40); + const body = await prepareCandidateNotes(f.build, { env: { MOTION_VERSION: version, MOTION_SOURCE_SHA: f.candidate.sourceCommit }, fetcher: async url => { + if (url.includes('/contents/')) return new Response('', { status: 404 }); + if (url.includes('/releases?')) return Response.json(['v0.6.7', 'v0.0.1', 'v0.0.3'].map(tag_name => ({ tag_name, prerelease: false, draft: false }))); + if (url.includes('/git/ref/')) { assert(url.endsWith(previous)); return Response.json({ object: { type: 'commit', sha: base } }); } + assert(url.includes(`/compare/${base}...${f.candidate.sourceCommit}`)); + return Response.json({ status: 'ahead', total_commits: 0, commits: [] }); + } }); + assert(body.includes(`Baseline: ${previous} (${base})`)); +}); + test('stable candidates freeze exact-source bilingual notes and publication reuses them unchanged', async t => { const f = await fixture(t); await rm(path.join(f.build, 'release-notes.md')); diff --git a/tests/release-workflows.test.mjs b/tests/release-workflows.test.mjs index 7b51eeaf4..fe9f5669d 100644 --- a/tests/release-workflows.test.mjs +++ b/tests/release-workflows.test.mjs @@ -7,7 +7,7 @@ import path from 'node:path'; import { createHash } from 'node:crypto'; import { candidateFixture } from './release-fixture.mjs'; import { waitForRegistry, releaseInputs, resolveCandidate, validateSource, validateRun, verifyDownloaded, downloadCandidate, publishNpm, promoteTest, archiveRelease, repository, candidateWorkflow, recoveryWorkflow, publicationWorkflow, candidateJobName, findCandidate, authorizationReceipt, recordAuthorization } from '../.github/scripts/motion-release.mjs'; -import { compareReleaseVersions } from '../scripts/release-version.mjs'; +import { compareReleaseVersions, comparePublicationVersions } from '../scripts/release-version.mjs'; import { consumerEnvironment } from '../.github/scripts/motion-registry-smoke.mjs'; import { runFile } from '../scripts/runtime-assets.mjs'; @@ -76,25 +76,26 @@ test('candidate CLI numbers the frozen Motion source, not the legacy control che assert.equal(JSON.parse(await readFile(path.join(directory, 'package.json'))).version, '0.1.0'); }); -test('automatic candidates continue beyond published npm versions after a source version reset', async () => { +test('automatic candidates follow the active release series and ignore historical 0.6.x tags', async () => { const env = { ...valid, GITHUB_SHA: 'a'.repeat(40), GITHUB_WORKFLOW_REF: `${repository}/${candidateWorkflow}@refs/heads/main`, GITHUB_RUN_NUMBER: '9', GITHUB_RUN_ATTEMPT: '1' }; const run = async (_, args) => args[0] === 'show' ? JSON.stringify({ version: '0.0.1' }) : ''; const resolve = (tags, patch = {}) => resolveCandidate('.', '', '', { ...env, ...patch }, run, async () => Response.json({ 'dist-tags': tags })); - assert.equal((await resolve({ latest: '0.6.7', test: '0.6.4-test.13' })).version, '0.6.8-test.14'); - assert.equal((await resolve({ latest: '0.6.7', test: '0.6.8-test.99', candidate: '0.6.8-test.100' })).version, '0.6.9-test.14'); - assert.equal((await resolve({ latest: '0.6.7' }, { GITHUB_RUN_ATTEMPT: '2' })).version, '0.6.8-test.14.2'); + assert.equal((await resolve({ latest: '0.6.7', test: '0.6.4-test.13' })).version, '0.0.2-test.14'); + assert.equal((await resolve({ latest: '0.6.7', test: '0.6.8-test.99', candidate: '0.6.8-test.100' })).version, '0.0.2-test.14'); + assert.equal((await resolve({ latest: '0.6.7' }, { GITHUB_RUN_ATTEMPT: '2' })).version, '0.0.2-test.14.2'); const ahead = { latest: '0.6.7', test: '0.6.8-test.20' }; const first = await resolve(ahead, { GITHUB_RUN_NUMBER: '15' }); const second = await resolve(ahead, { GITHUB_RUN_NUMBER: '16' }); - assert.equal(first.version, '0.6.9-test.20'); assert.equal(second.version, '0.6.8-test.21'); + assert.equal(first.version, '0.0.2-test.20'); assert.equal(second.version, '0.0.2-test.21'); assert.notEqual(first.version, second.version, 'Concurrent candidates must keep distinct versions'); for (const version of [first.version, second.version]) { - assert(compareReleaseVersions(version, ahead.test) > 0, `${version} must stay newer than the published test tag`); + assert(comparePublicationVersions(version, ahead.test) > 0, `${version} must stay newer than the published test tag`); } await assert.rejects(resolveCandidate('.', '', '', env, run, async () => new Response('', { status: 503 })), /baseline/); await assert.rejects(resolve({ latest: 'bad' }), /MAJOR/); await assert.rejects(resolveCandidate('.', '', '', env, run, async () => Response.json({})), /Missing npm/); + assert.equal((await resolve({ latest: '0.0.1', test: '0.0.2-test.20', candidate: '0.0.2-test.21' })).version, '0.0.3-test.14'); const explicit = await resolveCandidate('.', '', '0.7.0-test.1', env, run, async () => { throw Error('Explicit versions need no registry lookup'); }); assert.equal(explicit.version, '0.7.0-test.1'); }); @@ -218,7 +219,7 @@ test('old main receipts remain readable but unregistered candidate branches cann }); -function registry(candidate, exists = true, tag = candidate.version, latest = '0.5.0') { +function registry(candidate, exists = true, tag = candidate.version, latest = '0.6.3') { return () => Response.json({ versions: exists ? { [candidate.version]: { dist: { integrity: candidate.integrity } } } : {}, 'dist-tags': { test: tag, latest } }); } @@ -261,6 +262,18 @@ test('test promotion does not wait for native reports and still protects the cha assert.equal(writes, 1); }); +test('active test publication replaces historical test tags but preserves npm latest', async t => { + const f = await candidateFixture(t, 'main', { version: '0.0.2-test.22' }); + let tag = '0.6.8-test.21', writes = 0; + await publishNpm(f.directory, f.inputs, { env: f.env, fetcher: registry(f.candidate, false, tag), run: async () => { writes++; } }); + const options = { env: f.env, fetcher: () => registry(f.candidate, true, tag)(), run: async (command, args) => { + assert.equal(command, 'npm'); assert.equal(args[3], 'test'); writes++; tag = f.candidate.version; + } }; + assert.equal((await promoteTest(f.directory, f.inputs, options)).status, 'promoted'); + assert.equal(tag, f.candidate.version); assert.equal(writes, 2); + await assert.rejects(publishNpm(f.directory, f.inputs, { ...options, fetcher: registry(f.candidate, true, '0.0.3-test.1') }), /newer npm test/); +}); + test('promotion never regresses a newer test tag and archive-only has no npm write', async t => { const f = await candidateFixture(t), run = async () => { throw Error('Unexpected npm mutation'); }; assert.equal((await promoteTest(f.directory, f.inputs, { run, env: f.env, fetcher: registry(f.candidate, true, '0.6.4-test.100') })).status, 'superseded'); @@ -488,7 +501,7 @@ test('a missing or regressed npm test tag cannot be misreported as a newer super const f = await candidateFixture(t), store = storage(f.candidate); for (const tag of [undefined, '0.6.4-test.1']) { await assert.rejects(archiveRelease(f.directory, f.inputs, config, { ...store, - fetcher: () => Response.json({ versions: { [f.candidate.version]: { dist: { integrity: f.candidate.integrity } } }, 'dist-tags': { test: tag, latest: '0.5.0' } }) }), /explicit channel recovery/); + fetcher: () => Response.json({ versions: { [f.candidate.version]: { dist: { integrity: f.candidate.integrity } } }, 'dist-tags': { test: tag, latest: '0.6.3' } }) }), /explicit channel recovery/); } assert.equal(store.writes.length, 0); }); diff --git a/tests/stable-release.test.mjs b/tests/stable-release.test.mjs index 2ec200465..c4552172b 100644 --- a/tests/stable-release.test.mjs +++ b/tests/stable-release.test.mjs @@ -4,11 +4,12 @@ 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'; +import { compareReleaseVersions, comparePublicationVersions } from '../scripts/release-version.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'; + let published = false, latest = '0.6.3'; 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 } }); @@ -32,6 +33,61 @@ function services(f) { return { run, fetcher, env: f.env, writes, objects, setLatest: value => { latest = value; }, getLatest: () => latest }; } +test('publication order reserves the historical 0.6.x line without changing standard version comparison', () => { + assert(compareReleaseVersions('0.0.1', '0.6.7') < 0); + for (const old of ['0.6.3', '0.6.7', '0.6.8-test.21', '0.6.999']) { + assert(comparePublicationVersions('0.0.1', old) > 0); + assert(comparePublicationVersions(old, '0.0.1') < 0); + } + for (const [newer, older] of [['0.0.2', '0.0.1'], ['0.0.2-test.2', '0.0.2-test.1'], ['0.0.2', '0.0.2-test.9'], ['0.7.0', '0.5.0'], ['0.6.8', '0.6.7']]) { + assert(comparePublicationVersions(newer, older) > 0); + assert(comparePublicationVersions(older, newer) < 0); + } + assert.throws(() => comparePublicationVersions('latest', '0.6.7')); +}); + +test('0.0.1 stages before native checks, then replaces historical latest and guide without changing old snapshots', async t => { + const f = await candidateFixture(t, 'main', { version: '0.0.1' }), store = services(f); + store.setLatest('0.6.7'); + const previous = Buffer.from('# Install OpenMotion 0.6.7\nHistorical guide\n'); + store.objects.set('open-motion/install.md', previous); + store.objects.set('open-motion/0.6.7/install.md', previous); + await publishNpm(f.directory, f.inputs, store); + assert.equal(store.getLatest(), '0.6.7'); + const native = path.join(f.directory, 'registry-win32-x64.json'), report = await readFile(native, 'utf8'); + await writeFile(native, JSON.stringify({ ...JSON.parse(report), status: 'failed' })); + await assert.rejects(promoteStable(f.directory, f.inputs, store)); + assert.equal(store.getLatest(), '0.6.7'); assert(store.objects.get('open-motion/install.md').equals(previous)); + await writeFile(native, report); + assert.equal((await promoteStable(f.directory, f.inputs, store)).status, 'promoted'); + assert.equal(store.getLatest(), '0.0.1'); + await archiveRelease(f.directory, f.inputs, config, store); + assert(store.objects.get('open-motion/install.md').toString().startsWith('# Install OpenMotion 0.0.1\n')); + assert(store.objects.get('open-motion/install.md').toString().includes('@openmotion/app@latest')); + assert(store.objects.get('open-motion/0.0.1/install.md').toString().includes('@openmotion/app@0.0.1')); + assert(store.objects.get('open-motion/0.6.7/install.md').equals(previous)); + assert.equal((JSON.parse(await readFile(path.join(f.directory, 'npm-publication.json')))).previousTest, '0.6.4-test.8'); + const writes = store.writes.length; + 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, writes, 'A retry neither republishes nor retags'); +}); + +test('the new series still rejects a normal downgrade and stale historical candidates', async t => { + for (const version of ['0.0.1', '0.6.8']) { + const f = await candidateFixture(t, 'main', { version }), store = services(f); + store.setLatest('0.0.2'); + await assert.rejects(publishNpm(f.directory, f.inputs, store), /newer stable version/); + assert.equal(store.writes.length, 0); + } + const f = await candidateFixture(t, 'main', { version: '0.0.1' }), store = services(f); + store.setLatest('0.6.7'); await publishNpm(f.directory, f.inputs, store); + store.setLatest('0.0.2'); + 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.0.1/install.md')); + assert.equal(store.getLatest(), '0.0.2'); +}); + test('stable selection is explicit and rejects prerelease/prod or stable/DEV channel mismatches', async t => { const f = await candidateFixture(t, 'main', { version: '0.6.4' }); assert.equal(releaseInputs(f.env).channel, 'stable'); @@ -52,11 +108,11 @@ test('stable stage, native acceptance, latest and exact/prod guides use the same const f = await candidateFixture(t, 'main', { version: '0.6.4' }), store = services(f); await publishNpm(f.directory, f.inputs, store); - assert.equal(store.getLatest(), '0.5.0'); + assert.equal(store.getLatest(), '0.6.3'); 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'); + await assert.rejects(promoteStable(f.directory, f.inputs, store)); assert.equal(store.getLatest(), '0.6.3'); assert.equal(store.writes.length, 1, 'Only stage publication has occurred'); } await writeFile(native, original);