BUG: Unexpected result for `host.hasAspect`
Description
host.hasAspect in the conditional of a policy.when call returns true for a host that does not include the aspect if a host that gets evaluated before has included said aspect.
Tests can be found here: https://github.com/tschan/den-hasaspect-bug
The first test has a host that includes the aspect before the host that checks with hasAspect (this one fails) while the second test switches this order around (this one passes).
Can you verify if this still occurs against the soon to be merged #563?
Still fails against https://github.com/sini/den/commit/a7e86b97e99cee7f8be29eb2e67e30d8b6e8737d
Thanks, I'll land a fix with #563 -- it's in the code path it touches so doesn't adjust the scope. :)
Found the root cause; it wasn't correctly constraining scope allowing for cross-host pollution. Sorry about that -- that's a decidedly nasty regression. It's fixed on #563 now.
Awesome, thank you for fixing the problem so quickly.
With this I also realized a change in behaviour that I'm not sure is intentional or not. To be clear: This change was not introduced in your commit fixing the original issue but exists when comparing current main and your feature branch.
This is the test running on current main. It passes: https://github.com/tschan/den-hasaspect-bug/blob/a55a3590325f575293cc0cf19e139a086c731da8/modules/bug.nix
Now changing to your feature branch makes the exact same test fail: https://github.com/tschan/den-hasaspect-bug/blob/c37b675b731a5a28620ee02bc66243c42862d812/modules/bug.nix
That's what I get for running parallel development branches. 🤦 I'll make sure #602 gets properly honored in #563 and expand test coverage for it.
@tschan #563 should now be fixed; thanks for the report -- I'm working on a test coverage matrix now. :)
This is also fixed now, perfect!
Unfortunately I have found another problem which I think is related to the first case, but instead of evaluation order dependent behaviour with includes it happens with excludes. 🙈
You can find a test case here: https://github.com/tschan/den-hasaspect-bug/blob/d6e0f8891ce7f2f1ffb8528077cd87952217d0f7/modules/bug.nix
Doing a larger refactor on 563 that will increase the scope change but ensure a single logic path. I might not be done until tomorrow though. Will update here after it lands and I'll review and add your test to deadbugs.
I tried with the newest version of your feature branch and everything seems to be working as expected now. Thank you for your quick fixes! 🙂
This is now resolved. Feel free to open an issue for any new observed regressions, the current HEAD of main (baring any major bug discoverys) will serve as the parity target for the next engine rewrite.