fix(cli): match Go's init error texts for already-exists and orioledb gate (CLI-1986) - #5977
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 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".
…o (review: codex)
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@08a5c9ace8a14f0797fc71f78443522a9d06f59dPreview package for commit |
kanadgupta
left a comment
There was a problem hiding this comment.
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.
…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
What changed
supabase init's two error paths on the legacy shell now byte-match the Go CLI (verified by building and runningapps/cli-golocally):Config already exists (no
--force) — was a friendlier TS-only message; now:This is Go's wrapped
O_EXCL*os.PathErrorfromutils.InitConfig(config.go:243-246) plus theCmdSuggestionfrominternal/init/init.go:38-42. The path is Go's relativeutils.ConfigPath, so it's constant regardless of cwd/--workdir.--use-orioledbwithout--experimental— wasThe --use-orioledb flag requires --experimental.; now cobra's message from Go'sPreRunMarkFlagRequired("experimental")(cmd/init.go:32-36):The second line is Go's generic
recoverAndExitdebug hint, which the legacy text output layer already appends when an error carries no suggestion. This follows the same handler-level convention asdb dump'sdata-onlygate andvanity-subdomains'desired-subdomaingate (bare message, noError:prefix — matching Go'sSilenceErrors+recoverAndExitrendering, verified against the built binary).Also fixed while there (issue scope): the shared gitignore append now always prepends
\nwhensupabase/.gitignoreexists — even when it's empty — matchinginternal/init/init.go:80-96(verified against the built Go binary).Shell-scoping decision
The shared
initProjectmodule 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/commands/init/init.errors.tswith Go's exact bytes.Supabase project already initialized.no-op andThe --use-orioledb flag requires --experimental.— now pinned by tests. ItsInitExperimentalRequiredErrormoved fromshared/tonext/commands/init/init.errors.tssince it's next-only after this change; the now-unused sharedInitAlreadyExistsErrorwas deleted.The gitignore newline fix is in shared code and applies to both shells (mechanical scaffolding, same bytes as Go).
Notes / deliberately left open
init.handler.tsselects the message onRuntimeInfo.platform, rendering Go'sfilepath.Join-built path andERROR_FILE_EXISTSerrno text (failed to create config file: open supabase\config.toml: The file exists.), pinned by an integration test with a mockedwin32platform. Documented inSIDE_EFFECTS.md.normalize-error.ts'sMissingOptioncase rendersError: required flag(s) … not setwith anError:prefix, while the built Go binary prints no prefix viarecoverAndExit— 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'sfailed to read git ignore fileerror branch for an unreadable existing.gitignoreremains unported.Fixes CLI-1986
Linear: https://linear.app/supabase/issue/CLI-1986/init-error-texts-diverge-from-go-already-exists-use-orioledb-gate