Skip to content

feat: preserve aspect identity and adapter through functor evaluation - #398

Merged
vic merged 1 commit into
denful:mainfrom
sini:sf1/identity-preservation-standalone
Apr 8, 2026
Merged

vic merged 1 commit into
denful:mainfrom
sini:sf1/identity-preservation-standalone

Conversation

@sini

@sini sini commented Apr 8, 2026 •

Copy link
Copy Markdown
Collaborator

Functor-producing functions in parametric.nix (applyIncludes, deepRecurse, withOwn) carry name, __provider, and eta.adapter from self into their return values. ctxApply also carries name and __provider on its result.

Currently, when parametric functors evaluate, they return plain { includes = [...]; } attrsets — losing the aspect's identity. This means any code inspecting the resolved aspect (such as a custom adapter via resolve.withAdapter) sees incorrect defaults instead of the original aspect's name.

This lays groundwork for context-level adapter resolution, where adapters declared on aspects or contexts need to propagate through the parametric pipeline to reach forward.nix and outputs.nix. Child includes are tagged with the parent's meta.adapter so adapters compose downward through the include tree.

Upcoming related PRs:

vic
vic previously requested changes Apr 8, 2026
Comment thread nix/lib/parametric.nix Resolved
Comment thread nix/lib/parametric.nix Resolved
@sini
sini force-pushed the sf1/identity-preservation-standalone branch from 12fe7bb to 45ff8f0 Compare April 8, 2026 05:59
@sini
sini requested a review from vic April 8, 2026 05:59
Comment thread nix/lib/ctx-apply.nix Resolved
@sini
sini force-pushed the sf1/identity-preservation-standalone branch from 45ff8f0 to 8fc3abf Compare April 8, 2026 06:17
@sini

sini commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator Author

Alright, updated.

Comment thread nix/lib/parametric.nix Resolved
Comment thread nix/lib/parametric.nix Resolved
@vic vic added the allow-ci allow all CI integration tests label Apr 8, 2026
@sini
sini force-pushed the sf1/identity-preservation-standalone branch 2 times, most recently from 6596a03 to f3b3e44 Compare April 8, 2026 07:01
@vic
vic dismissed their stale review April 8, 2026 07:04

looks good now

@sini

sini commented Apr 8, 2026 •

Copy link
Copy Markdown
Collaborator Author

awesome. I have 3 more commits staged but I'll save them for tomorrow. Goodnight and thank you for the reviews!

edit: (what do you mean self.name isn't set... okay this is an easy fix... pushing in a minute.)

@vic

vic commented Apr 8, 2026

Copy link
Copy Markdown
Member

Awesome, run just fmt and we are done with this. Looking forward to your other PRs.

Good job so far, @sini. Thank you so much.

withIdentity helper carries name and typed meta options (adapter,
provider) through parametric functor results and ctxApply output.
Freeform user meta is not propagated to avoid leaking to child
include results. Den-internal meta (loc, name, file) are set by
aspectMeta at merge time and not available during functor eval.
@sini
sini force-pushed the sf1/identity-preservation-standalone branch from f3b3e44 to 95f2d54 Compare April 8, 2026 07:14
@vic
vic merged commit f09f211 into denful:main Apr 8, 2026
15 checks passed
vic pushed a commit that referenced this pull request Apr 8, 2026
## Summary
- Entities automatically expose `.resolved` — the result of their
context pipeline — derived from the schema type system
- `forward.nix` defaults to `item.resolved` when `fromAspect` is absent,
enabling cross-context forwarding without manual wiring
- `mainModule` helper eliminated — entity types resolve directly via
`config.resolved`

## What changed
**options.nix** — `schemaEntryType` wraps `deferredModule` to
auto-inject `config.resolved` for any schema entry where
`den.ctx.${kind}` exists. Context args are derived from the entity's
`_module.args`, filtered to known context kinds. No per-entity
boilerplate — host, user, and home all get `.resolved` automatically.

**types.nix** — `mainModule` helper removed. Both host and home
`mainModule` options simplified to `den.lib.aspects.resolve config.class
config.resolved`.

**forward.nix** — `asp` falls back to `item.resolved or item` when
`fromAspect` is absent.

## How context adapters flow through forwards
`den.ctx.host.meta.adapter` is carried through `ctxApply` (via
`withIdentity` from #398) onto `.resolved`. When `resolve` processes it,
`adapters.filterIncludes` (from #397) picks up the adapter and applies
it transitively to the entire subtree — including nested aspects reached
through forwards.
@sini
sini deleted the sf1/identity-preservation-standalone branch April 8, 2026 19:38
@vic vic added the super-autocompleted "Artificial Intelligence" terms nothing real, "Super Intelligence" is even more of a lie. label Apr 10, 2026
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 super-autocompleted "Artificial Intelligence" terms nothing real, "Super Intelligence" is even more of a lie.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants