fix(cli): respect SUPABASE_HOME across fallback paths#5624
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09f5cd36b5
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2936f1b2a
ℹ️ 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".
8ee1bde to
2861345
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
1 similar comment
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
96d2c45 to
7eeaa52
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
7eeaa52 to
dcd6f76
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Route the Go CLI's global state paths through a single utils.SupabaseHomeDir() helper so SUPABASE_HOME consistently overrides the access-token, profile, telemetry, and Deno-binary locations instead of being honored only by telemetry state. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add a pure resolveSupabaseHome(env, homeDir) helper as the single TS source of truth for the SUPABASE_HOME contract (trimmed, non-empty, else <homeDir>/.supabase). The next and legacy shells both resolve through it for the access-token fallback, persisted profile, and telemetry-state paths, so state written under SUPABASE_HOME in one shell is found by the other. Libraries stay env-agnostic: the CLI owns SUPABASE_HOME and threads the resolved path to @supabase/stack as cacheRoot rather than the library reading the env var itself. Update the legacy login/logout e2e tests, which asserted the old hard-coded ~/.supabase path; the e2e harness sets SUPABASE_HOME, so the token now lands at <SUPABASE_HOME>/access-token. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Update auth, telemetry, and login/logout docs to describe the global state root as <SUPABASE_HOME or ~/.supabase> instead of hard-coding ~/.supabase, and note the legacy Go Deno binary path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
dcd6f76 to
0bc5569
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
What changed
Routes the global CLI state root through a single
SUPABASE_HOMEresolver in each language the CLI is written in, soSUPABASE_HOMEconsistently overrides every machine-global state path instead of being honored on some paths and hard-coded to~/.supabaseon others.utils.SupabaseHomeDir()helper, used by the access-token, profile, telemetry, and Deno-binary paths. Previously only telemetry state honoredSUPABASE_HOME.resolveSupabaseHome(env, homeDir)helper as the single source of truth, used by both thenextandlegacyshells for the access-token fallback file and the persisted profile file.<SUPABASE_HOME or ~/.supabase>.Why
SUPABASE_HOMEis the documented global state root, but several paths bypassed it. Most concretely, thenextshell honoredSUPABASE_HOMEfor the access-token file while the Go andlegacyshells hard-coded~/.supabase— so a token or profile written under a customSUPABASE_HOMEby one shell was not found by another. This aligns every path on the documented behavior.Design notes
SUPABASE_HOMEis treated as an application (CLI) concern. The resolver lives only in the two languages the CLI is written in (Go and TypeScript). Libraries stay env-agnostic:@supabase/stackcontinues to receive its cache root from the CLI as an explicitcacheRootand never readsSUPABASE_HOMEitself, and@supabase/configis project-local and unaffected. This keeps@supabase/stackergonomic for standalone and test use (an optionalcacheRootwith a plain~/.supabasedefault).This keeps a single relocatable home (no separate
SUPABASE_CACHEDIRor XDG split), matching theCARGO_HOMEprecedent referenced in the issue. The access token's primary store is the OS keychain; theSUPABASE_HOMEfile is only the no-keyring fallback.Closes #5214.