Skip to content

build: serialize cli release build after tests - #464

Merged
fforootd merged 1 commit into
mainfrom
codex-cli-vitest-build-readiness
Jul 6, 2026
Merged

build: serialize cli release build after tests#464
fforootd merged 1 commit into
mainfrom
codex-cli-vitest-build-readiness

Conversation

@fforootd

@fforootd fforootd commented Jul 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Add a direct Moon dependency from cli:build-release to cli:test so the production-stamped CLI build cannot clean and rewrite apps/cli/dist while Vitest is exercising oclif command discovery from that same directory.
  • Keep the CLI Vitest global setup self-contained by asserting that the tsdown-built command files exist and oclif commands --json discovers status before any test files run.
  • Remove the runtime 127 retry from the in-process CLI test helper so the test harness fails fast instead of masking a graph/order problem.

Validation

  • moon run cli:build-release (runs cli:test before the production CLI build; captured log shows cli:test 101 files / 672 tests passed and cli:build-release completed)
  • moon run cli:typecheck
  • moon run cli:lint
  • node scripts/check-changesets-status.mjs --base origin/main --summary
  • corepack pnpm exec changeset status --since origin/main
  • git diff --check origin/main...HEAD

Release notes / changeset

Empty changeset added: .changeset/cli-build-release-dag.md. This changes package-local Moon build wiring under @zitadel/cli, but no shipped CLI behavior changes and no package bump is planned.

Notes

@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nextgen Ready Ready Preview, Comment Jul 6, 2026 7:01pm
nextgen-docs Ready Ready Preview, Comment Jul 6, 2026 7:01pm
nextgen-mock-zitadel Ready Ready Preview, Comment Jul 6, 2026 7:01pm

Request Review

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: 2121876

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

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

Not sure what this means? Click here to learn what changesets are.

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

@fforootd
fforootd force-pushed the codex-cli-vitest-build-readiness branch from f287373 to 2121876 Compare July 6, 2026 18:59
@fforootd fforootd changed the title test: harden cli oclif build readiness build: serialize cli release build after tests Jul 6, 2026
@fforootd
fforootd marked this pull request as ready for review July 6, 2026 19:03
Copilot AI review requested due to automatic review settings July 6, 2026 19:03
@fforootd
fforootd merged commit 451b9b2 into main Jul 6, 2026
9 checks passed
@fforootd
fforootd deleted the codex-cli-vitest-build-readiness branch July 6, 2026 19:05

Copilot AI left a comment

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.

Pull request overview

This PR addresses a Moon task-ordering hazard in the CLI project where cli:build-release can clean/rewrite apps/cli/dist while Vitest is still running tests that rely on that directory, leading to intermittent oclif command discovery failures.

Changes:

  • Serialize the Moon DAG by making cli:build-release depend on cli:test.
  • Make Vitest global setup assert that the built oclif command files exist and that oclif commands --json discovers status before any test runs.
  • Refactor the in-process CLI test helper to use a shared cliPackageRoot and remove the exit-127 retry behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
apps/cli/tests/helpers/run-cli.ts Uses shared CLI package root for in-process oclif runs in tests.
apps/cli/tests/helpers/oclif-build.ts Adds readiness checks for built command files and oclif discovery prior to running tests.
apps/cli/tests/helpers/global-setup.ts Runs tsdown build then blocks until oclif discovery is verified.
apps/cli/moon.yml Adds test as a direct dependency of build-release to prevent dist clobbering during tests.
.changeset/cli-build-release-dag.md Adds an (empty) changeset entry for build/DAG wiring changes.

Comment thread apps/cli/tests/helpers/oclif-build.ts
fforootd added a commit that referenced this pull request Jul 7, 2026
Review follow-ups on the editable-config work:

- setup: when default resource seeding fails after the patcher already
  wrote zitadel.json, remove the marker and .zitadel/secret again and
  surface an actionable error. Previously every rerun reported
  'skipped' and the project was stranded with no login flow anywhere
  (server seeded nothing because seedDefaults=false).
- doctor: an empty .zitadel/schemas/ is now a warning, not a failure —
  projects created before editable config have no local schema files
  and there is no safe auto-fix; doctor would have failed permanently
  for every pre-existing project after a CLI upgrade.
- validation: doctor and the flows batch validator now use the
  canonical schemas from @zitadel/config/schemas (same Zod the sync
  engine uses), and the flow syncer no longer parses every file twice.
- moon: replace the per-dist cli mutexes (made redundant by #464's
  build < test < build-release dep chain) with one shared public-dist
  mutex on cli:test and api/config/sdk-next:build-release. The built
  oclif commands import those packages' dists at runtime; their
  release builds cannot take a task dep on cli:test (cli dependsOn
  them — the reverse edge cycles the project graph), so the mutex is
  what keeps a release clean step from wiping a dist mid-test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants