Skip to content

Warn once when compiled writer falls back under CSP / no-eval - #2771

Open
pullfrog[bot] wants to merge 1 commit into
mainfrom
pullfrog/2758-warn-once-eval-fallback
Open

Warn once when compiled writer falls back under CSP / no-eval#2771
pullfrog[bot] wants to merge 1 commit into
mainfrom
pullfrog/2758-warn-once-eval-fallback

Conversation

@pullfrog

@pullfrog pullfrog Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Closes #2758.

The getCompiledWriter function in packages/typegpu/src/data/compiledIO.ts warns on every call when EVAL_ALLOWED_IN_ENV is false (CSP/no-eval environments). For apps that hit this path repeatedly, this floods the console.

Add a module-level didWarnAboutEvalFallback flag so the warning is emitted only once per page/process. The fallback behavior itself is unchanged.

Pullfrog  | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot could not run the full agentic suite for this review because it was automatically requested on a bot-authored pull request. Request a review from Copilot under Reviewers to retry with the full agentic suite. Improved support for bot-authored pull requests is coming soon.

Reduces repetitive log output when eval is disallowed by warning only once before falling back to the default writer path.

Changes:

  • Added a module-level guard (didWarnAboutEvalFallback) to ensure the fallback warning is emitted once.
  • Wrapped the existing logger.warn call in a one-time check within getCompiledWriter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

Copy link
Copy Markdown

pkg.pr.new

packages
Ready to be installed by your favorite package manager ⬇️

https://pkg.pr.new/software-mansion/TypeGPU/eslint-plugin-typegpu@2bba51dad608304d0d38f3cf41b2d1875462ea82
https://pkg.pr.new/software-mansion/TypeGPU/tgpu-gen@2bba51dad608304d0d38f3cf41b2d1875462ea82
https://pkg.pr.new/software-mansion/TypeGPU/tinyest-for-wgsl@2bba51dad608304d0d38f3cf41b2d1875462ea82
https://pkg.pr.new/software-mansion/TypeGPU/typegpu@2bba51dad608304d0d38f3cf41b2d1875462ea82
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/cli@2bba51dad608304d0d38f3cf41b2d1875462ea82
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/color@2bba51dad608304d0d38f3cf41b2d1875462ea82
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/gl@2bba51dad608304d0d38f3cf41b2d1875462ea82
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/noise@2bba51dad608304d0d38f3cf41b2d1875462ea82
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/radiance-cascades@2bba51dad608304d0d38f3cf41b2d1875462ea82
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/react@2bba51dad608304d0d38f3cf41b2d1875462ea82
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/sdf@2bba51dad608304d0d38f3cf41b2d1875462ea82
https://pkg.pr.new/software-mansion/TypeGPU/@typegpu/three@2bba51dad608304d0d38f3cf41b2d1875462ea82
https://pkg.pr.new/software-mansion/TypeGPU/unplugin-typegpu@2bba51dad608304d0d38f3cf41b2d1875462ea82

benchmark
view benchmark

commit
view commit

@github-actions

Copy link
Copy Markdown

Bundle size comparison (import * as ... in PR vs import * as ... in target):

🟢 Decreased ➖ Unchanged 🔴 Increased (max 0.01%) ❔ Unknown
0 301 21 0

import { ... } in PR vs import * as ... in PR (is the library tree-Shakeable?):

Test tsdown
tgpu_init.ts 259.55 kB ($${\color{green}-3.2\%}$$)
tgpu_initFromDevice.ts 259.02 kB ($${\color{green}-3.4\%}$$)
tgpu_resolve.ts 164.93 kB ($${\color{green}-38.5\%}$$)
tgpu_resolveWithContext.ts 164.87 kB ($${\color{green}-38.5\%}$$)
tgpu_bindGroupLayout.ts 69.27 kB ($${\color{green}-74.2\%}$$)
tgpu_mutableAccessor.ts 66.27 kB ($${\color{green}-75.3\%}$$)
tgpu_accessor.ts 66.26 kB ($${\color{green}-75.3\%}$$)
tgpu_privateVar.ts 65.61 kB ($${\color{green}-75.5\%}$$)
tgpu_workgroupVar.ts 65.60 kB ($${\color{green}-75.5\%}$$)
tgpu_const.ts 64.85 kB ($${\color{green}-75.8\%}$$)
tgpu_fn.ts 38.45 kB ($${\color{green}-85.7\%}$$)
tgpu_fragmentFn.ts 38.45 kB ($${\color{green}-85.7\%}$$)
tgpu_vertexFn.ts 38.27 kB ($${\color{green}-85.7\%}$$)
tgpu_computeFn.ts 37.97 kB ($${\color{green}-85.8\%}$$)
tgpu_vertexLayout.ts 27.08 kB ($${\color{green}-89.9\%}$$)
tgpu_comptime.ts 14.77 kB ($${\color{green}-94.5\%}$$)
tgpu_unroll.ts 1.66 kB ($${\color{green}-99.4\%}$$)
tgpu_slot.ts 1.54 kB ($${\color{green}-99.4\%}$$)
tgpu_lazy.ts 1.19 kB ($${\color{green}-99.6\%}$$)

If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.

@github-actions

Copy link
Copy Markdown

Resolution Time Benchmark

---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.94, 1.95, 3.96, 6.34, 7.01, 13.24, 21.07, 24.84]
  line [0.94, 1.85, 4.12, 6.58, 7.42, 12.39, 21.66, 25.26]
  line [0.98, 1.97, 4.23, 6.68, 8.13, 11.52, 21.01, 25.30]
Loading
---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.30, 0.52, 0.71, 0.79, 1.08, 1.13, 1.40, 1.50]
  line [0.29, 0.49, 0.66, 0.78, 1.06, 1.13, 1.37, 1.51]
  line [0.31, 0.51, 0.70, 0.86, 1.13, 1.23, 1.48, 1.59]
Loading
---
config:
  themeVariables:
    xyChart:
      plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
  title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
  x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
  y-axis "time (ms)"
  line [0.88, 2.18, 4.46, 6.81, 12.45, 26.37, 53.13, 109.35]
  line [0.73, 2.09, 3.95, 6.53, 12.05, 26.69, 52.86, 109.39]
  line [0.96, 2.04, 4.18, 6.78, 13.13, 26.69, 55.67, 114.32]
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warn once when compiled writer falls back under CSP / no-eval

1 participant