Repository navigation
fix: add friendly errors for hook lifecycle misuse - #9235
Conversation
|
🎉 Thanks for opening this pull request! For guidance on contributing, check out our contributor guidelines and other resources for contributors! Thank You! |
davepagurek
left a comment
There was a problem hiding this comment.
Thanks for making this, it's looking good! One suggestion: we know the name of the hook most of the time, right? Would we be able to make it say like (e.g.) "filterColor requires a value. Make sure to call filterColor.set(value) before filterColor.end()" to be more specific about what the user needs to write?
|
Thanks for the suggestion. I’ve updated all three lifecycle messages to include the hook name and added a finalColor regression test. All 164 tests in p5.Shader.js pass locally. I also need to clarify the AI usage: Claude Code generated this follow up implementation and test changes, with ChatGPT assisting with review. I checked the AI Usage Policy afterward and see that this went beyond the assistive use it asks for. How would you prefer me to handle this revision? |
Thanks for asking, I think being open about this and talking about it is always the right path if you're unsure! We want to make sure that contributors are understanding the code that they're working with, so we think every line should be read and reviewed. Generally we want to make sure there's a human "at the wheel" so to speak, and that seems feasible with review of code for small PRs like this. For larger PRs that touch many things or make architectural changes, it's harder, so I'd personally encourage reviewing in small chunks so that you can still build a mental model for yourself of what is happening. Ultimately we just want to make sure there's always someone who understands each piece of the codebase. In this instance it's small and easily reviewable so I think it's ok with disclosure like you've done! |
davepagurek
left a comment
There was a problem hiding this comment.
Looks good now, thanks for the updates!
|
@all-contributors please add @bhabishnu for bug, code |
|
I've put up a pull request to add @bhabishnu! 🎉 |
|
Thanks for reviewing and merging this! I appreciate you taking the time to explain the AI guidance too. I’ll make sure I understand and review every change I submit, and keep the AI assistance disclosed. |
Resolves #9232
Changes:
set()is called outside a hook'sbegin()/end()block.end()without a value.begin()is called without a matchingend().Testing:
npm test -- test/unit/webgl/p5.Shader.js— 164 passednpm run lint— 0 errors (8 existing warnings)git diff --check— cleanScreenshots of the change:
N/A
AI usage: Used ChatGPT for debugging and review. Claude Code generated the follow up implementation and regression test changes.