fix(cli): render SMS/MFA config templates instead of emitting the raw text/template escape - #5944
Merged
Coly010 merged 2 commits intoJul 27, 2026
Conversation
… text/template escape (CLI-1971)
…mplate constructs (CLI-1971)
Contributor
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 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". |
Contributor
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase/cli/supabase@3b76fc960f91156262050bd6cc46dab3944b14b0Preview package for commit |
kanadgupta
approved these changes
Jul 27, 2026
Coly010
deleted the
columferry/cli-1971-initbootstrap-write-broken-smsmfa-template-lines-into
branch
July 27, 2026 19:35
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
supabase init(and thebootstrapscratch-project path — both go through the sharedrenderProjectConfigTemplateinapps/cli/src/shared/init/project-init.templates.ts) wrote two broken lines into the generatedsupabase/config.toml:for both
[auth.sms]and[auth.mfa.phone]. The Go CLI's template source contains thattext/templateself-escape, but Go renders the scaffold throughtext/template(config.Eject,pkg/config/config.go:555,572), which resolves the backtick raw-string action to the literal GoTrue template. The TS renderer copied the escape verbatim and runs no template engine, so the raw escape landed in users' configs — a functionally broken SMS/MFA OTP template (GoTrue would send the literal text instead of substituting the code).The fix pre-renders the two lines in the TS template constant:
Verified byte-identical against the Go CLI's actual
config.Ejectoutput (dumped via a throwaway Go test harness): these two lines were the only divergence, and after the fix the full generated file matches Go's eject byte-for-byte, including the trailing newline.Test changes
The existing byte-parity test compared the TS render against the raw Go template source, so both sides carried the unresolved escape and the test passed while the shipped output was broken. It now emulates Go's eject-time rendering (
resolveGoTemplateEscapes) before comparing, so it would have caught this bug. Also added:template =lines are the rendered GoTrue templates, not raw Go escapes;{{ ... }}construct the suite does not model, so this class of parity drift cannot silently return (raised by review).Deliberately out of scope (from review)
init/bootstrapwith an affected build keep the raw escape in theirconfig.toml; the manual fix is replacing the twotemplate =lines under[auth.sms]and[auth.mfa.phone]with"Your code is {{ .Code }}". A detect-and-warn on config load (particularly on theconfig pushpath, which can carry the broken template to hosted GoTrue) was suggested in review as a possible fast-follow, but auto-editing or warning about user-owned config is a scope/UX decision beyond this parity fix.Fixes CLI-1971
Linear: https://linear.app/supabase/issue/CLI-1971/initbootstrap-write-broken-smsmfa-template-lines-into-configtoml