Repository navigation
fix: nested aspect key merge and includes scoping - #521
Merged
Merged
Conversation
When multiple files define the same nested aspect key (e.g.
den.aspects.system.base.nixos from two modules), the old code
used unwrapContentValuesRaw which produced { imports = vals; }
for multi-value cases. The aspect pipeline doesn't understand
NixOS module imports, so only the last definition survived.
Fix: mergeContentValuesPerKey reconstructs per-sub-key
__contentValues so the pipeline properly collects all class
module definitions.
Includes regression test for the merge bug and a (currently
failing) test for the nested includes auto-walk bug.
…ncluded Content wrappers from aspectContentType (accessed via den.aspects.X.Y in an includes list) carry __contentValues at the top level. Their nested sub-keys are independent sub-aspects that should only be included when explicitly referenced, not auto-walked. Sub-aspects from emitNestedAspect and full aspects from aspectSubmodule do NOT have __contentValues, so their nested keys continue to auto-walk as before. 776/776 CI tests pass.
sini
force-pushed
the
fix/nested-aspect-merge
branch
from
May 12, 2026 18:05
735937f to
2f6ce11
Compare
theutz
approved these changes
May 12, 2026
6 tasks done
sini
added a commit
to sini/den
that referenced
this pull request
May 12, 2026
aspectContentType shallow-merges forwarded attrs with foldl' //. This is last-win per key, which silently drops list values from earlier modules — e.g., multiple modules each adding to includes would only keep the last module's list. Before denful#521 this was masked by auto-walking nested keys; after denful#521 content wrappers don't auto-walk, so the incomplete includes became the only resolution path and children were silently dropped. Generalize the fix to all list-valued keys rather than special- casing includes/excludes by name: any key whose definitions are all lists gets concatenated in both aspectContentType.merge (for forwarded access) and mergeContentValuesPerKey (for auto-walk).
sini
added a commit
that referenced
this pull request
May 12, 2026
## Summary
- **Content wrapper includes merge**: When multiple modules each add
children to an aspect's `includes` list (e.g., `polybar.includes =
[coreuse]` in one file, `polybar.includes = [wifi]` in another),
`aspectContentType.merge` shallow-merged forwarded attrs with `foldl'
//`, keeping only the last module's list. Now `includes` and `excludes`
are explicitly concatenated across all content value definitions.
- **mergeContentValuesPerKey includes handling**: The per-key
reconstruction in `emitNestedAspect` wrapped `includes` in a `{
__contentValues, __provider }` content wrapper instead of
list-concatenating, causing `expected a list but found a set` crashes on
the auto-walk path. Now list-concatenates these structural keys.
Fixes a regression exposed by #521 — before that change, auto-walking
masked the incomplete includes list by resolving nested keys regardless.
After #521 correctly suppressed auto-walking for content wrappers, the
incomplete includes became the only resolution path and children from
earlier modules were silently dropped.
## Test plan
- [x] Added regression test: multiple modules each contributing to
`polybar.includes` — all children resolved
- [x] Added regression test: auto-walk path with multi-module includes —
no crash, all children resolved
- [x] Existing `nested-aspect-includes` scoping tests pass (2/2)
- [x] Existing `nested-aspect-merge` test passes (1/1)
- [x] Existing `nested-aspects` suite passes (6/6)
- [x] Full CI: 778/778 passing
charlesfire
pushed a commit
to charlesfire/den
that referenced
this pull request
May 16, 2026
## Summary - **Multi-definition merge**: When multiple modules define the same nested aspect key, class sub-keys are now properly collected instead of last-win overwrite. `emitNestedAspect` reconstructs per-sub-key `__contentValues` so all definitions contribute. - **Includes scoping**: Explicitly including a nested aspect via `den.aspects.X.Y` no longer auto-walks its nested sub-keys. Sub-aspects at deeper levels must be included explicitly. Direct nesting and organizational grouping continue to auto-walk as before. ## Test plan - [x] Added regression test for multi-definition nested class key merge - [x] Added regression tests for includes scoping (auto-include prevented, explicit include works) - [x] All 6 existing `nested-aspects` tests pass - [x] Full CI: 776/776 passing
charlesfire
pushed a commit
to charlesfire/den
that referenced
this pull request
May 16, 2026
## Summary
- **Content wrapper includes merge**: When multiple modules each add
children to an aspect's `includes` list (e.g., `polybar.includes =
[coreuse]` in one file, `polybar.includes = [wifi]` in another),
`aspectContentType.merge` shallow-merged forwarded attrs with `foldl'
//`, keeping only the last module's list. Now `includes` and `excludes`
are explicitly concatenated across all content value definitions.
- **mergeContentValuesPerKey includes handling**: The per-key
reconstruction in `emitNestedAspect` wrapped `includes` in a `{
__contentValues, __provider }` content wrapper instead of
list-concatenating, causing `expected a list but found a set` crashes on
the auto-walk path. Now list-concatenates these structural keys.
Fixes a regression exposed by denful#521 — before that change, auto-walking
masked the incomplete includes list by resolving nested keys regardless.
After denful#521 correctly suppressed auto-walking for content wrappers, the
incomplete includes became the only resolution path and children from
earlier modules were silently dropped.
## Test plan
- [x] Added regression test: multiple modules each contributing to
`polybar.includes` — all children resolved
- [x] Added regression test: auto-walk path with multi-module includes —
no crash, all children resolved
- [x] Existing `nested-aspect-includes` scoping tests pass (2/2)
- [x] Existing `nested-aspect-merge` test passes (1/1)
- [x] Existing `nested-aspects` suite passes (6/6)
- [x] Full CI: 778/778 passing
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
emitNestedAspectreconstructs per-sub-key__contentValuesso all definitions contribute.den.aspects.X.Yno longer auto-walks its nested sub-keys. Sub-aspects at deeper levels must be included explicitly. Direct nesting and organizational grouping continue to auto-walk as before.Test plan
nested-aspectstests pass