Skip to content

fix(cli): match Go's init error texts for already-exists and orioledb gate (CLI-1986) - #5977

Merged
Coly010 merged 4 commits into
developfrom
columferry/cli-1986-init-error-texts-diverge-from-go-already-exists-use-orioledb
Jul 30, 2026
Merged

fix(cli): match Go's init error texts for already-exists and orioledb gate (CLI-1986)#5977
Coly010 merged 4 commits into
developfrom
columferry/cli-1986-init-error-texts-diverge-from-go-already-exists-use-orioledb

Conversation

@Coly010

@Coly010 Coly010 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What changed

supabase init's two error paths on the legacy shell now byte-match the Go CLI (verified by building and running apps/cli-go locally):

  1. Config already exists (no --force) — was a friendlier TS-only message; now:

    failed to create config file: open supabase/config.toml: file exists
    Run supabase init --force to overwrite existing config file.
    

    This is Go's wrapped O_EXCL *os.PathError from utils.InitConfig (config.go:243-246) plus the CmdSuggestion from internal/init/init.go:38-42. The path is Go's relative utils.ConfigPath, so it's constant regardless of cwd/--workdir.

  2. --use-orioledb without --experimental — was The --use-orioledb flag requires --experimental.; now cobra's message from Go's PreRun MarkFlagRequired("experimental") (cmd/init.go:32-36):

    required flag(s) "experimental" not set
    Try rerunning the command with --debug to troubleshoot the error.
    

    The second line is Go's generic recoverAndExit debug hint, which the legacy text output layer already appends when an error carries no suggestion. This follows the same handler-level convention as db dump's data-only gate and vanity-subdomains' desired-subdomain gate (bare message, no Error: prefix — matching Go's SilenceErrors + recoverAndExit rendering, verified against the built binary).

Also fixed while there (issue scope): the shared gitignore append now always prepends \n when supabase/.gitignore exists — even when it's empty — matching internal/init/init.go:80-96 (verified against the built Go binary).

Shell-scoping decision

The shared initProject module stays mechanism-only (it already returned { created: false } and left error shaping to each shell). Error shaping lives at each shell's handler boundary:

  • Legacy gets new legacy-scoped error classes in legacy/commands/init/init.errors.ts with Go's exact bytes.
  • Next deliberately keeps its friendlier texts: the graceful Supabase project already initialized. no-op and The --use-orioledb flag requires --experimental. — now pinned by tests. Its InitExperimentalRequiredError moved from shared/ to next/commands/init/init.errors.ts since it's next-only after this change; the now-unused shared InitAlreadyExistsError was deleted.

The gitignore newline fix is in shared code and applies to both shells (mechanical scaffolding, same bytes as Go).

Notes / deliberately left open

  • Windows: byte parity for the already-exists message now covers Windows too (as of 6d26256) — init.handler.ts selects the message on RuntimeInfo.platform, rendering Go's filepath.Join-built path and ERROR_FILE_EXISTS errno text (failed to create config file: open supabase\config.toml: The file exists.), pinned by an integration test with a mocked win32 platform. Documented in SIDE_EFFECTS.md.
  • Pre-existing, out of scope (flagged during review): normalize-error.ts's MissingOption case renders Error: required flag(s) … not set with an Error: prefix, while the built Go binary prints no prefix via recoverAndExit — worth a separate parity check; apps/cli/CLAUDE.md's porting checklist quotes a stale debug-hint wording ("get more details" vs the actual "troubleshoot the error"); Go's failed to read git ignore file error branch for an unreadable existing .gitignore remains unported.

Fixes CLI-1986
Linear: https://linear.app/supabase/issue/CLI-1986/init-error-texts-diverge-from-go-already-exists-use-orioledb-gate

@Coly010

Coly010 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@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: 2b81bf4ce3

ℹ️ 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 apps/cli/src/legacy/commands/init/init.handler.ts Outdated
@Coly010

Coly010 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 6d26256946

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

@Coly010
Coly010 marked this pull request as ready for review July 29, 2026 12:34
@Coly010
Coly010 requested a review from a team as a code owner July 29, 2026 12:34
@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Supabase CLI preview

npx --yes https://pkg.pr.new/supabase/cli/supabase@08a5c9ace8a14f0797fc71f78443522a9d06f59d

Preview package for commit 08a5c9a.

@kanadgupta kanadgupta 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.

Claude verified it all works as expected so LGTM. It did flag one small issue (see below):

One real issue (inline): SIDE_EFFECTS.md still says the Windows form is not reproduced, which the follow-up commit 6d26256 made stale; the PR description's Windows note is similarly outdated.

Comment thread apps/cli/src/legacy/commands/init/SIDE_EFFECTS.md Outdated
Coly010 added 2 commits July 30, 2026 10:03
…ity (review: kanadgupta)

The Linux/macOS-only parenthetical was stale as of 6d26256, which added
the Windows form of the already-exists error. Document both platform
variants instead of claiming Windows isn't reproduced.
…6-init-error-texts-diverge-from-go-already-exists-use-orioledb
@Coly010
Coly010 added this pull request to the merge queue Jul 30, 2026
Merged via the queue into develop with commit d1ff2df Jul 30, 2026
14 checks passed
@Coly010
Coly010 deleted the columferry/cli-1986-init-error-texts-diverge-from-go-already-exists-use-orioledb branch July 30, 2026 10:04
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.

2 participants