Repository navigation
Conversation
An unquoted word in a check, wait or wait_check comparison is now resolved as a state name, so the error says it is not a known state rather than mimicking Ruby's uninitialized constant. Document that the expression APIs evaluate code, so strings must be quoted and match exactly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4046-make-apis-wait-check-case-insensitive #4182 +/- ##
==============================================================================
- Coverage 80.62% 80.37% -0.25%
==============================================================================
Files 913 911 -2
Lines 71322 70847 -475
Branches 2779 2741 -38
==============================================================================
- Hits 57501 56946 -555
- Misses 13136 13233 +97
+ Partials 685 668 -17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
4fe91ed
into
4046-make-apis-wait-check-case-insensitive
…4159) * feat(script): match state names case insensitively in check and wait - Match string operands to state names ignoring case in check, wait and wait_check, so 'Connected' matches CONNECTED - Accept an unquoted state name, e.g. == Connected, instead of raising NameError - Only call get_item when the operand contains a string and the type is not RAW, so numeric comparisons add no API call - Add operand_contains_string and upcase_state_names to extract.rb and extract.py, shared by both Python api_shared copies - Update scripting-api.md, which said state values must be quoted Closes #4046 Co-Authored-By: Claude noreply@anthropic.com * refactor(script): move state name comparison into extract - Move _extract_comparison and _states into a single extract_comparison in extract.rb and extract.py, removing the copy duplicated across both Python api_shared files - Add extract_comparison unit tests covering mixed lists, unquoted states, items without states and when the item is looked up - Prefix the unused stdout block parameter in api_shared_spec.rb Refs #4046 Co-Authored-By: Claude <noreply@anthropic.com> * test(script): remove state tests duplicated across api_shared suites - Keep integration coverage of case insensitive states in the api suite, which uses the real get_item - Reduce the script suite to checking when API_SERVER.get_item is called, since extract_comparison is now unit tested in test_extract Refs #4046 Co-Authored-By: Claude <noreply@anthropic.com> * feat(script): accept unquoted state names inside in lists - Resolve bare words through an optional resolver in extract_operand so in [On, Off] matches states, including nested lists - Parse Python collections element by element when literal_eval rejects them, and look up the item only once per comparison - Clarify that only non-state strings must be quoted in the check, wait and wait_check docs Refs #4046 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(script): report unquoted non-state words as unknown state names (#4182) An unquoted word in a check, wait or wait_check comparison is now resolved as a state name, so the error says it is not a known state rather than mimicking Ruby's uninitialized constant. Document that the expression APIs evaluate code, so strings must be quoted and match exactly. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Jason Thomas <jason@openc3.com>



What changed
check,waitorwait_checkcomparison that is not a state name now raisesNameError: Unknown state name OFFLINE. Did you mean 'OFFLINE' as a string?instead ofUninitialized constant OFFLINE...(Rubyextract.rb, Pythonextract.py)NameErrorso existing rescues keep workingcheck_expression,wait_expressionandwait_check_expressionkeep theUninitialized constantmessage since they really evaluate codescripting-api.md: the expression is evaluated as code, so strings must be quoted, match exactly, and state names are not case insensitive or unquotable thereWhy it changed
Follow-up to #4159. Unquoted words are now valid when they are state names, so "Uninitialized constant" no longer describes the error. The expression APIs don't get the new state name behavior, which users may otherwise expect.
Testing strategy
Updated Ruby specs (
extract_spec.rb,api_shared_spec.rb, 155 examples pass) and Python tests (test_extract.py, bothtest_api_shared.py, 202 pass). Ruff and Prettier clean.🤖 Generated with Claude Code