Skip to content

Per-user parametric host content leaks across users through a custom forward class (#603 regression) #644

Description

@sini

Found while fixing #642 (PR #643). Distinct mechanism, not fixed by that PR.

Symptom

A host-attached parametric aspect feeding a declaring custom forward class delivers every user's content to every user — silently, with no error:

expected { pinguSees = ["pingu"];        tuxSees = ["tux"]; }
actual   { pinguSees = ["pingu" "tux"];  tuxSees = ["pingu" "tux"]; }

Repro

test-parametric-host-content-two-users-no-battery = denTest (
  { den, lib, igloo, ... }:
  let
    shellClass =
      { class, aspect-chain }:
      den._.forward {
        each = lib.singleton class;
        fromClass = _: "myshell";
        intoClass = _: "homeManager";
        intoPath = _: [ "programs" "bash" ];
        fromAspect = _: lib.last aspect-chain;
        guard = { options, ... }: options ? programs.bash;
      };
  in
  {
    den.default.includes = [ shellClass ];

    den.aspects.per-user = { user, ... }: {
      myshell.shellAliases.${user.name} = "mine";
    };

    den.hosts.x86_64-linux.igloo.users = { tux = { }; pingu = { }; };
    den.aspects.igloo.includes = [ den.aspects.per-user ];

    expr = {
      tuxSees   = lib.attrNames (igloo.home-manager.users.tux.programs.bash.shellAliases or { });
      pinguSees = lib.attrNames (igloo.home-manager.users.pingu.programs.bash.shellAliases or { });
    };
    expected = { tuxSees = [ "tux" ]; pinguSees = [ "pingu" ]; };
  }
);

Attribution

That points at the parent pipeline's complex-forward source collection — getCollectedSource / filterRootModules in nix/lib/aspects/fx/edges/route.nix pulling a host root bucket that has already been fanned across users, unprojected.

Why this one matters

Before #603 this shape errored loudly ("already declared"). It now evaluates to a wrong configuration instead — every user gets every other user's content, with nothing in the output saying so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions