Skip to content

feat: ._ shorthand to include all child aspects - #536

Merged
vic merged 3 commits into
mainfrom
feat/include-children
May 14, 2026
Merged

vic merged 3 commits into
mainfrom
feat/include-children

Conversation

@sini

@sini sini commented May 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • den.aspects.foo._ now acts as a synthetic aspect that auto-includes all immediate child aspect keys of foo
  • Enables includes = [ den.aspects.foo._ ] instead of enumerating each child explicitly
  • Synthetic keys hidden behind __functor so existing lib.attrValues patterns on _ are unaffected
  • Adds excludes to structuralKeysSet (pre-existing gap now surfaced)

Implementation

types.nix: Both mergeWithAspectMeta and mergeFunctions compute child aspect keys (filtering out structural, class, pipe, forwarded, and __-prefixed keys) and build a synthetic aspect delivered via __functor on provides/_.

normalize.nix: wrapFunctorChild detects zero-arg functors returning aspect-shaped values and resolves them immediately.

key-classification.nix: Added excludes to structuralKeysSet.

Test plan

  • 7 new tests in include-children suite (basic, empty, mixed, provides-coexistence, parametric, attrValues compat, no-grandchildren)
  • 801/801 full CI passes

sini added 3 commits May 13, 2026 20:35
den.aspects.foo._ now acts as a synthetic aspect that auto-includes
all immediate child aspect keys of foo. Hides synthetic keys behind
__functor so existing lib.attrValues patterns on _ are unaffected.

wrapFunctorChild detects zero-arg functors returning aspect-shaped
values and resolves them immediately. Child key filtering excludes
structural, class, pipe, forwarded, and __-prefixed keys.
Without this, excludes could leak into childKeys for
synthetic provides and into classification as a freeform key.
Locks invariant that synthetic name/includes are hidden from
attrNames, and that ._ only includes immediate children.
@sini
sini requested a review from vic as a code owner May 14, 2026 03:35
@github-actions github-actions Bot added the allow-ci allow all CI integration tests label May 14, 2026

@vic vic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

TMS - tests make sense 👍

@vic
vic enabled auto-merge (squash) May 14, 2026 03:57
@vic
vic merged commit 9ee8354 into main May 14, 2026
32 of 41 checks passed
@vic
vic deleted the feat/include-children branch May 14, 2026 04:01
@theutz

theutz commented May 14, 2026

Copy link
Copy Markdown
Collaborator

This is an EXCELLENT idea!

charlesfire pushed a commit to charlesfire/den that referenced this pull request May 16, 2026
## Summary

- `den.aspects.foo._` now acts as a synthetic aspect that auto-includes
all immediate child aspect keys of `foo`
- Enables `includes = [ den.aspects.foo._ ]` instead of enumerating each
child explicitly
- Synthetic keys hidden behind `__functor` so existing `lib.attrValues`
patterns on `_` are unaffected
- Adds `excludes` to `structuralKeysSet` (pre-existing gap now surfaced)

## Implementation

**`types.nix`**: Both `mergeWithAspectMeta` and `mergeFunctions` compute
child aspect keys (filtering out structural, class, pipe, forwarded, and
`__`-prefixed keys) and build a synthetic aspect delivered via
`__functor` on provides/_.

**`normalize.nix`**: `wrapFunctorChild` detects zero-arg functors
returning aspect-shaped values and resolves them immediately.

**`key-classification.nix`**: Added `excludes` to `structuralKeysSet`.

## Test plan

- [x] 7 new tests in `include-children` suite (basic, empty, mixed,
provides-coexistence, parametric, attrValues compat, no-grandchildren)
- [x] 801/801 full CI passes
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