You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Filters will allow you to include keyword arguments that don't exist:
classMyInteraction < ActiveInteraction::Basestring:beverage,type: :sparkling_wine,bubbles: truedefexecuteputs"Enjoy your #{beverage}!"endendMyInteraction.run!(beverage: 'Cava')
While these vestigial arguments are mostly harmless it could confuse people if they misunderstand the docs or misspell something and then wonder why it doesn't work as they expect
classSquareIds < ActiveInteraction::Basearray:ids,type: :integer,descl: 'Documentation of this filter'defexecuteputsids.map{_1 ** 2}endendSquareIds.run!(ids: [1,2,'BAD'])# bin/script:15:in `block in execute': undefined method `**' for an instance of String (NoMethodError)
A user might think "Why didn't my type checking protect me?" when really it's because type doesn't exist. They should have done:
array:idsdointegerend
But instead they misremembered (or perhaps an LLM hallucinated 😅) there being a type kwarg.
Why isn't the documentation they wrote present? Well they just misspelled desc as descl...but we didn't yell at them.
I haven't dug into the source yet but I'm guessing if we were to add an allowlist to check keywords against we could ensure that only kwargs that actually do something are let through. Assuming maintainers think that's desirable? It could be a breaking change but hopefully not a hard one for users to address (remove your keyword arguments that weren't doing anything in the first place?)
The text was updated successfully, but these errors were encountered:
I'm using ActiveInteraction 5.5.0
Filters will allow you to include keyword arguments that don't exist:
While these vestigial arguments are mostly harmless it could confuse people if they misunderstand the docs or misspell something and then wonder why it doesn't work as they expect
A user might think "Why didn't my type checking protect me?" when really it's because
type
doesn't exist. They should have done:But instead they misremembered (or perhaps an LLM hallucinated 😅) there being a
type
kwarg.Why isn't the documentation they wrote present? Well they just misspelled
desc
asdescl
...but we didn't yell at them.I haven't dug into the source yet but I'm guessing if we were to add an allowlist to check keywords against we could ensure that only kwargs that actually do something are let through. Assuming maintainers think that's desirable? It could be a breaking change but hopefully not a hard one for users to address (remove your keyword arguments that weren't doing anything in the first place?)
The text was updated successfully, but these errors were encountered: