-
-
Notifications
You must be signed in to change notification settings - Fork 751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
action_ref
referential integrity not validated for action-alias
#4372
Comments
Thanks for reporting this. IIRC, we had a discussion on this in the past (I would need to find it) and it was intentional - we allow users to create / register aliases for actions which are not yet registered when alias is registered. Having said that, I will try to find that discussion and re-evaluate the decision. At the very least (if there is a valid use case for the scenario I mentioned above), I do agree that we should at least warn on such scenario on alias register. |
I guess the problem is that you can't guarantee that packs are installed in a certain order (or indeed, if a dependent pack is installed at all). If it threw a fatal error, you could be stuck in a circular dependency hell, unable to install certain combinations of packs. Perhaps needs some WARNING-level, or at least something more graceful? Same situation applies to workflows or rules that reference other packs. |
Thanks for the feedback. I can appreciate dependency hell complexity isn't easily solved and I tend to think a warning should be enough rather than cause fatal errors. I don't how feasible or expensive such an operation would be, however, perhaps another option could be to perform post-import referential integrity in the DB that checks action-aliases, workflows and rules. My thinking is: the user will need to pay for the invalid reference, either at run time or in performing referential checks up front and catching these earlier (at startup) is also how other coherency/syntax errors are reported. |
@LindsayHill Yeah that's part of the problem - unlike other resources, aliases usually cross-reference actions from other packs. @nzlosh I agree and in 99% of the cases I'm advocating for "fail early" (register / check time vs run-time) since it almost always provides better user experience and saves time troubleshooting and debugging things. Having said that - would warning be a good compromise to begin with? |
So maybe this is the right UX: At the end of all registration steps, do cross-reference of all workflows, rules, aliases to identify anything that refers to non-existent actions. Raise non-fatal WARNING message if missing content found Sound right? |
That sounds like a reasonable UX to me. Would this change require an additional flag? Sort of along the lines of a |
I'll pick this task as a warm up task for myself. No, I don't think a -Wall option is a good idea. |
So I opened #4388 to address this and there are different registration paths.
@nzlosh Where do you think the warning makes most sense for you as a user? Do you expect to see a warning on all 3 ways to register that I outlined above? Just making sure we get the UX before I make those changes (they are significant). cc: @Kami, @LindsayHill |
Thanks for the analysis @lakshmi-kannan. A naive response would be as a user I'd expect all paths to behave in the same way since it would be confusing to have one path warn on invalid references and another to silently accept them. That said I've only ever used |
thanks 👍 |
SUMMARY
When action-alias files are parsed and inserted into the database, invalid
action_ref
references are silently accepted.ISSUE TYPE
Pick one below and delete the rest:
STACKSTORM VERSION
Install method: dev source installation
STEPS TO REPRODUCE
Add an action-alias to a pack that references a non-existent action and reload st2.
Simple example
EXPECTED RESULTS
It would be useful to report a referential integrity error/warning when the action-alias file is parsed and references a non-existent action.
ACTUAL RESULTS
We see there is no pack named
st2dm_upgrade_pkg
.Here we see the action-aliases defined to
st2dm_apu
of whichdisable_upgrade
is used to show the problem.Here we see
st2dm_apu.disable_upgade
action alias is available with anaction_ref
that points to a non-existent action.The text was updated successfully, but these errors were encountered: