Fix question update corrupting v0.59+ cards with template tags#17
Merged
rohanraarora merged 1 commit intoApr 20, 2026
Merged
Conversation
The update path wrapped stages[0].native as {query, template-tags}. Metabase
v0.59+ saved the object but the query processor failed to substitute
parameters, leaving the card unrunnable. Now emits native as a string with
template-tags at the stage level, matching native-UI-authored cards. Also
heals cards previously corrupted by this bug on next update.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
question updatecorrupting v0.59+ cards whenever template tags are involved. The update path wrappedstages[0].nativeas{query, template-tags}; Metabase saved it but the query processor couldn't substitute parameters, leaving cards unrunnable (Card does not have a template tag named X/No matching clause).nativeas a string and puttemplate-tagsat the stage level, matching native-UI-authored cards. Extracted as a pure helperbuildDatasetQueryUpdateinsrc/commands/question.ts.test/question-update.test.tscovering both v0.59+ stages and legacy shapes, including the exact corrupted-card payload from the repro.nativeis unwrapped back to a string).Test plan
npm run typechecknpm run lint(no new warnings)npm run format:checknpm test— 123/123 passing (7 new)metabase.codingninjas.comv0.59.4: reproduced corruption pre-fix; post-fix, create → update with tags → run → second update → run all succeed; storeddataset_querymatches native UI shapequestion create,query run, exports, reads) — all healthy🤖 Generated with Claude Code