Skip to content

Preserve case when parsing boolean like strings - #1634

Merged
rfbgo merged 3 commits into
GoogleCloudPlatform:developfrom
douglasjacobsen:env-var-case
Aug 3, 2026
Merged

Preserve case when parsing boolean like strings#1634
rfbgo merged 3 commits into
GoogleCloudPlatform:developfrom
douglasjacobsen:env-var-case

Conversation

@douglasjacobsen

Copy link
Copy Markdown
Collaborator

This merge adds a test, and fixes an issue where input strings (for example in env-vars) that can be converted into a boolean (i.e. TRUE) are converted into Python syntax for the booleans (i.e. True).

They now retain their original input case.

@douglasjacobsen douglasjacobsen added the bug Something isn't working label Jun 23, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces syaml_bool to preserve the original string representation of booleans (such as 'TRUE' or 'False') when parsing and dumping YAML files, and updates the validator, expander, and variant modules to support it. The review feedback highlights a duplicate and buggy definition of represent_bool in OrderedLineDumper inside spack_yaml.py, and recommends replacing fragile string-based type checks (type(...).__name__ == "syaml_bool") in variants.py with robust isinstance checks.

Comment thread lib/ramble/spack/util/spack_yaml.py Outdated
Comment thread lib/ramble/ramble/variants.py Outdated
Comment thread lib/ramble/ramble/variants.py Outdated
Comment thread lib/ramble/ramble/variants.py Outdated
@ramble-pr-bot

ramble-pr-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown

Ramble Performance Test Metrics

Results produced with commit: 5b99a06

Test Name Outcome Duration (s) Most Recent Run (s) Last 5 Avg (s)
test_analyze_large_file passed 2.1270 2.0864 (98c396b) 2.1804
test_large_template_expansion passed 1.3754 1.4189 (98c396b) 1.5007
test_many_experiments passed 24.1070 24.7397 (98c396b) 25.6821
test_many_objects_defaults passed 14.2710 14.7790 (98c396b) 15.2573
test_matrix_filter_perf passed 0.8971 0.8987 (98c396b) 0.9282

@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.35%. Comparing base (37185cb) to head (5b99a06).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #1634   +/-   ##
========================================
  Coverage    93.35%   93.35%           
========================================
  Files          365      365           
  Lines        35552    35571   +19     
========================================
+ Hits         33188    33207   +19     
  Misses        2364     2364           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rfbgo

rfbgo commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

I'm generally OK with this and would like to get it merged. Do you plan to address the gemini comments?

This commit updates the YAML parser so that input strings (for example,
TRUE) retain their case, and are not converted into Python equivalents
(i.e. True).
@douglasjacobsen

Copy link
Copy Markdown
Collaborator Author

@rfbgo Comments should be addressed now.

@rfbgo
rfbgo merged commit 126e02d into GoogleCloudPlatform:develop Aug 3, 2026
30 checks passed
@rfbgo
rfbgo deleted the env-var-case branch August 3, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants