Repository navigation
fix: excludes work on nested keys without _ prefix - #542
Conversation
e402b8a to
8d28051
Compare
|
Is this something that got surfaced by my dalliance with excludes? |
It was raised in #500 |
|
Interesting, so basically den has 2 aspect, sub-aspect and full aspect. While sub-aspect is maybe an unknown class, but they will be act as an aspect when they're inside Am i right? |
Sort of, yes. The types will be changing in a couple weeks, but that's the current type system. Ideally the typesystem would just let us say aspect types have keys of (aspect | class/quirk | fn-to-aspect) but for a multitude of reasons (backwards compat + identity + we can only detect functions, not if it's a class or fn-to-aspect) we're doing a bit of gymnastics. We'll be replacing this with denful/flake-aspects 2.0 after we've got everything hammered out and hopefully be able to simplify it then |
@fmway since you seem genuinely interested, and since I don't think you're in our matrix chat, I just published this doc that's helpful for understanding pipeline resolution flow: https://gist.github.com/sini/e326de73fca4704d663336eae86e546c This is subject to change in our next version, but this is what we just shipped. |
Okay, thanks. I'll land on the matrix later. Sorry, i just asked in the wrong place. |
You're fine, just happy you're engaging. It's the open-source process. :) |
Content wrappers ({ __contentValues, __provider }) from nested keys
defined without the _ prefix had no name field, causing identity.key
to produce "<anon>" instead of the actual nested key name. The
constraint system registered the exclude under the wrong identity.
Normalize content wrappers in registerConstraints by extracting the
name from __provider, matching what wrapChild does in normalize.nix.
8d28051 to
d131bfb
Compare
## Summary
- Nested keys defined without `_` prefix (e.g., `my-aspect.sub-aspect1`)
produce content wrappers `{ __contentValues, __provider }` with no
`name` field
- When passed to `excludes`, `identity.key` produced `"<anon>"` instead
of the actual key name, so the constraint never matched the aspect
during the tree walk
- Fix: normalize content wrappers in `registerConstraints` by extracting
`name` from `__provider` — the same normalization `wrapChild` does in
`normalize.nix`
## Root cause
The aspect type system produces different shapes for nested keys vs
`_`-prefixed sub-aspects:
- `den.aspects.foo.bar` → `{ __contentValues, __provider }` (content
wrapper, no `name`)
- `den.aspects.foo._.bar` → `{ name = "bar"; meta.provider = [...]; ...
}` (full aspect)
The constraint system computed identity on the raw wrapper before
normalization injected the name.
## Test plan
- [x] `test-nested-key-exclude` — excludes both `_`-prefixed and
non-prefixed sub-aspects
- [x] Full CI: 809/809
Summary
_prefix (e.g.,my-aspect.sub-aspect1) produce content wrappers{ __contentValues, __provider }with nonamefieldexcludes,identity.keyproduced"<anon>"instead of the actual key name, so the constraint never matched the aspect during the tree walkregisterConstraintsby extractingnamefrom__provider— the same normalizationwrapChilddoes innormalize.nixRoot cause
The aspect type system produces different shapes for nested keys vs
_-prefixed sub-aspects:den.aspects.foo.bar→{ __contentValues, __provider }(content wrapper, noname)den.aspects.foo._.bar→{ name = "bar"; meta.provider = [...]; ... }(full aspect)The constraint system computed identity on the raw wrapper before normalization injected the name.
Test plan
test-nested-key-exclude— excludes both_-prefixed and non-prefixed sub-aspects