Repository navigation
fix(constellation): preserve remote defaults for omitted variables - #5436
Merged
Merged
Conversation
Review comment: r4644276782 #5411 (comment) Substituting lossy schema defaults corrupts forwarded remote enum, string, object and list inputs when an optional variable is omitted. Omitting only nullable positions would leave non-null inputs with defaults broken. Resolution (direct): NormalizeInputVariables now omits missing-variable arguments and input fields instead of inlining schema defaults, leaving the owning connector to apply them. Include non-null positions with defaults while retaining operation-variable defaults, explicit null checks, required-input handling and mutation-selector safeguards. This preserves Hasura-compatible coerced values without reconstructing remote literals. Add 52 HTTP remote-default regression cases across introspected admin and permissioned SDL schemas, and SQL equivalence coverage for the geography use_spheroid default. Existing omitted upsert update_columns coverage also passes. Update normalization expectations and the documented contract. Checks: - `golines -w --base-formatter=gofumpt .` — exit 0. - `golangci-lint run --fix ./...` — exit 0, no issues. - `GOEXPERIMENT=jsonv2 go test -race -count=1 -run '^(TestRemoteSchemaOmittedVariableDefaults|TestNormalizeInputVariables|TestSelectorScope|TestFilterVariableInputs|TestJSONBVariableInputs|TestOrderByVariableInputs|TestVariableInputControls|TestOptionalVariableInputs|TestVariableInputsRejectInvalidValues|TestVariableInputsCachedDocument)$' ./services/constellation/controller ./services/constellation/connector/sql/graphql/queries` — exit 0. - `GOEXPERIMENT=jsonv2 go test -race -count=1 ./services/constellation/connector/remoteschema ./services/constellation/connector/sql/graphql/queries/values` — exit 0. - `make -C tools/vale lint-prose-changed` — exit 0, no errors; four pre-existing warnings outside the changed text. - `nix build --impure --print-build-logs --out-link services/constellation/result-check --expr 'import ./.nhost-code/tmp/const-fix-reg-check.nix'` — exit 0. Run the full Constellation check derivation with only HASURA_URL and DATABASE_URL overridden for isolated ports 8443/5434, preserving the unrelated stack on 443/5432. All 49 tested packages, including the Hasura v2.50.3-ce integration comparisons, pass. Generation leaves all 2042 checked files unchanged; vulnerability policy and lint pass.
Review comment: PR_const-fix-reg/RUN-17953993101725531490/WU-001 — .nhost-code/review/PR_const-fix-reg_COMMENT_001.md Omitted variables at schema-defaulted positions inside mutation where inputs were incorrectly rejected after remote defaults were left to the owning connector. Resolution: Schema-defaulted mutation selector arguments and input fields are now omitted for the owning connector to default at `services/constellation/connector/sql/graphql/queries/input_variables.go:279` and `:336`, rather than rejected or inlined. Non-defaulted restrictions still fail closed, and explicit-null/non-null validation is unchanged. Added regressions for delete/update/update-many/upsert SQL equivalence and admin/reader remote mutations, including sibling-restriction safety controls. The targeted race suite passes. Checks: - `nix develop .#constellation -c bash -c 'golines -w --base-formatter=gofumpt . && golangci-lint run --fix ./...'` — exit 0; repo-wide formatting and lint, 0 issues. - `GOEXPERIMENT=jsonv2 go test -race -count=1 -run '^(TestNormalizeInputVariables|TestOptionalVariableInputs|TestVariableInputsRejectInvalidValues|TestFilterVariableInputs|TestVariableInputControls|TestVariableInputsCachedDocument|TestRemoteSchemaOmittedVariableDefaults)$' ./services/constellation/connector/sql/graphql/queries ./services/constellation/controller` — exit 0; default, selector-safety, null, and cache tests passed. - `make -C tools/vale lint-prose-changed` — exit 0; no errors, four pre-existing warnings outside the changed text. - `nix build --impure --print-build-logs --out-link services/constellation/result-check --expr 'import ./.nhost-code/tmp/const-fix-reg-check.nix'` — exit 0; full project check, 49 tested packages including the Hasura comparison suite and all 74 remote-default cases. The isolated check overrides only HASURA_URL and DATABASE_URL to use ports 8443/5434.
albertomolinafelipe
approved these changes
Nov 23, 2026
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.
Goal
Restore Hasura-compatible effective defaults when clients omit GraphQL variables used by remote-schema arguments or input fields. The previous normalization substituted schema defaults whose intermediate representation could lose enum kinds, string quoting, and object/list contents. Preserve operation-variable defaults, explicit nulls, required-input validation, mutation-selector safety, SQL defaults, and cached-AST isolation.
Type: Bug fix
Changes
use_spheroiddefault, retain upsert-default coverage, and update normalization expectations.Key files
services/constellation/connector/sql/graphql/queries/{input_variables.go,input_variables_test.go,variable_inputs_test.go}(+19/-6) — Shared normalization, omission expectations, and SQL-default equivalence.services/constellation/controller/remote_schema_defaults_test.go(+394/-0) — Database-free HTTP regression matrix and validating remote fixture.services/constellation/CLAUDE.mdandservices/constellation/docs/developers/query-execution.md(+2/-2 total) — Default-ownership contract.