Repository navigation
cli: don't create tables or indexes on the deployment during codegen - #203
Open
CloudCorpRecords wants to merge 1 commit into
Open
CloudCorpRecords wants to merge 1 commit into
CloudCorpRecords wants to merge 1 commit into
Conversation
`npx convex codegen` calls start_push to get the backend's evaluated schema for the generated bindings, but the request was not marked as a dry run, so the backend provisioned the schema and created tables and indexes on the deployment - contradicting the --help text that says codegen doesn't modify the code running on the deployment. Mark the start_push request as a dry run for codegen runs. `dryRun` is the protocol's established don't-mutate signal (the same one `npx convex deploy --dry-run` relies on). The spinner text is also codegen-aware now instead of claiming to upload functions. Fixes convex#199 Signed-off-by: Rene Turcios <95189389+CloudCorpRecords@users.noreply.github.com>
CloudCorpRecords
force-pushed
the
fix/codegen-no-deploy-199
branch
from
October 20, 2026 21:21
9f4d50c to
6fd83b8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #199.
Root cause
npx convex codegenruns throughstartComponentsPushAndCodegen(src/cli/lib/components.ts), which builds astartPushRequestand callsstartPush->POST /api/deploy2/start_pushto get the backend's evaluated schema for the generated bindings. The request carrieddryRun: options.dryRun, and for a normalnpx convex codegeninvocation that isfalse, so the backend provisioned the schema as part ofstart_pushand created the tables and indexes on the deployment. The CLI only ever needed the evaluated analysis; it never finalizes a push in the codegen path (nofinishPush). The--helptext saying codegen "doesn't modify the code running on the deployment" was therefore wrong in practice.The change (
src/cli/lib/components.ts)start_pushrequest is now marked as a dry run whenever the push is a codegen run (dryRun: options.dryRun || options.codegen, extracted into the exportedisDryRunStartPush()helper).dryRunis the protocol's established don't-mutate signal, the same onenpx convex deploy --dry-runrelies on; the evaluated schema the bindings need is exactly what a dry-run push returns.src/cli/lib/components.codegen.test.tswith a truth-table test pinning the policy: normal deploy is not a dry run,deploy --dry-runis, and codegen always is.Test evidence
npx vitest run: 6/6 passing (5 existing aiFiles tests + the new codegen test).tsc --noEmit --emitDeclarationOnly false: clean, exit 0.Honest limits
The table/index creation happens server-side on
start_push; I could not runcodegenagainst a live deployment from this sandbox, so the backend's dry-run behavior is taken from the protocol's documented contract (deploy --dry-runpreviews without applying). Happy to adjust if the team prefers a dedicated flag over reusingdryRun.