profiles: key shape check off flakeExposed, validate at consumed surface #4
No reviewers
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/profiles!4
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/profile-shape-flakeexposed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes allod/profiles#3
Removes the hardcoded architecture list from the profile shape check and moves the shape contract onto the surface the framework actually consumes, without adding an
inventoryorsecretsinput. The check body never read the architecture, so the list was scaffolding to satisfy the system-keyedchecksschema, not machine policy; and because nothing downstream consumesprofiles.checks, the old standalone-only check gave no protection to the scenario the repo exists to serve — an operator redirecting the framework'sprofilesinput at their own definitions repo.Changes
checkSystems = [ "x86_64-linux" "aarch64-linux" ]withnixpkgs.lib.systems.flakeExposed, so no literal here reads as a machine-platform-policy list.checkedProfileDefinitionsand expose it aslib.profileDefinitions, so any consumer (the archetypes framework at composition time) trips the contract on read — not only a standalonenix flake checkin this repo.profile-contract-shapecheck forces the shared binding viabuiltins.seq, sonix flake checkhere still exercises it.nixpkgs, noinventory/secretsinput; no change to composition behavior for valid definitions.The three footguns called out in the issue are encoded as code comments:
builtins.seqforces only weak-head-normal-form (upgrade tobuiltins.deepSeqif deeper validation is added later); theflakeExposedbreadth is deliberate and non-policy; andlib.profileDefinitionsmust stay a single checked binding or the consumption-time guarantee erodes.Risk
Low (R1).
flake.nix-only in a single data-definitions repo, with no composition-behavior change:lib.profileDefinitionsreturns the same attrset value for valid input (the guard is transparent), andprofileData/homeModules.preferencesare untouched. The behavioral delta is strictly earlier, louder failure — a malformed definition now fails at the consumed surface instead of surfacing later as a framework-internal composition error.nix flake checknow evaluates checks across allflakeExposedsystems, sonix flake show/--all-systemsare slower and the check nominally exists on darwin/riscv; it still builds only the host check. Fully recoverable by revert.Validation
nix flake checkpasses: buildschecks.x86_64-linux.profile-contract-shapeand warns it omitted the incompatible foreign systems (expected).nix eval .#lib.profileDefinitions --apply builtins.isAttrs->true; forcing the consumed surface passes the asserts.nixosModules = "notalist"into a definition makesnix eval .#lib.profileDefinitionsthrowprofile contract shape errors: profileDefinitions.privacy.privacy-1.nixosModules is not a list, confirming the contract now fires at the surface the framework reads, not only in a standalone check..#checksis keyed byflakeExposed(10 systems this nixpkgs release, including darwin / riscv / freebsd).End-to-end composition check via the deploy flake (
--override-input profiles path:at this PR branch), confirming the consumed-surface guarantee through the real archetypes framework rather than only this repo's standalone check:nix eval <deploy>#nixosConfigurations.allod-dev.config.system.build.toplevel.drvPath --override-input profiles path:<profiles>composes cleanly tonixos-system-allod-dev-…drv(exit 0). Valid definitions are unaffected; allod-dev builds identically.nixosModules = "notalist"into a definition makes the framework's own composition throw duringnixosConfigurationsevaluation (archetypes flake.nix:366,// machineConfigurations):error: profile contract shape errors: profileDefinitions.privacy.privacy-1.nixosModules is not a list(exit 1).So a malformed definition is now rejected at the framework composition surface a consumer actually evaluates, which is the behavior this issue asks for.