Skip to content

fix: route ensureEntry emitted function instead of attrset - #534

Merged
sini merged 1 commit into
mainfrom
fix/route-ensure-entry-function
May 13, 2026
Merged

sini merged 1 commit into
mainfrom
fix/route-ensure-entry-function

Conversation

@sini

@sini sini commented May 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • When a route with adaptArgs and path had no source modules (empty class), the ensureEntry placeholder emitted (_: { imports = []; }) as the value at the target path
  • This is a function, not an attrset, causing type errors like perSystem.packages receiving <function> instead of { name = drv; }
  • Fix: replace with a plain empty attrset { }

Root cause

apply.nix:166 had lib.setAttrByPath route.path (_: { imports = []; }) — the inner _: made the value a function. The intent was an empty placeholder, but _: { imports = []; } is a lambda, not an empty module.

Test plan

  • test-empty-route-not-function — route with no source modules produces valid attrset
  • Full CI: 787/787 passing

@sini
sini requested a review from vic as a code owner May 13, 2026 22:40
@github-actions github-actions Bot added the allow-ci allow all CI integration tests label May 13, 2026
When a route with adaptArgs and path had no source modules, the
ensureEntry placeholder produced (_: { imports = []; }) as the value
at the target path. This is a function, not an attrset, causing type
errors in the target class module system (e.g. perSystem.packages
received <function> instead of { name = drv; }).

Replace with a plain empty attrset { }.
@sini
sini force-pushed the fix/route-ensure-entry-function branch from 1e4047d to d59e0fb Compare May 13, 2026 23:49
@sini
sini merged commit f575522 into main May 13, 2026
3 checks passed
@sini
sini deleted the fix/route-ensure-entry-function branch May 13, 2026 23:50
charlesfire pushed a commit to charlesfire/den that referenced this pull request May 16, 2026
## Summary

- When a route with `adaptArgs` and `path` had no source modules (empty
class), the `ensureEntry` placeholder emitted `(_: { imports = []; })`
as the value at the target path
- This is a function, not an attrset, causing type errors like
`perSystem.packages` receiving `<function>` instead of `{ name = drv; }`
- Fix: replace with a plain empty attrset `{ }`

## Root cause

`apply.nix:166` had `lib.setAttrByPath route.path (_: { imports = [];
})` — the inner `_:` made the value a function. The intent was an empty
placeholder, but `_: { imports = []; }` is a lambda, not an empty
module.

## Test plan

- [x] `test-empty-route-not-function` — route with no source modules
produces valid attrset
- [x] Full CI: 787/787 passing
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.

2 participants