Skip to content

fix: hm-host crash with standalone homes + homeManager forwarding - #559

Merged
sini merged 2 commits into
denful:mainfrom
sini:fix/hm-host-schema-bugs
May 20, 2026
Merged

sini merged 2 commits into
denful:mainfrom
sini:fix/hm-host-schema-bugs

Conversation

@sini

@sini sini commented May 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • policy.when arg safety: wrappers now pre-check the predicate's required args against the dispatch context before calling it. Prevents crash when { host, ... } predicates dispatch in non-host contexts (e.g., standalone home resolution via late dispatch).
  • Fold hmHostBridge into makeHomeEnv: added schemaIncludes parameter so the battery's policyFn includes schema content at both host scope (nixos/darwin keys) and user sub-scopes (homeManager keys route via userForward). Eliminates the separate bridge, hasHmUsers, and conditional host includes entry.

Fixes three user-reported issues:

  1. schema.hm-host crashes when a standalone den.homes exists alongside hosts with HM users
  2. schema.hm-host includes with homeManager class keys are silently dropped (nixos keys worked, homeManager didn't)
  3. policy.when with strict predicates crashes in cross-scope dispatch contexts

Test plan

  • 6 new regression tests in deadbugs/ (policy-when arg safety, standalone crash, homeManager forwarding)
  • 829/829 existing CI tests pass
  • nix develop -c just ci clean

@sini
sini requested a review from vic as a code owner May 19, 2026 20:11
@github-actions github-actions Bot added the allow-ci allow all CI integration tests label May 19, 2026
@sini sini changed the title fix(schema): hm-host crash with standalone homes + homeManager forwarding fix: hm-host crash with standalone homes + homeManager forwarding May 19, 2026
sini added 2 commits May 19, 2026 13:45
…ding

policy.when wrappers lost the predicate's argument signature, causing
dispatch in contexts missing required args (e.g. standalone home
resolution hitting a { host, ... } predicate). Pre-check required
args against ctx before calling the predicate.

Fold hmHostBridge into makeHomeEnv via schemaIncludes param — the
battery already gates on mkDetectHost and iterates users. Schema
includes now enter both host scope (nixos/darwin keys) and user
sub-scopes (homeManager keys route via userForward). Eliminates
the separate bridge, hasHmUsers, and conditional host includes.
@sini
sini force-pushed the fix/hm-host-schema-bugs branch from fc3ed6e to 6316024 Compare May 19, 2026 20:45

@drupol drupol left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are passing, let's merge it.

@sini
sini enabled auto-merge (squash) May 20, 2026 13:42
@sini
sini merged commit 8f1a594 into denful:main May 20, 2026
41 of 43 checks passed
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.

3 participants