Repository navigation
Conversation
… typegen driver The Swift driver reads these variables from the host environment to find the supabase-typegen binary and its release cache. The generator layer passed only PATH, PATHEXT and ComSpec, so SUPABASE_TYPEGEN had no effect and the cache path resolved relative to the working directory, which put the downloaded binary inside the user's project. Closes CLI-3134
There was a problem hiding this comment.
🤖 AI Review
Both independent reviews reported no findings. Reading the changed code confirmed that the three environment variables reach the typegen host, matching the existing documented Swift behavior. The new tests cover the explicit binary override and both cache locations. No conflict with pending next-branch work was identified. Tests were not run because dependencies are absent from the checkout.
Findings
No issues found.
Stats
Claude findings: 0 · Codex findings: 0 · Confirmed: 0 · Refuted: 0 · Uncertain: 0
Models: claude-opus-5-5 + gpt-6.1-sol · Trigger: auto · Workflow run
This review runs once per PR. A maintainer can request another with a /ai-review comment.
CLI benchmark (Lightweight Commands): no changes foundCommit
API calls: unchanged for all 8 commands. Binary size: 134.8 MB, unchanged. Details: timing ranges, API calls per command, slowest phasesTiming ranges
API calls per command
Slowest phasesNo command moved beyond noise, so there are no phase deltas. Comment |
Summary
supabase gen types --lang swiftgives the Swift driver from@supabase/typegena filtered environment. The driver readsSUPABASE_TYPEGEN,XDG_CACHE_HOMEandHOMEfrom that environment to find thesupabase-typegenbinary and its release cache. The generator layer passed onlyPATH,PATHEXTandComSpec, so:SUPABASE_TYPEGENhad no effect, but the CLI's own error message tells users to set it.Library/Caches/supabase/typegen/<version>/on macOS,.cache/...on Linux). It resolved against the working directory, so the downloaded 23 MB binary landed inside the user's project, and~/Library/Cacheswas never read.This PR adds the three variables to
lookupEnv.SIDE_EFFECTS.mdalready documents them. It also listsSUPABASE_TYPEGENinCLI_NON_CONFIG_ENV_NAMES, so the registry test accounts for it. Other languages do not change: the spawned tool already inherits the full environment, and the Dart driver reads nothing from this object.How this fits the supabase-swift v3 alpha
For the alpha, the Swift driver will stop downloading the prebuilt binary. It will build
supabase-typegenfrom source, at the supabase-swift commit pinned in the app'sPackage.resolved, and cache it by commit (SDK-3043, a separate change in@supabase/typegen). The resolution order becomesSUPABASE_TYPEGEN, then the source build, thenPATH.This PR is still needed for that design, and it lands first:
SUPABASE_TYPEGENstays the first step.XDG_CACHE_HOMEorHOME. Without this fix, the cache path is relative, and the build output would land inside the user's project.The download path that this PR also fixes stays in CLI 3.1.0 until the driver change ships.
Linked issue
Linear: CLI-3134
open-for-contributionlabel (or I'm a Supabase maintainer).How it was tested
types.generator.integration.test.ts, with a fakesupabase-typegen. They cover three cases:SUPABASE_TYPEGEN, a cached release binary underXDG_CACHE_HOME, and one underHOME. All three failed before the fix and pass after it. The two cache tests skip on platforms that have no Swift release asset.test:integrationandtest:unitforsrc/commands/gen/types/pass (176 and 34 tests).bun scripts/build-binary.ts), a Postgres 17 container, and a realsupabase-typegenfrom supabase-swift:SUPABASE_TYPEGEN=<binary>and nothing onPATH, CLI 3.1.0 fails withGenTypesToolNotInstalledError. This branch generates the Swift file.Package.resolvedpins supabase-swift3.0.0-alpha.1, with the binary in~/Library/Caches/supabase/typegen/3.0.0-alpha.1/: CLI 3.1.0 does not find it, and this branch uses it. No files are written to the project.v3.0.0-alpha.1) is not published yet. The download writes to the same path the cache test reads. After SDK-3043, the alpha does not download at all.Checklist
fix(cli): …).pnpm check:allpasses; relevant package tests pass for every touched workspace, andpnpm types:checkpasses for each touched TypeScript workspace (or workspace declaring it). Locally,types:check,lint:check,fmt:checkandknip:checkpass.lint:actions:checkdid not run, becausejactionlintis not installed, and this PR changes no workflow.Why now
supabase-swift v3 launches as Public Alpha on 2026-12-11. Its demo flow is
supabase gen types --lang swift. A CLI release with this fix and the SDK-3043 driver change must ship before that date.