Skip to content

BUG: Unexpected result for host.hasAspect #613

Closed

Description

@tschan

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).

Activity

  1. added
    bug
    on Jun 13, 2026
  2. sini commented on Jun 13, 2026

    @sini
    Collaborator

    Can you verify if this still occurs against the soon to be merged #563?

  3. tschan commented on Jun 13, 2026

    @tschan
    Author

    Still fails against sini@a7e86b9

  4. sini commented on Jun 13, 2026

    @sini
    Collaborator

    Thanks, I'll land a fix with #563 -- it's in the code path it touches so doesn't adjust the scope. :)

  5. sini commented on Jun 13, 2026

    @sini
    Collaborator

    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.

  6. tschan commented on Jun 14, 2026

    @tschan
    Author

    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

  7. sini commented on Jun 14, 2026

    @sini
    Collaborator

    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.

  8. sini commented on Jun 14, 2026

    @sini
    Collaborator

    @tschan #563 should now be fixed; thanks for the report -- I'm working on a test coverage matrix now. :)

  9. tschan commented on Jun 14, 2026

    @tschan
    Author

    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

  10. sini commented on Jun 15, 2026

    @sini
    Collaborator

    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.

  11. tschan commented on Jun 15, 2026

    @tschan
    Author

    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! 🙂

  12. sini commented on Jun 15, 2026

    @sini
    Collaborator

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions