Skip to content

fix(core): a host-class module taking user survives the user's acceptance - #772

Merged
sini merged 1 commit into
mainfrom
fix/accepted-user-class-fan
Nov 17, 2026
Merged

sini merged 1 commit into
mainfrom
fix/accepted-user-class-fan

Conversation

@sini

@sini sini commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Reported by @minhtrancccp in Matrix, with a repo that reproduces it: since #761, a host-class module in den.default that takes user is lost from a host that accepts that user.

den.hosts.x86_64-linux.laptop.users.admin.userName = "usercccp";
den.aspects.kanata.nixos = { config, user, ... }: {
  services.kanata.enable = true;
  users.groups.uinput.members = [ user.userName ];
};
den.default.includes = [ den.batteries.define-user den.aspects.kanata ];
# services.kanata.enable: true on 1ebb7de4, false on c8e0340f and main

A host accepts its users in transition mode, which is the default until a config sets den.migrations.user-host-content.acknowledged, and under an explicit den.batteries.user-aspects. Both lose the module. Acknowledging the migration without user-aspects hides it, which is why acknowledging fixed it for the reporter.

Cause. #761 fans a host-scope nixos = { user, ... }: module once per user, in handlers/emit-classes.nix. It marked each fanned copy as a shared fan-out, for #694's R6 rule: when the host accepts the user, the user's own copy is lifted to the host, so the host's copy is dropped. The drop in edges/materialize-unified.nix matches modules by their location key. emit-classes gives the fanned copy the same key as the user's own copy, deliberately, so the two dedup, and the drop removed both.

Fix. A class module that fans per user isn't marked as a shared fan-out. Its copy and the user's own carry one key, so the module system applies them once without the drop. Aspect-level fan-out, which bind.nix marks, is unchanged. The helpers that only served the mark (sharedWith, hostIdHash, the include-root lookup) go with it.

This was missed because den's suite runs every cell with the transition defaults off (templates/ci/modules/test-support/end-state.nix), and #761's cells never accepted a user explicitly.

Validation

…ance

A class module that fans per user at host scope was marked as a shared fan-out, for the R6 drop of a host copy when the user is accepted. The drop matches by module key, and the fanned copy carries the user's own copy's key, so both were removed: the module vanished in transition mode and under explicit user-aspects. Don't mark class-level fan-out; the two copies already dedup by key.

Reported in Matrix.
@github-actions github-actions Bot added the allow-ci allow all CI integration tests label Nov 17, 2026
@sini
sini merged commit 12b2146 into main Nov 17, 2026
17 checks passed
@sini
sini deleted the fix/accepted-user-class-fan branch November 17, 2026 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

allow-ci allow all CI integration tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant