fix: Restrict using slot for strings#2700
Conversation
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.69, 1.33, 2.65, 4.26, 5.15, 7.37, 13.87, 15.06]
line [0.67, 1.33, 2.90, 4.29, 4.61, 7.40, 14.18, 17.30]
line [0.70, 1.33, 2.78, 3.80, 4.64, 7.47, 13.82, 15.07]
---
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.20, 0.34, 0.46, 0.54, 0.77, 0.76, 0.92, 1.06]
line [0.21, 0.46, 0.50, 0.62, 0.83, 0.87, 1.00, 1.09]
line [0.20, 0.39, 0.45, 0.57, 0.74, 0.81, 1.02, 1.07]
---
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.73, 1.58, 2.66, 4.15, 8.14, 17.05, 36.32, 74.97]
line [0.69, 1.48, 3.15, 4.26, 8.02, 16.86, 36.96, 75.77]
line [0.76, 1.57, 3.35, 4.08, 8.18, 16.72, 36.58, 73.72]
|
1d3e3cd to
7ee8f2d
Compare
|
@pullfrog review |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — This PR prevents raw WGSL string injection through external maps, slots and TGSL expressions by requiring strings to carry a known schema type or be wrapped in a dedicated ResolvableString marker used for argument names.
- Adds
ResolvableStringto wrap raw-WGSL argument identifiers used during entry-function header generation. - Tightens
ResolutionCtx.resolveso that a bare string without a concrete schema throws a clear error instead of being injected. - Replaces
ctx.resolve(value, dataType).valuecalls withctx.resolveSnippetacross generation code for consistency. - Removes strings from the
isWgsl/Wgsltype union, since they are no longer first-class resolvable values. - Adds tests covering direct, indirect, slot-based and TGSL string-injection cases, and updates existing slot tests to use
d.v3fvalues instead of WGSL string snippets.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — This PR prevents raw WGSL string injection through external maps, slots and TGSL expressions by requiring strings to carry a known schema type or be wrapped in a dedicated ResolvableString marker used for argument names.
- Adds
ResolvableStringto wrap raw-WGSL argument identifiers used during entry-function header generation. - Tightens
ResolutionCtx.resolveso that a bare string without a concrete schema throws a clear error instead of being injected. - Replaces
ctx.resolve(value, dataType).valuecalls withctx.resolveSnippetacross generation code for consistency. - Removes strings from the
isWgsl/Wgsltype union, since they are no longer first-class resolvable values. - Adds tests covering direct, indirect, slot-based and TGSL string-injection cases, and updates existing slot tests to use
d.v3fvalues instead of WGSL string snippets.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
|
Run failed. View the logs →
|
|
Important The runtime guard now rejects strings, but the Reviewed changes — restrict raw string injection into WGSL and route internal identifier strings through a new
|
|
Technical note: I attempted to submit the above feedback via
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — The latest commit aligns the type system with the runtime string-injection restriction.
- Removed
stringfromWgslandisWgsl()so plain JS strings no longer type-check as resolvable values, matching the runtime rejection added earlier. - Clarified the scoped string-identifer path in
ResolutionCtx.resolve()with an inline example showing how identifier snippets carry their concrete schema.
Kimi K2 (free via Pullfrog for OSS) | 𝕏
| entryInput.positionalArgs.map((a) => [a.schemaKey, a.schemaKey]), | ||
| entryInput.positionalArgs.map((a) => [ | ||
| a.schemaKey, | ||
| new ResolvableString(a.schemaKey), |
There was a problem hiding this comment.
I feel like we could use a raw code snippet here, instead of creating a new ResolvableString type
There was a problem hiding this comment.
I guess we could. We would need to lift the limitation about 'argument' origin not being allowed. And then, the data type, origin and side effects would be ignored anyway.

Includes changes from #2703 by @iwoplaza