fix(config): reject unrecognized boolean env values instead of treating them as true#59
Open
exo-nikita wants to merge 1 commit into
Open
fix(config): reject unrecognized boolean env values instead of treating them as true#59exo-nikita wants to merge 1 commit into
exo-nikita wants to merge 1 commit into
Conversation
…ng them as true envBool parsed EXODUS_STASIS_DEBUG / EXODUS_STASIS_CHILD_PROCESS by truthiness, so 'false', 'no', or any typo silently *enabled* the toggle. Parse strictly: ''/'0'/'false' disable, '1'/'true' enable, anything else throws a RangeError naming the env var and the accepted values. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M16Lwt8cM1azwev94UP81X
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.
The bug
envBoolinstasis-core/src/config.jsparsedEXODUS_STASIS_DEBUG/EXODUS_STASIS_CHILD_PROCESSby truthiness:Only
''and'0'read as false, soEXODUS_STASIS_CHILD_PROCESS=false(or=no, or any typo) silently enabled the toggle. Verified before the fix:false→childProcess = true,no→true.Why it matters
The CLI bins normalize these vars to
'1'/''before spawning, so they are unaffected — but consumers that read Config straight from the environment (the Metro transformer, standalone plugin States) get the inverted behavior: a user writingEXODUS_STASIS_CHILD_PROCESS=falseto disable cross-process capture turns it on instead.The fix
envBool(name, value)is now strict and fail-loud, matching Config's existing RangeError philosophy for invalid values:'','0','false'→ false'1','true'→ trueRangeError: EXODUS_STASIS_CHILD_PROCESS must be ''/'0'/'false' or '1'/'true' (got 'no')All call sites (constructor env-vs-option cross-checks, value resolution,
loadConfigenv cross-checks) pass the env var name so the error identifies the misconfigured variable. Note#envcoerces''toundefinedbeforeenvBoolever runs, so''never reaches it in practice — it is handled anyway for robustness.Tests
Added to
tests/config.test.jsfor both env vars, following the existingwithEnvsave/restore convention:'false'and''disable (plus the pre-existing'0'cases)'true'enables (plus the pre-existing'1'cases)'no'/'yes'throw aRangeErrornaming the variablenode --test tests/config.test.js: 126/126 pass. Manual probe after the fix:false/0→childProcess = false,1/true→true,no→ RangeError. The full suite has 181 pre-existing failures (missing installed deps / node version in the sandbox) with identical counts onmain— none related to this change.🤖 Generated with Claude Code
https://claude.ai/code/session_01M16Lwt8cM1azwev94UP81X
Generated by Claude Code