fix: order simple routes before forwards that consume their class#584
Merged
Conversation
82186ec to
39d5dbc
Compare
Collaborator
Author
Scope-generality verificationConfirmed the fix is not user-scope-specific. The Added
The host-attached-user path delivers |
theutz
approved these changes
May 31, 2026
A simple `policy.route` injecting into a home-env class (homeManager, or a custom `hjem` class) was silently dropped. Home-env classes are carried to their host output by makeHomeEnv's `userForward` — a `__complexForward` that reads from the route-application fold state. The route toposort only treated `__complexForward` routes as producers, so the consuming forward could run before the simple route injected its content, losing it. Treat every route as a producer in `topoSortRoutes` so a complex forward that consumes a class is ordered after any route producing into it. Exclude self-references when computing dependencies. Fixes hjemLinux→hjem (and any srcClass→homeManager) routing where the source class lives on a user aspect.
39d5dbc to
6378fbd
Compare
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.
Problem
A simple
den.lib.policy.routeinjecting into a home-env class (homeManager, or a customhjemclass) was silently dropped when the source class lived on a user aspect. Reported against a config whosehjemLinux → hjempolicy never forwarded the user's class data.Root cause
Home-env classes are not assembled in the pipeline pass where the route runs.
home-env.nix:makeHomeEnvcarries the class to its host output viauserForward— a__complexForward(fromClass = homeManager, intohost.classathome-manager.users.<n>).applyComplexRoutereads from the accumulating fold state, so any route producing into itsfromClassmust run first.topoSortRoutesonly registered__complexForwardroutes in itsproducerMap. A simple route producing intohomeManagerwas invisible, so the consuming forward was never ordered after it — and when it ran first, the injected content was already gone.This is why
route → nixos(a host-terminal class) always worked whileroute → homeManagernever did, regardless of scope, schema, or policy signature.Fix
Treat every route as a producer in
topoSortRoutes, so a complex forward consuming a class is ordered after any route producing into it. Self-references are excluded when computing dependencies (also removes a latent spurious self-dependency).Verification
deadbugs/netadr-hjem-route.nixcovers the user-scope-signature and user-self-provide (the reported config's exact shape) cases — both fail before, pass after.#567forward-ordering,route, andforward-*suites.