Skip to content

fix(arazzo): parse 0 and 1 in simple conditions as numbers - #691

Open
rriski wants to merge 1 commit into
pb33f:mainfrom
rriski:fix/arazzo-number-literals
Open

rriski wants to merge 1 commit into
pb33f:mainfrom
rriski:fix/arazzo-number-literals

Conversation

@rriski

@rriski rriski commented Nov 3, 2026

Copy link
Copy Markdown

Fixes #690.

evaluateSimpleOperand used strconv.ParseBool before strconv.ParseInt. ParseBool accepts 1 and 0, so $response.body#/revision == 1 compared the number 1 with true and gave false.

This change accepts only true and false as boolean literals, as Arazzo 1.0.1 Literals specifies. Other operands go to the number parsers as before.

Tests

  • New TestEvaluateCriterion_SimpleCondition_NumberAndBooleanLiterals compares numbers and booleans from a response body. 6 of its 10 conditions fail before the change.
  • go test ./arazzo/... ./datamodel/high/arazzo/... ./datamodel/low/arazzo/... . passes.

AI disclosure

I used Claude Code, an AI coding assistant, to find the cause and to write this change and its test.

strconv.ParseBool accepts 1, 0, t and f, so the literal 1 compared equal to true and not to the number 1. Arazzo 1.0.1 defines only true and false as boolean literals.

Fixes pb33f#690
@codecov

codecov Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (0a89094) to head (2d87e6b).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #691   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          313       313           
  Lines        39555     39558    +3     
=========================================
+ Hits         39555     39558    +3     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@daveshanley daveshanley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

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.

Arazzo: number literals 0 and 1 in a simple condition become booleans

2 participants