Skip to content

feat: automate app-modules release and app-monorepo sync - #123

Open
huhuanming wants to merge 7 commits into
mainfrom
codex/app-modules-auto-release
Open

huhuanming wants to merge 7 commits into
mainfrom
codex/app-modules-auto-release

Conversation

@huhuanming

@huhuanming huhuanming commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Problem

app-modules needs automatic preview packages for ordinary merged changes, while stable releases must use the version explicitly reviewed in source. npm acceptance alone is not enough to prove that a version is available to consumers.

Release policy

  • A merged same-repository PR that does not change a publishable workspace version gets a CI-only next-patch -alpha.<workflow run number> version across all publishable workspaces and exact internal dependencies, then publishes under npm next. The preview version is not committed to main and does not update app-monorepo.
  • A merged same-repository PR that changes a publishable workspace version publishes the exact synchronized stable version from the PR under npm latest. The workflow does not bump versions or update CHANGELOG. Source PR approval is also release approval for a version-changing PR.
  • A merged fork PR is skipped with a workflow-summary notice and can be released manually.

Publishing and downstream sync

  • Publish only missing packages; if the exact version already exists under another tag, move the selected dist-tag instead of attempting an invalid republish.
  • Poll the npm registry every 45 seconds for at most 10 checks. Continue only after every package version and selected dist-tag are visible.
  • For latest only, update all app-modules pins on app-monorepo x, including mobile npm aliases, components dependencies, and root dependency/resolution pins; refresh the lockfile, check the module-ID registry, and open an app-monorepo PR. Do not auto-merge it.

Validation

  • 30 Node tests pass; git diff --check passes.
  • The workflow passes actionlint, excluding only the local actionlint schema warning for the currently supported GitHub Actions queue: max setting.
  • Preview smoke test from stable 3.0.152: all 41 packages became 3.0.153-alpha.999, the four exact internal dependency pins followed the preview version, Yarn refreshed the lockfile, and dist-tag validation passed.
  • Read-only registry check: all 41 stable 3.0.152 packages exist and would be retagged from next to latest without republishing.
  • Earlier app-monorepo dry run: 41 mobile pins, 4 components pins, and 2 root pins update with no unrelated lines changed.

Required setup and boundaries

  • Install a dedicated GitHub App on app-monorepo with Contents write and Pull requests write. Configure APP_RELEASE_APP_ID and APP_RELEASE_PRIVATE_KEY in app-modules; keep NPM_TOKEN available for npm publishing. These credentials and live end-to-end publishing were not verified in this PR.
  • module-id:update requires a fresh Union Build module-ID map. The dependency PR checks the existing registry, but new native runtime modules still need map generation and a registry update before that PR merges.

@sidmorizon

Copy link
Copy Markdown
Contributor

@codex review

@sidmorizon

Copy link
Copy Markdown
Contributor

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 20, 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-09-20T14:23:18.233772Z cdd5bbb Manual request
ℹ️ 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.

@sidmorizon

Copy link
Copy Markdown
Contributor

Comment thread scripts/sync-app-monorepo.mjs Outdated

@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: cdd5bbbdba

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/prepare-release.yml Outdated
Comment thread .github/workflows/prepare-release.yml Outdated
Comment thread .github/workflows/package-publish.yml Outdated
@sidmorizon

Copy link
Copy Markdown
Contributor

View Devin Review ↗️

Comment thread .github/workflows/prepare-release.yml Outdated
@sidmorizon

Copy link
Copy Markdown
Contributor

Claude review session: https://claude.ai/code/session_01GN4VAXu1Jw39qQ51fL1Yrr

Comment thread .github/workflows/prepare-release.yml Outdated
Comment thread .github/workflows/package-publish.yml Outdated
Comment thread .github/workflows/package-publish.yml Outdated
Comment thread .github/workflows/prepare-release.yml Outdated
@sidmorizon

Copy link
Copy Markdown
Contributor

Local Codex CLI review

Open the review session in Slack

The review runs in a read-only local worktree and continues in this session when the PR receives a substantive commit.

@huhuanming
huhuanming force-pushed the codex/app-modules-auto-release branch from 849537f to 42439d7 Compare September 21, 2026 03:36
return missing;
}

export function selectRetags(workspaces, packuments, distTag) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 P1 selectRetags 会把 next 拨回更旧版本

Problem

本轮把「版本已存在但 dist-tag 不匹配就失败」改成了无条件 npm dist-tag addselectUnpublished 的回退保护只在两端都是 \d+.\d+.\d+ 时生效;prerelease 时 compareStableVersions 返回 null,检查被跳过。selectRetagsscripts/publish-missing.mjs:47-54)只要「该 version 已在 registry 且当前 tag 不是它」就会 retag,没有顺序比较。

本地复现:next 指向 3.0.153-alpha.11 时,工作区 3.0.153-alpha.10 会被选进 retags;workflow_dispatch + next 且工作区仍是已发布的 3.0.152 时,同样会把 next 拨到 3.0.152package-publish.yml 的 preview 只在 pull_request && dist_tag==nextprepare-preview,手动 next 走同一条 publish-missing

Impact

next 是本轮新的 preview 通道。重跑更早的 preview workflow,或按 README 用 manual next 做 recovery,都会把 @pkg@next 从更新的 alpha 拨回旧 alpha 或稳定版。消费 next 的人会突然拿到更旧的包。latest 的稳定回退仍被挡住,所以不是 P0,但是明确的状态/并发缺陷。

Recommendation

retag 前用能比较 prerelease 的顺序:仅当现有 tag 缺失或严格旧于工作区 version 才 dist-tag add;现有 tag 更新则跳过或失败。workflow_dispatch + next 不要把已指向 alpha 的 next 拨到 main 上的稳定版。测试应覆盖「next 指向更新 alpha 时不得回拨」。

Cursor session ↗

Comment on lines +15 to +16
if (!/^\d+\.\d+\.\d+$/.test(left) || !/^\d+\.\d+\.\d+$/.test(right)) {
return null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 P2: Preview reruns move next backwards

Severity: non-severe

Rerunning an older preview lets selectUnpublished accept a newer prerelease carrying next. compareStableVersions skips prereleases, so retagging makes consumers resolve the older preview.

NPM_DIST_TAG: ${{ inputs.npm_dist_tag }}
ONLY_WORKSPACE: ${{ inputs.only_workspace }}
NPM_DIST_TAG: ${{ steps.channel.outputs.dist_tag }}
run: yarn workspace "$ONLY_WORKSPACE" release --tag "$NPM_DIST_TAG"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 P2: Single-workspace retag recovery fails

Severity: non-severe

When a workspace version already exists, release republishes it instead of retagging it. npm rejects the recovery, leaving the requested dist-tag unchanged.

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.

3 participants