validate: treat an uncomposed manifest cluster as @absent (#127)#129
Merged
Conversation
A cluster block whose member roles have no composition in the selected -env unioned to zero databases but was still cs.Add'ed, registering an empty-but-mapped cluster. Resolution checks mapped before absent, so proxies into it failed with a false 'not declared in that cluster's schema' instead of being treated as absent. Corollary: -cluster NAME=@absent could not override a manifest-declared cluster. Fix: clusterSetFromRoles registers an empty-union cluster via AddAbsent (modeled elsewhere / env-varying), not Add; and ClusterSet.Add/AddAbsent/AddAlias clear the other categories so a name is in exactly one and the latest writer wins (so -cluster NAME=@absent reliably overrides a manifest cluster). Closes #127.
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.
Closes #127.
Bug
A
clusterblock whose member roles have no composition in the selected-envunioned to zero databases but was stillcs.Added — registering an empty-but-mapped cluster.resolveDistributedRemotechecks mapped before absent, so every proxy into it failed with a false "not declared in that cluster's schema" instead of being treated as absent.Corollary:
-cluster NAME=@absentcouldn't override a manifest-declared cluster —AddAbsentleft the manifest'sdeclaredentry and the mapped check short-circuited.Reproduced first (both bugs) with failing tests, then fixed.
Fix
clusterSetFromRoles(cmd/hclexp/hclexp.go): when a cluster's member-role union is empty for the env, register it viaAddAbsent(it's modeled elsewhere / env-varying), notAdd.ClusterSet.Add/AddAbsent/AddAlias(internal/loader/hcl/clusterset.go) now clear the other categories for a name, so a name is in exactly one category and the latest writer wins — making-cluster NAME=@absentreliably override a manifest cluster (and a real mapping override a prior absent).Tests
TestValidateManifest_UncomposedClusterIsAbsent— proxy into an uncomposed cluster is satisfied (was the false error).TestValidateManifest_ComposedClusterValidates— same cluster in an env where its role is composed validates normally.TestValidateManifest_AbsentFlagOverridesManifestCluster—-cluster X=@absentoverrides a manifest-declaredX.TestValidate_ClusterSet_AbsentOverridesMapped/MappedOverridesAbsent— the last-writer-wins invariant.Binary end-to-end confirms one
cluster "posthog"declaration resolves per env: validated under-env local(data composed), satisfied as absent under-env prod-us(data absent). Full suite green;go vet+gofmtclean.