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@6d26256946b4209709a9ae3faf974f608e46d82cPreview 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.
|
|
||
| Success is emitted as raw text even when the legacy shell is invoked with non-text output modes. | ||
|
|
||
| When `supabase/config.toml` already exists and `--force` is not set (stderr, byte-matching Go's wrapped `O_EXCL` open error and `CmdSuggestion` on Linux/macOS; on Windows the Go CLI surfaces the OS path separator and errno text instead, which this port does not reproduce): |
There was a problem hiding this comment.
This parenthetical is stale as of 6d26256 ("render Windows form of init already-exists error to match Go"): the port now does reproduce the Windows form — init.handler.ts has a win32 branch emitting failed to create config file: open supabase\config.toml: The file exists., and there's an integration test pinning it. Please update this note (and ideally document the Windows two-line output here too, since this file is the parity contract). The PR description's "byte parity is scoped to Linux/macOS" note is similarly outdated.
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
The file exists.). Documented inSIDE_EFFECTS.mdand the error's docstring.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