Skip to content

docs: cover undocumented public surface and fix stale API references - #659

Merged
theutz merged 2 commits into
mainfrom
docs/undocumented-feature-coverage
Aug 25, 2026
Merged

theutz merged 2 commits into
mainfrom
docs/undocumented-feature-coverage

Conversation

@sini

@sini sini commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Documents public features that shipped without docs, and fixes code comments still pointing at the removed adapter API.

New page

explanation/structural-introspectionentity.hasAspect / entity.aspects, meta.handleWith with den.lib.aspects.fx.constraints (exclude / substitute / filterBy plus their .global variants), and the lib-level building blocks (hasAspectIn, collectPathSet, mkEntityHasAspect, mkProjectedHasAspect). Covers where hasAspect is safe to call, and why includes is not.

Previously this API was only discoverable by reading templates/example.

Reference and guide additions

  • pipe.broadcast stage semantics + a worked fleet example (had zero docs)
  • Conditional aspects (meta.guard / meta.aspects) via policy.when
  • den.batteries.flake-scope
  • Built-in policy tables: os-to-host, user-to-host, the home-env family, wsl, and the flake-parts pair
  • den.schema collection fields (isEntity, isolated, parent, collisionPolicy) and the den.schema.aspect base module
  • den.classes fields: description, forwardTo, parentPath, parentArg
  • den.reservedKeys, den.systems, flat host/home declaration forms
  • Policy deliver/route guard + adaptArgs, route.collectSubtree, the intoPath alias, custom instantiate specs, resolve.shared.to
  • captureFleet, resolveWithPaths / resolveWithState
  • Class-module arg promotion for descendant entity kinds (can't request user inside an aspect's nixos class module #629)

Corrections to existing docs

  • Class-module collision policy resolves over four levels, not three (aspect → per-entity → den.schema.<kind> → global), matching resolveCollisionPolicy in class-module.nix
  • Stale battery anchors in the sidebar (19 links) and in both tutorials
  • lib.mdx linked to a nonexistent /reference/options/ page

Code changes

Comments and one option description only, no behaviour change. modules/context/has-aspect.nix and the example template referenced oneOfAspects, excludeAspect, meta.adapter and adapters.nix — none of which still exist — and named the filter constraint filter/filterIncludes rather than filterBy.

Verification

  • nix develop -c just fmt — clean, no changes to the edits
  • nix flake check --override-input den . ./templates/exampleall checks passed!
  • pnpm build — 61 pages, clean
  • Internal link/anchor check over dist/: 8,349 links, 0 broken pages, 0 broken anchors

Known follow-ups (not in this PR)

Still undocumented: denTest's expectedError option and the show / funnyNames / withSystem helpers, and there is no option-reference page for den.config. Separately, templates/ci/ still carries stale test-excludeAspect-* test names and a meta.adapter comment.

Adds documentation for public features that shipped without docs, and
corrects code comments still pointing at the removed adapter API.

New page — explanation/structural-introspection:
  entity.hasAspect / entity.aspects, meta.handleWith with
  den.lib.aspects.fx.constraints (exclude / substitute / filterBy and
  their .global variants), and the lib-level building blocks. Covers
  where hasAspect is safe to call and why includes is not.

Reference and guide additions:
  - pipe.broadcast stage semantics + worked fleet example
  - conditional aspects (meta.guard / meta.aspects) via policy.when
  - den.batteries.flake-scope
  - built-in policy tables: os-to-host, user-to-host, the home-env
    family, wsl, and the flake-parts pair
  - den.schema collection fields (isEntity, isolated, parent,
    collisionPolicy) and the den.schema.aspect base module
  - den.classes fields: description, forwardTo, parentPath, parentArg
  - den.reservedKeys, den.systems, flat host/home declaration forms
  - policy deliver/route guard + adaptArgs, route collectSubtree and
    the intoPath alias, custom instantiate specs, resolve.shared.to
  - captureFleet, resolveWithPaths / resolveWithState
  - class-module arg promotion for descendant entity kinds

Corrections to existing docs:
  - collision policy resolves over four levels, not three
  - stale battery anchors in the sidebar and tutorials
  - lib.mdx linked to a nonexistent /reference/options/ page

Code comments only (no behaviour change):
  has-aspect.nix and the example template referenced oneOfAspects,
  excludeAspect, meta.adapter and adapters.nix, none of which still
  exist; they now point at meta.handleWith + fx.constraints.
@sini
sini requested a review from vic as a code owner August 25, 2026 17:21
@github-actions github-actions Bot added the allow-ci allow all CI integration tests label Aug 25, 2026
@sini
sini requested a review from theutz August 25, 2026 17:22

@theutz theutz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A much needed refresh. This is great!

Comment thread docs/src/content/docs/explanation/structural-introspection.mdx Outdated
Comment thread docs/src/content/docs/explanation/structural-introspection.mdx
Comment thread docs/src/content/docs/explanation/structural-introspection.mdx Outdated
Comment thread docs/src/content/docs/explanation/structural-introspection.mdx Outdated
Comment thread docs/src/content/docs/guides/batteries.mdx
Comment thread docs/src/content/docs/guides/custom-classes.mdx Outdated
Comment thread docs/src/content/docs/reference/schema.mdx
… example

Membership is class-invariant, so hasAspect, forClass and forAnyClass agree
for any class an entity declares; say so rather than implying the variants
answer differently. Tie present/absent to the boolean they describe.

constraints.exclude is unconditional — the secrets-bundle example claimed it
fires 'whenever both are present' while excluding an aspect it had just
included. Exclude something a transitively included aspect drags in instead.

Class entries are a record of options; 'schema' collides with den.schema
entity kinds.
@sini
sini requested a review from theutz August 25, 2026 19:35

@theutz theutz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Love it.

Comment thread docs/src/content/docs/explanation/structural-introspection.mdx
Comment thread docs/src/content/docs/explanation/structural-introspection.mdx Outdated
Comment thread docs/src/content/docs/guides/custom-classes.mdx Outdated
Comment thread docs/src/content/docs/explanation/structural-introspection.mdx Outdated
@theutz
theutz enabled auto-merge (squash) August 25, 2026 19:46
@theutz
theutz merged commit c7ef3f1 into main Aug 25, 2026
63 of 65 checks passed
@theutz
theutz deleted the docs/undocumented-feature-coverage branch August 25, 2026 20:10
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