Skip to content

test(workflows): pin untested workflow expression behavior - #5130

Merged
mnriem merged 2 commits into
github:mainfrom
markuswondrak:chore/5060-expression-gap-tests
Oct 28, 2026
Merged

mnriem merged 2 commits into
github:mainfrom
markuswondrak:chore/5060-expression-gap-tests

Conversation

@markuswondrak

Copy link
Copy Markdown
Contributor

Preparation for #5060, PR 2 of 3 (follows #5114). Adds unit tests in tests/test_workflows.py for workflow expression evaluator behavior that is already implemented and documented on main but was not directly asserted. Tests only; no production code or behavior change.

Why

Before PR 3 replaces the hand-written parser in engine_current.py with the Lark LALR grammar (engine_lark_a2.py), the existing suite should pin every documented and implemented behavior of the current evaluator so that the engine swap is verified against the full behavioral surface on main.

Coverage added

Test What it pins
test_comparison_greater_equal_and_less_equal >= and <= across numbers, numeric strings ("10" >= "9"), plain strings (lexicographic), and incomparable number-vs-string operands (False)
test_boolean_literals_are_case_insensitive True, TRUE, False, FALSE
test_null_literals none and null in any casing resolve to None rather than a namespace path
test_filter_map_dot_path_attribute map('result.status') walks nested dicts and yields None for missing intermediate branches
test_filter_default_on_empty_string default falls back on "" as well as None, while passing non-empty strings through
test_filter_from_json_returns_non_object_types from_json for JSON arrays, integers, floats, booleans, and null
test_filter_argument_resolved_from_namespace Filter arguments resolved from inputs.* paths (join(inputs.sep), default(inputs.sep))
test_boolean_precedence_without_parentheses and binds tighter than or (a or b and c vs (a or b) and c)
test_item_and_fan_in_namespace item, item.name, list-indexed item[0] / item[-1], and fan_in.results
test_interpolation_with_steps_and_item String interpolation with steps.<id>.output.* and item
test_empty_expression_block_is_empty_string {{ }} evaluates to "" in expressions and False in conditions
test_missing_intermediate_path_resolves_to_none Missing intermediate segments (inputs.a.b when a={}) resolve to None
test_whitespace_inside_and_around_block Leading/trailing whitespace inside {{ ... }} and around filter pipes/arguments
TestGateStep.test_message_expression_is_interpolated GateStep interpolates {{ ... }} in message before persisting step output

Verification

  • uv sync --extra test && .venv/bin/python -m pytest tests/test_workflows.py -q → 830 passed
  • .venv/bin/python -m pytest tests -n auto -q → 12845 passed, 435 skipped, 0 failed
  • ruff check src tests → clean

Not in this PR

PR 3 replaces the hand-written parser with the Lark LALR grammar and adds regression tests for the hand-written-parser bugs reported in #5071 and #5073.

AI Disclosure

Tests originally authored with OpenCode (model: claude-opus-5.5, autonomous) under human direction; cherry-picked onto main, verified, and PR description drafted with Google Antigravity (model: Gemini 4 Argon Medium, supervised).

Add positive and negative tests for evaluator behavior that was implemented
and documented but never asserted, so a replacement engine can be compared
against what the evaluator actually promises:

- >= / <= for numbers, numeric strings, plain strings and mixed operands
- case-insensitive boolean literals and none/null literals
- map('a.b'), default on an empty string, from_json for every JSON type,
  filter arguments resolved from the namespace
- and/or precedence without parentheses
- the item and fan_in roots, interpolation with steps and item
- the empty block, a missing intermediate path, whitespace around tokens
- gate message interpolation

Tests only; no behavior change. 830 passed in tests/test_workflows.py
(12845 passed, 435 skipped across the full suite).

Assisted-by: OpenCode (model: claude-opus-5.5, autonomous)
Assisted-by: Google Antigravity (model: Gemini 4 Argon Medium, supervised)
@markuswondrak
markuswondrak requested a review from mnriem as a code owner October 26, 2026 17:01
Copilot AI max review requested due to automatic review settings October 26, 2026 17:01

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@mnriem mnriem added the triage-can-wait Verdict: valid and in-scope but deprioritized; held behind the evidence gate label Oct 26, 2026
@mnriem
mnriem requested a max review from Copilot October 26, 2026 20:21

Copilot AI 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.

🟡 Changes recommended

Key assertions need strengthening to reliably protect documented behavior during the planned parser replacement.

2 open issues

Review effort: Max

Comment thread tests/test_workflows.py Outdated
Comment thread tests/test_workflows.py
@mnriem

mnriem commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Please address Copilot feedback

@mnriem mnriem added the author-awaiting Waiting on author response label Oct 26, 2026
… passthroughs

- Assert _collect_leaves(literal) == [] for null-literal forms.
- Assert default preserves documented falsy values (0, False, [], {}).

Assisted-by: Google Antigravity (model: Gemini 3.8 Flash, supervised)
Copilot AI max review requested due to automatic review settings October 27, 2026 13:08
@markuswondrak

Copy link
Copy Markdown
Contributor Author

Addressed in f7164d2e:

  • In test_null_literals, assert _collect_leaves(literal) == [] through the expressions facade for all null spellings to ensure literals are not treated as unknown names in condition diagnostics.
  • In test_filter_default_on_empty_string, assert that documented falsy values (0, False, [], {}) pass through unchanged.

AI disclosure: Posted on behalf of @markuswondrak by Google Antigravity (model: Gemini 3.8 Flash, supervised); the change was reviewed and approved before commit.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@mnriem
mnriem requested a max review from Copilot October 27, 2026 19:25
@mnriem mnriem removed the author-awaiting Waiting on author response label Oct 27, 2026

Copilot AI 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.

🟢 Approval recommended

The tests match existing behavior, and the remaining optional refinements do not block approval.

No open issues 🎉

2 resolved since last review

Review effort: Max

@mnriem
mnriem merged commit 3c99baa into github:main Oct 28, 2026
16 checks passed
@mnriem

mnriem commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage-can-wait Verdict: valid and in-scope but deprioritized; held behind the evidence gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants