Skip to content

Carry defaults for the nearest children of a class - #56

Merged
clhodapp merged 1 commit into
mainfrom
feat/for-nearest-children
Oct 25, 2026
Merged

clhodapp merged 1 commit into
mainfrom
feat/for-nearest-children

Conversation

@clhodapp

Copy link
Copy Markdown
Contributor

A default that a level adds through forChildren reaches every configuration of its class beneath the level, at any depth. Most of what a level gives says what the configurations directly beneath it live on: the deployment options of a colmena node, the file systems of a disk layout, the hardware of a facter report. That stops being true one machine further down. A NixOS configuration declared inside one of those machines inherited them all.

A configuration's evaluation may now return forNearestChildren.extraDefaultModuleImports, by class. These additions connect at the nearest configurations of their class beneath the level and go no deeper:

  • Each manifest carries nearestPending: by class, a list of { select; file; level; nearest = true; }, the additions on their way down.
  • Beneath a parent, nearestPending is what reached the parent, minus the parent's own class, followed by the parent's own additions. Systems and configurations with no class pass it on unchanged.
  • At a configuration of class C, defaultModuleImports.C is what it inherits, followed by nearestPending.C.
  • inheritedFrom drops entries marked nearest before passing defaults down, so they stop at the configuration they reached.

mkConfiguration takes class ? null for this. caisson passes the class of each configuration, so caisson must take this change before it passes class.

Tests: the new test lifecycleNearestAdditionsConnectOnce checks that an addition reaches the nearest configuration of its class through a configuration of another class, and that a configuration of that class nested inside it does not inherit it. Locally, nix flake check and the test summary (133 passed) pass.

The caisson side, the option caisson.forNearestChildren and the defaults moved to it, follows in nix-caisson/caisson.

🤖 Generated with Claude Code

A default a level added through forChildren reached every
configuration of its class beneath the level, at any depth. Most of
what a level gives says what the configurations directly beneath it
live on, which stops being true one machine further down.

A configuration's evaluation may now return
forNearestChildren.extraDefaultModuleImports by class. Each manifest
carries nearestPending, by class, the additions on their way down.
At a configuration of class C, the additions pending for C join its
default after the inherited ones and connect there: inheritedFrom
drops them before passing defaults on. Beneath a configuration,
what is pending is what reached it, less its own class, followed by
its own additions. mkConfiguration takes the configuration's class
for this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clhodapp clhodapp self-assigned this Oct 25, 2026
@clhodapp
clhodapp merged commit 8f60ad7 into main Oct 25, 2026
2 checks passed
clhodapp added a commit to nix-caisson/caisson that referenced this pull request Oct 25, 2026
nix-caisson/caisson-core#56 merged, so caisson-core moves from its
branch to the merge on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant