validate: manifest-driven mode to validate a whole environment#126
Merged
Conversation
`validate -manifest` validated one node (passed via -layer/-config) using the manifest as cross-cluster context; checking a whole env meant looping validate per node in a shell. Add a manifest-driven mode: with -manifest/-env and no -layer/-config, validate loads every role's composition for the env, builds the cluster set from the whole manifest (member-role unions + aliases + any -cluster flags), and runs the full validation on each role against it. Per-role errors are prefixed "[role X]"; it exits non-zero if any role fails. Mode is selected when neither -layer nor an explicit -config is given (detected via flag.Visit); the single-node path is unchanged. Factor shared helpers (loadManifestRoleSchemas, clusterSetFromRoles) so both modes load role schemas once; validateManifest returns per-role results and is unit-tested without os.Exit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #125.
validate -manifestvalidated one node (passed via-layer/-config), using the manifest only as cross-cluster context — checking a whole environment meant a shell loop over nodes. This makes "validate the whole manifest" a first-class command.Behavior
With
-manifest/-envand no-layer/-config, validate:-env,-clusterflags last),[role data] …) and exits non-zero if any role fails.Mode is selected only when neither
-layernor an explicit-configis given (detected viaflag.FlagSet.Visit). With-layer/-config, the existing single-node behavior (manifest as context) is unchanged — verified by regression.Implementation
Shared helpers so both modes load role schemas once:
loadManifestRoleSchemas— role → resolved*SchemaclusterSetFromRoles— union member-role databases per cluster + aliases (reused by the single-nodebuildManifestClusters, which loads only cluster-referenced roles)validateManifest(...) []roleValidation— returns per-role errors, unit-tested withoutos.ExitrunValidateManifest— printing + exit code;flagWasSet— explicit--configdetectionTests
validateManifest: every role validated; a clean role passes while a role with a broken reference reports it and its cross-cluster proxy still resolves; all-clean manifest → zero errors.[role data]for a broken view, then passes for the whole env once fixed.validate -layer …unchanged.Full suite green;
go vet+gofmtclean. Notes indocs/plans/2026-07-08-validate-manifest-driven.md.