Repository navigation
fix: user-scope detection for home-env batteries and diagram null guard - #533
Merged
Merged
Conversation
sini
force-pushed
the
fix/hjem-battery-missing-input
branch
from
May 13, 2026 21:23
e43e754 to
99f02e7
Compare
Collaborator
|
Fixed my issue! |
theutz
reviewed
May 13, 2026
theutz
approved these changes
May 13, 2026
sini
force-pushed
the
fix/hjem-battery-missing-input
branch
from
May 13, 2026 21:41
99f02e7 to
fc3057a
Compare
Home-env batteries (homeManager, hjem, maid) relied on host.users to
detect class membership, which fails when users come from external
registries resolved via policies (e.g. fleet-demo). Add userDetect —
a user-scope policy that fires at { host, user } context regardless
of how the user was resolved — and wire it into den.schema.user.includes
for all three batteries.
Also guard hjem/maid getModule against missing flake inputs (throw with
actionable message instead of cryptic attr-missing), and fix null
entityInstance coercion in diag/text.nix that crashed diagram rendering.
sini
force-pushed
the
fix/hjem-battery-missing-input
branch
from
May 13, 2026 21:41
fc3057a to
e8eb4c3
Compare
sini
enabled auto-merge (squash)
May 13, 2026 21:42
charlesfire
pushed a commit
to charlesfire/den
that referenced
this pull request
May 16, 2026
…rd (denful#533) ## Summary - **User-scope detection for home-env batteries**: The host-scope battery policy relied on `host.users` to detect class membership, which fails when users come from external registries resolved via policies (e.g. fleet-demo). Added `userDetect` — a user-scope policy on `den.schema.user.includes` that fires at `{ host, user }` context regardless of how the user was resolved. Applied to all three batteries: homeManager, hjem, maid. - **Guard hjem/maid against missing inputs**: `hjem.nix` and `maid.nix` unconditionally accessed `inputs.hjem`/`inputs.nix-maid` in `getModule`, crashing any flake without those inputs. Now throws an actionable error message instead. - **Fix diagram null coercion**: `entityInstance` is explicitly set to `null` in graph entries, but `text.nix` used `or ""` which only catches missing attrs. Changed to proper null-aware checks matching the existing `instOf` pattern from `graph.nix`. ## Test plan - [x] 786/786 CI tests pass - [x] `nix eval --override-input den . ./templates/fleet-demo#den` evaluates cleanly - [x] `nix flake check --override-input den . ./templates/minimal` passes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
User-scope detection for home-env batteries: The host-scope battery policy relied on
host.usersto detect class membership, which fails when users come from external registries resolved via policies (e.g. fleet-demo). AddeduserDetect— a user-scope policy onden.schema.user.includesthat fires at{ host, user }context regardless of how the user was resolved. Applied to all three batteries: homeManager, hjem, maid.Guard hjem/maid against missing inputs:
hjem.nixandmaid.nixunconditionally accessedinputs.hjem/inputs.nix-maidingetModule, crashing any flake without those inputs. Now throws an actionable error message instead.Fix diagram null coercion:
entityInstanceis explicitly set tonullin graph entries, buttext.nixusedor ""which only catches missing attrs. Changed to proper null-aware checks matching the existinginstOfpattern fromgraph.nix.Test plan
nix eval --override-input den . ./templates/fleet-demo#denevaluates cleanlynix flake check --override-input den . ./templates/minimalpasses