Skip to content

ci: derive canary base from changesets - #4504

Merged
Grapedge merged 1 commit into
MoonshotAI:mainfrom
kimi-agent-bot:feat/canary-changeset-base
Oct 29, 2026
Merged

Grapedge merged 1 commit into
MoonshotAI:mainfrom
kimi-agent-bot:feat/canary-changeset-base

Conversation

@kimi-agent-bot

Copy link
Copy Markdown
Collaborator

Requirement or Bug

让 CLI Canary 的基准版本使用 changesets 推算的下一版本,使预发布命名更符合直觉。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

 prepare(目标 main SHA)
   选择最新 main commit
+  安装仓内锁定的 pnpm 依赖
   计算 Canary 版本
+    在新的临时目录执行 pnpm changeset status --output <file>
+    release plan 有 CLI 项:base = 该项 newVersion
+    release plan 无 CLI 项:base = package.json version 递增 patch
     完整版本仍由 base + run.created_at + GITHUB_SHA 组成
  • 依赖传播产生的 CLI 项即使 changesets=[],也直接使用其 newVersion。
  • status 非零、输出缺失、JSON/结构异常、CLI 项异常或版本非法都会停止 prepare,不会误走 fallback。
  • 不使用 snapshot,不改变 run.created_at、GITHUB_SHA 或既有时间/commit 生成逻辑,因此同一 run 重跑的完整版本不变。
  • 不增加 stable 版本比较或门禁,不改客户端、npm 默认开关、Release 资产和既有 Canary 防倒退 guard。

Behavior Changes and Affected Users

行为 改动前 改动后 依赖旧行为的人 退路
release plan 有 CLI 项时的 base 直接取 apps/kimi-code/package.json 当前版本 取 CLI 项的 newVersion 阅读 Canary 版本号的用户与发布自动化 无;这是已明确批准的命名调整
release plan 没有 CLI 项 同上 从 package.json 版本递增 patch 合入 main 但没有 changeset 的内部改动之 Canary 发布 不适用;这类发布仍会正常进行
changeset status 或输出异常 不调用 status,仍使用 package.json 版本 prepare 明确失败 Canary 发布运维 修复后重跑;不会静默退回旧命名规则

未改变完整版本格式、同一 run 重跑语义、38 项 Release 资产、prerelease/latest=false、npm 默认关闭、stable/latest/latest.json 或客户端通道判断。

验证:

  • node --test scripts/release-trigger.test.mjs scripts/canary-release.test.mjs:19/19 通过,其中新增 5 项覆盖 patch/minor/major、正常 fallback、依赖传播及 status/输出失败。
  • 在 base 0c63065fbd7386132b3b8c914de37adfff4c8daf 上经新实现实际执行 pnpm changeset status:package.json 为 2.4.0,CLI newVersion 与最终 base 均为 2.4.1。
  • pnpm run typecheck:通过。
  • pnpm run lint:0 errors;两个变更脚本单独检查为 0 warnings / 0 errors。
  • git diff --check:通过。
  • 未做生产 Canary dispatch 或真实 CDN 验证。

Checklist

  • I have read the CONTRIBUTING document.
  • Related requirement is documented above; this is not an external issue-driven PR.
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete; the approved naming adjustment and its lack of an escape hatch are explicit.
  • Ran gen-changesets skill; this CI/release-tooling-only PR needs no changeset.
  • Ran gen-docs skill; this change does not affect CLI usage or user documentation.

@changeset-bot

changeset-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: af227b7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T17:56:19.343389Z af227b7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Oct 28, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@af227b7
npx https://pkg.pr.new/@moonshot-ai/kimi-code@af227b7

commit: af227b7

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af227b7ac1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread scripts/canary-release.mjs Resolved
@Grapedge
Grapedge merged commit ebe14e1 into MoonshotAI:main Oct 29, 2026
17 checks passed
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 5, 2026
Port of upstream MoonshotAI/kimi-code 9793044 (MoonshotAI#4425) with the rest of
the chain it opened: b9fa2b1 (MoonshotAI#4469), 84a392e (MoonshotAI#4490),
ebe14e1 (MoonshotAI#4504) and f695b1f (MoonshotAI#4512). They land together because each
one rewrites files the previous introduced, and the dev->canary rename in
the middle would otherwise create and delete the same script twice.

A release channel is now part of every update decision. `stable` keeps the
existing CDN /latest + /latest.json feed; `canary` reads the
/channels/canary.json pointer and never falls back to stable, because the two
are different release lines. The rename from `dev` to `canary` (MoonshotAI#4490) is
part of this landing, so the channel name, the CDN pointer and the canary
release script's `-canary.` version suffix all agree. The channel comes from the installed version's prerelease
tag, KIMI_CODE_UPDATE_CHANNEL, or the homebrew install source (always
stable); an unusable value warns and keeps the installed channel. A pointer
for another channel is a switch, not an upgrade, and only the interactive
prompt can act on it.

The update cache and the staged native record both carry the channel, so a
stage downloaded for one line is never adopted by the other, and the hidden
downloader takes --channel / --switch-channel alongside --manual. Rollout
gating stays off for a switch. The canary release script derives its base
version from `changeset status` and refuses a run that would replace a
newer published canary.

CI gains a scripts-tests job: the root test run covers the workspace
packages only, so scripts/test (release trigger, canary release) had no job
running it anywhere.

Local-form notes:
- The fork's update tree was restructured by 8c865f4 (MoonshotAI#2994 staged
  swap): preflight injects spawn/clock through PreflightDeps, the install
  lock and auto-install gates live in install-lock.ts / auto-install.ts,
  and main() moved to cli/main.ts. The ported code keeps that shape
  instead of upstream's parameter lists.
- All new copy goes through t() with en/zh keys (14 new keys) rather than
  upstream's literals, because check:no-hardcoded-prose is a baseline gate
  here. Regenerating that baseline after the change lowers sub/upgrade.ts
  from 8 to 7 literals (the install failure message is localized now) and
  rewrites the digests of update/cdn.ts and update/native-swap.ts for
  reworded diagnostics.
- The CDN URL helpers live in constant/region-urls.ts here, not
  constant/app.ts, so kimiCodeCdnDevChannelUrl is added there.
- The fork prompts from the cache and revalidates after the user accepts,
  so the tests pin the prompt at the cached plan and the install at the
  refreshed one; upstream refreshes before prompting.
- ci.yml gets a bun scripts-tests job instead of upstream's node
  release-workflow-tests, and the canary workflow uses bun plus
  `bun pm pkg set` / `bun publish` in place of pnpm and node. The canary
  publish keeps upstream's repository_owner guard, so this fork's CI never
  publishes; per AGENTS.md the release/publish commands themselves are
  still not run from this repository.
- native-stage's two new guards are localized too, since the baseline is
  shrink-only and may not absorb new literals.

Verified: apps/kimi-code typecheck clean apart from two untouched TUI test
files (footer/welcome) that are already red at HEAD; test/cli/update 14
files 215 pass, update-download 20, upgrade 17, native-stage 34/1 skip,
scripts suite 228; oxlint --type-aware 0 errors on the touched files;
check:no-comments, check:no-hardcoded-prose, check:locale-keys,
check:locale-placeholders, check:t-coverage and check:status-surface-i18n
green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants