den icon indicating copy to clipboard operation
den copied to clipboard

BUG: Forwarding can overwrite each other

Open musjj opened this issue 6 months ago • 2 comments

Description

Failing test: https://github.com/musjj/forwarding-overwrite-bug/blob/main/modules/bug.nix Regression report: https://github.com/musjj/forwarding-overwrite-bug/actions/runs/26721140610

Forwarding can sometimes overwrite each other from different aspects, depending on some conditions:

let
  atuinClass =
    { class, aspect-chain }:
    den._.forward {
      each = lib.singleton null;
      fromClass = _: "atuin";
      intoClass = _: "nixos";
      intoPath = _: [
        "programs"
        "atuin"
      ];
      fromAspect = _: lib.head aspect-chain;
      guard = _: true;
    };
in
{
  den.hosts.x86_64-linux.igloo.users.tux = { };

  den.default.includes = [ den._.mutual-provider ];

  den.aspects.atuin = {
    includes = [
      atuinClass
    ];

    atuin.flags = [
      "--hello"
    ];
  };

  den.aspects.igloo = {
    provides.to-users.includes = [
      den.aspects.atuin
    ];

    atuin.flags = [
      "--world"
      "--baz"
    ];
  };
}

On v0.16.0, programs.atuin.flags will produce [ "--hello" "--world" "--baz" ]

On v0.17.0 (also tested with main + https://github.com/denful/den/pull/578), programs.atuin.flags will only produce [ "--hello" ].

If you remove the atuin.flags inside den.aspects.atuin, programs.atuin.flags will produce [ "--world" "--baz" ]. So for some reason, the atuin.flags from den.aspects.atuin can override the one from den.aspects.igloo.

musjj avatar May 31 '26 18:05 musjj

@musjj Thank you for another quality report. If you've got some bandwidth, could you drop by our matrix channel and give me a ping? I'd like to have a chat with you about your config and get some feedback from you.

sini avatar Jun 01 '26 15:06 sini

Thank you so much for the fix! My config finally can now completely evaluate 🥲

musjj avatar Jun 01 '26 18:06 musjj