build: serialize cli release build after tests - #464
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 2121876 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen 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 |
f287373 to
2121876
Compare
There was a problem hiding this comment.
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-releasedepend oncli:test. - Make Vitest global setup assert that the built oclif command files exist and that
oclif commands --jsondiscoversstatusbefore any test runs. - Refactor the in-process CLI test helper to use a shared
cliPackageRootand 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. |
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.
Summary
cli:build-releasetocli:testso the production-stamped CLI build cannot clean and rewriteapps/cli/distwhile Vitest is exercising oclif command discovery from that same directory.oclif commands --jsondiscoversstatusbefore any test files run.Validation
moon run cli:build-release(runscli:testbefore the production CLI build; captured log showscli:test101 files / 672 tests passed andcli:build-releasecompleted)moon run cli:typecheckmoon run cli:lintnode scripts/check-changesets-status.mjs --base origin/main --summarycorepack pnpm exec changeset status --since origin/maingit diff --check origin/main...HEADRelease 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
0547b8c3/ ci: build embedded UI through Moon #319 and the release build DAG fromb0ba758a/ build: improve release DAG artifact freshness #418, which introducedcli:build-releaseas a CI-visible production build that cleans the sameapps/cli/distdirectory.statusexit-127 class withcli:build,cli:test, andcli:build-releaseall building CLI dist in the same full-pr graph. PR feat: added project api spec for list and patch #462 and the older filtered failed logs did not show this oclif/status signature.