feat: inject BRUIN_VARS_SCHEMA for type-aware variable coercion#1718
Merged
feat: inject BRUIN_VARS_SCHEMA for type-aware variable coercion#1718
Conversation
Add SchemaMap() to Variables that returns type definitions without defaults. envInjectVariables now marshals and sets BRUIN_VARS_SCHEMA so the Python SDK can coerce CLI string overrides to proper types. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
Additional Comments (1)
When Prompt To Fix With AIThis is a comment left during a code review.
Path: pkg/env/variables.go
Line: 64-67
Comment:
**Asymmetric handling of empty variables**
When `variables` is empty, `BRUIN_VARS` is explicitly set to `"{}"` but `BRUIN_VARS_SCHEMA` is omitted entirely. This means the Python SDK must handle two distinct cases: (1) `BRUIN_VARS_SCHEMA` is absent, and (2) `BRUIN_VARS_SCHEMA` is present with content. Consider setting `BRUIN_VARS_SCHEMA` to `"{}"` alongside `BRUIN_VARS` for consistency, so the companion Python SDK can always expect the env var to exist when `BRUIN_VARS` does.
```suggestion
if len(variables) == 0 {
env["BRUIN_VARS"] = "{}"
env["BRUIN_VARS_SCHEMA"] = "{}"
return env, nil
}
```
How can I resolve this? If you propose a fix, please make it concise. |
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Ensures BRUIN_VARS_SCHEMA is always present alongside BRUIN_VARS for consistency, so the Python SDK doesn't need to handle the absent-env-var case separately. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
karakanb
approved these changes
Feb 22, 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.
Summary
SchemaMap()method toVariablesthat returns type definitions without thedefaultkeyenvInjectVariablesto marshal and setBRUIN_VARS_SCHEMAalongsideBRUIN_VARS--var count=42) to proper typesCompanion PR
feature/type-aware-var-coercionTest plan
SchemaMap()invariables_test.goBRUIN_VARS_SCHEMAinjection inenv/variables_test.go🤖 Generated with Claude Code