Skip to content

fix(cli): functions deploy --jobs validation + bundler routing (Go parity)#5797

Draft
Coly010 wants to merge 2 commits into
developfrom
columferry/cli-1861-functions-deploy-fix-jobs-validation-condition-and-message
Draft

fix(cli): functions deploy --jobs validation + bundler routing (Go parity)#5797
Coly010 wants to merge 2 commits into
developfrom
columferry/cli-1861-functions-deploy-fix-jobs-validation-condition-and-message

Conversation

@Coly010

@Coly010 Coly010 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix (Go parity).

What is the current behavior?

supabase functions deploy --jobs diverges from the Go CLI in two related ways:

  1. The --jobs guard only errored when local bundling (Docker/legacy-bundle) was active, so --use-docker=false --jobs 2 (no --use-api) silently passed in TS while Go rejects it. The error text also differed from Go's wording.
  2. useLocalBundler decided Docker-vs-API routing based on whether --use-api was typed on the command line (explicitUseApi), not its resolved value — so --use-api=false alone silently forced the API bundler instead of falling through to Docker, contrary to Go's if useApi { useDocker = false } (which only fires when the resolved value is true).

Go's only guard (apps/cli-go/cmd/functions.go:79-82) is:

if useApi {
    useDocker = false
} else if maxJobs > 1 {
    return errors.New("--jobs must be used together with --use-api")
}

What is the new behavior?

  • --jobs > 1 is now rejected whenever --use-api's resolved value is false, regardless of --use-docker/--legacy-bundle, with the exact Go error text: --jobs must be used together with --use-api.
  • Bundler routing (useLocalBundler) now keys off the same resolved flags.useApi value, so --use-api=false alone falls through to Docker/legacy-bundle instead of silently switching to the API path.
  • Both fixes land in the shared deployFunctions() used by both the legacy and next shells, with regression coverage added in both.

Fixes CLI-1861.

Coly010 added 2 commits July 6, 2026 18:25
Go's only --jobs guard (cmd/functions.go:79-82) is `if useApi { ... }
else if maxJobs > 1 { error }` — keyed on the resolved --use-api value,
independent of Docker/legacy-bundle. The TS port instead guarded on
`!explicitUseApi && (useDocker || legacyBundle)`, so --use-docker=false
--jobs 2 silently passed in TS while Go rejected it, and the error text
diverged ("cannot be used with local bundling" vs Go's "--jobs must be
used together with --use-api").

Fixes CLI-1861.
…i too

Review of the --jobs guard fix surfaced the same presence-vs-resolved-value
bug one line above it: useLocalBundler keyed off explicitUseApi (true for
--use-api=false, since the flag was still typed), silently forcing the API
bundler even when the user explicitly disabled it. Go's `if useApi {
useDocker = false }` only forces that when the resolved value is true
(cmd/functions.go:79-80), so --use-api=false alone should fall through to
whatever --use-docker/--legacy-bundle already resolved to.

Also closes two test-coverage gaps flagged in review: the next/ shell shares
deployFunctions() but had no --jobs guard coverage, and --jobs 0's
normalize-to-1 branch had zero hits in either shell.
@Coly010

Coly010 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 6f04c0873d

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

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.

1 participant