Skip to content

fix: restrict bool env vars to 1/0/true/false#63

Merged
tmck-code merged 2 commits into
mainfrom
fix/env-width-vars
Jun 6, 2026
Merged

fix: restrict bool env vars to 1/0/true/false#63
tmck-code merged 2 commits into
mainfrom
fix/env-width-vars

Conversation

@tmck-code
Copy link
Copy Markdown
Owner

Context

_parse_bool previously treated any non-empty env string as True, meaning YAS_FULL_WIDTH=0 and YAS_FULL_WIDTH=false both resolved to True. This made it impossible to explicitly disable boolean flags via environment variables when a yas.toml default had them enabled.

Changes

  • _parse_bool in claude/yas/config.py now requires env/CLI boolean strings to be one of 1, 0, true, false (case-insensitive via json.loads). Any other value is rejected and falls through to the config default.
  • Added BOOL_ALLOWLIST constant documenting the accepted set.
  • Swapped import json in to leverage json.loads for "true"/"false"bool parsing.
  • Tests updated: renamed the old test_env_full_width_any_nonempty_is_true and split into truthy values, falsy values, invalid-falls-through-to-default, env-overrides-toml-true, and max-width-respected-when-full-width-disabled cases.
  • Version bumped to 0.2.11.

Checklist

  • Tests added or updated for new/changed behaviour
  • (bug fixes) a regression test now covers the situation so it can't come back

Screenshots / recording

  • N/A — no visible change

Benchmark

  • N/A — no performance-relevant change

System info

Key Value
OS Linux archlinux 7.0.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 23 May 2026 14:21:20 +0000 x86_64 GNU/Linux
Claude Code 2.1.167 (Claude Code)
Terminal TERM=tmux-256color TERM_PROGRAM=tmux SHELL=/bin/bash COLORTERM=truecolor
Locale LANG=en_AU.UTF-8 LC_ALL=
Python Python 3.13.1
uv uv 0.11.14 (x86_64-unknown-linux-gnu)

@tmck-code tmck-code marked this pull request as ready for review June 6, 2026 08:14
@tmck-code tmck-code merged commit 57d9a93 into main Jun 6, 2026
6 checks passed
@tmck-code tmck-code deleted the fix/env-width-vars branch June 6, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant