Compare commits

..

1 Commits

Author SHA1 Message Date
4a8e8920ea refactor(dotfiles): clarify registry validation 2026-10-04 22:01:03 -04:00
3 changed files with 28 additions and 32 deletions

View File

@@ -110,6 +110,8 @@
Use `git -C <repository-root>` or top-anchored pathspecs for repository-wide history searches. Use `git -C <repository-root>` or top-anchored pathspecs for repository-wide history searches.
- A `**/*.nix` Git pathspec does not include Nix files directly in its starting directory. - A `**/*.nix` Git pathspec does not include Nix files directly in its starting directory.
Include both `*.nix` and `**/*.nix`, or use a recursive `*.nix` pathspec, when linting every Nix file. Include both `*.nix` and `**/*.nix`, or use a recursive `*.nix` pathspec, when linting every Nix file.
- Nix `let` bindings are recursive; their source order does not determine binding availability.
Treat Natu `let_order` as a readability rule, not an evaluation dependency.
- Ariadne extraction must preserve the game-root season prefix for archived source. - Ariadne extraction must preserve the game-root season prefix for archived source.
Different game installs can contain compiled scripts with the same internal path. Different game installs can contain compiled scripts with the same internal path.
- Clew owns Ren'Py extraction, preparation, and compiled-script AST export. Ariadne owns analysis over Clew-produced data. - Clew owns Ren'Py extraction, preparation, and compiled-script AST export. Ariadne owns analysis over Clew-produced data.

View File

@@ -19,7 +19,7 @@ let
]; ];
}).config; }).config;
validate = import ./registry/validation.nix { inherit definitions lib; }; validation = import ./registry/validation.nix { inherit data definitions lib; };
data = lib.mapAttrs ( data = lib.mapAttrs (
registryName: _registry: registryName: _registry:
@@ -44,7 +44,7 @@ in
}; };
collected = collected =
assert validate data; assert validation;
data data
// { // {
join = join =

View File

@@ -1,40 +1,34 @@
{ {
data,
definitions, definitions,
lib, lib,
}: }:
let let
validationAssertions = checkResults = lib.concatLists (
data: lib.mapAttrsToList (
registryName: definition:
map (check: {
assertion = check.assertion (entriesForRegistry registryName);
inherit (check) message;
}) definition.checks
) definitions
);
entriesForRegistry =
registryName:
lib.concatLists ( lib.concatLists (
lib.mapAttrsToList ( lib.mapAttrsToList (host: entries: entriesForHost registryName host entries) data.${registryName}
registryName: registry:
let
entries = flattenRegistryEntries registryName data.${registryName};
in
map (check: {
assertion = check.assertion entries;
inherit (check) message;
}) registry.checks
) definitions
); );
flattenRegistryEntries = entriesForHost =
registryName: data: registryName: host: entries:
lib.concatLists ( lib.mapAttrsToList (entry: value: {
lib.mapAttrsToList ( path = "registry.${registryName}.${host}.${entry}";
host: entries: inherit host entry value;
lib.mapAttrsToList (entry: value: { }) entries;
path = "registry.${registryName}.${host}.${entry}";
inherit host entry value; failures = lib.filter (result: !result.assertion) checkResults;
}) entries
) data
);
in in
data: lib.assertMsg (lib.all (result: result.assertion) checkResults) (
let lib.concatMapStringsSep "\n" (result: result.message) failures
assertions = validationAssertions data;
failures = lib.filter (assertion: !assertion.assertion) assertions;
in
lib.assertMsg (lib.all (assertion: assertion.assertion) assertions) (
lib.concatMapStringsSep "\n" (assertion: assertion.message) failures
) )