Conversation
bhabishnu
left a comment
There was a problem hiding this comment.
tested this locally and it seems to work as expected for me. valid strands values with sin() and 2-arg atan() no longer hit false FES errors, while an invalid 3-arg atan() still gives the friendly parameter error.
I didn't notice any new tests for this path in the diff. maybe it'd be worth adding coverage for these cases?
There was a problem hiding this comment.
hi @Ayush4958 I tested it locally and have found few things
1. This turns off FES for a bunch of normal functions (the main issue)
The sig === true bypass runs even when we are not inside strands. So map, lerp, random, noise, millis, color, texture, red, hue, float, int etc. lose param validation in regular sketches
map('a', 'b');
// main: "Expected at least 5 arguments, but received fewer in map()"
// this PR: nothingThe build*Shader regex does the same thing, so buildMaterialShader('nope') gets no friendly error either. Can the bypass only apply when p5._isStrandsContextActive is true?
2. FES doesn't actually run inside buildMaterialShader()
buildMaterialShader is a decorated p5 method, so every call inside its callback counts as an internal call and validation is skipped. I ran the sketch from your description on main and on this branch, in global and instance mode, and got the same output both times. For atan(1, 2, 3) the only error is the existing strands one
your screenshots show this too: the "Before" console is empty (no false warnings), and the "After" one only has the experimental notice, which prints on main as well. I only saw the new FES path run with baseMaterialShader().modify(...)
3. With .modify(), the error shows up twice
atan(1, 2, 3) gives the strands error plus a new FES one that points at [strands_transpiler.js, line 2027] instead of the user's sketch. Strands already checks arg counts for builtins, so do we need the overload schema in validate() at all?
|
@Ayush4958 couple of small things too, like a quick test can be added that |
Resolves #7899
Changes:
This PR re-enables FES for
p5.strandswhile resolving the false negative errors that previously forced it to be disabled.src/strands/p5.strands.js: Re enabled FES by dynamically tracking when a strands compilation context is active.src/friendly_errors/param_validator.js: Updated FES validation logic to supportStrandsNodearguments, eliminating false negatives for functions likesin()that wrap parameters in dynamic nodes. Also added a FES bypass for shader builder functions so they can handle and display their own internal error messaging.src/strands/strands_api.js: Exported GLSL specific function signatures (e.g.,atan()taking 1 or 2 arguments) so FES correctly validates and permits valid GLSL syntax without throwing warnings.Screenshots of the change:
Code Used for Testing :-
Before

After

PR Checklist
npm run lintpasses