fix(frontend): add prism/r type shim so tsc unblocks Cloud Build#7052
Merged
Conversation
The `react-syntax-highlighter/dist/esm/languages/prism/r` import added in PR #6944 has an ambient declaration in `@types/react-syntax-highlighter`, but with `moduleResolution: bundler` tsc resolves it to the sibling .js file first and never reaches the @types index — TS7016 trips `tsc && vite build` in the frontend Cloud Build trigger. The image never gets rebuilt, so Cloud Run keeps serving the pre-#6961 revision and the landing strip still shows `languages: 1`, the `/libraries` page is still missing the ggplot2 card, and the R code viewer is still empty even though those fixes are merged on main. A project-local shim takes precedence over @types and is enough to get `yarn build` green again, which lets the next merge to main publish the already-merged frontend changes.
PR #6961 deferred a known `tsc` error under "Out of scope" and that deferral broke every subsequent frontend Cloud Build — the language count, ggplot2 card, and R code viewer fixes never reached anyplot.ai even though the PR merged green. Codify the rule so the next latent blocker gets fixed in the same PR instead of parked.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Why
The frontend changes from PR #6961 —
languagescount on the landing strip, ggplot2 card on/libraries, R code viewer on/scatter-basic/r/ggplot2— are merged onmain, but production still shows the pre-#6961 state:All served assets carry
last-modified: Sat, 16 May 2026 20:04:15 GMT— about 2.5 h before #6961 merged. The API was redeployed (/statsnow returns"languages":2,"libraries":10), but the frontend Cloud Run revision is stale.Root cause
The frontend Cloud Build (
app/cloudbuild.yaml→yarn build=tsc && vite build) fails at thetscstep:@types/react-syntax-highlighteractually does ship an ambient declaration for this exact path (line 2768 of itsindex.d.ts), but withmoduleResolution: "bundler"tsc resolves the import to the sibling.jsfile first and never reaches the @types index — onlyrtrips,pythonfrom the line above happens to resolve through the cached package types. Net effect:tscexits non-zero,vite buildnever runs, no new Docker layer, Cloud Run keeps serving the previous revision.Docker build log confirmed this:
PR #6961 listed this exact TS error under "Out of scope" — it had been latent since #6944 added the R import, and only became a deploy blocker because #6961 was the first frontend-touching PR after the lib bumps that affect tsc behavior.
Fix
Add
app/src/types/react-syntax-highlighter.d.tsdeclaring the missing module locally. A project-local shim wins over@types, which is enough to unblocktsc. The runtime import is unchanged — Prism still registers the real R grammar viaregisterLanguage('r', r), and a grep over the rebuiltCodeHighlighter-*.jsconfirms the R keyword set is bundled:So R syntax highlighting on
/scatter-basic/r/ggplot2works as intended.Test plan
cd app && yarn build— green (was failing on TS7016 before)cd app && yarn test— 459/459 greenLandingPage-e58y3raq.jsvs prodLandingPage-Bluw1eOY.js), confirming the redeploy will publish fresh assetsanyplot-appfinishes green;https://anyplot.ai/assets/LandingPage-*.jsno longer contains the hardcoded{value:'1',label:'languages'}languages: 2,/librariesshows the ggplot2 card,/scatter-basic/r/ggplot2code panel renders R code with highlightingNotes
.github/workflows/notify-deployment.yml, which is a no-opechostep that records a GitHub Deployment object — it does not actually report the GCP Cloud Build outcome. Worth a follow-up to either wire the real Cloud Build status back to the commit or rename the workflow so the green check doesn't mislead.Generated by Claude Code