Skip to content

fix(varlock): coerce string env overrides to enum member types - #15

Closed
WalksWithASwagger wants to merge 1 commit into
mainfrom
cursor/fix-enum-env-string-coerce-21b2
Closed

fix(varlock): coerce string env overrides to enum member types#15
WalksWithASwagger wants to merge 1 commit into
mainfrom
cursor/fix-enum-env-string-coerce-21b2

Conversation

@WalksWithASwagger

Copy link
Copy Markdown
Owner

Summary

@type=enum(1, 2, 3) works for schema file values (parser auto-coerces 2 to a number) but fails when the same value comes from process.env / overrides as "1".

Changes

  • In enum coerce, map string "1" / "true" / "false" onto matching numeric/boolean members
  • Tests covering schema values and string overrides

Test plan

  • bunx vitest run src/env-graph/test/data-types.test.ts -t "enum data type"

Open on upstream (from your laptop as WalksWithASwagger):
https://github.com/dmno-dev/varlock/compare/main...WalksWithASwagger:varlock:cursor/fix-enum-env-string-coerce-21b2?expand=1

Open in Web Open in Cursor 

process.env and overrideValues are always strings. Numeric/boolean
enum members matched schema file auto-coerce but failed for CI
overrides like LEVEL=1. Coerce "1"/"true" toward matching members.
@github-actions

Copy link
Copy Markdown

bumpy-frog

The changes in this PR will be included in the next version bump.

patch Patch releases

  • varlock 1.14.1 → 1.14.2

Bump files in this PR

Click here if you want to add another bump file to this PR


This comment is maintained by bumpy.

@github-actions

Copy link
Copy Markdown

📦 Bundle size

⚠️ grows the bundle by 1.3 KB (+0.0%)

Metric main This PR Δ
Total dist 4922.2 KB 4923.4 KB +1.3 KB (+0.0%)
JS 1692.0 KB 1692.3 KB +0.3 KB (+0.0%)
Sourcemaps 3154.2 KB 3155.1 KB +1.0 KB (+0.0%)
Type defs 76.0 KB 76.0 KB

dist/ only; native binaries are versioned separately and not counted here.

@WalksWithASwagger

Copy link
Copy Markdown
Owner Author

Landed on current main via #17 (rebased onto dmno-dev/varlock main). Closing this stale branch PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant