Skip to content

Fix integration tests for the tool response envelope (#433); fix filesystem action clobbering - #434

Merged
jeremymanning merged 1 commit into
mainfrom
fix/integration-tool-result-envelope
Aug 1, 2026
Merged

Fix integration tests for the tool response envelope (#433); fix filesystem action clobbering#434
jeremymanning merged 1 commit into
mainfrom
fix/integration-tool-result-envelope

Conversation

@jeremymanning

Copy link
Copy Markdown
Member

Closes #433.

You confirmed the {success, result, error} envelope is the intended contract, so these tests were asserting a shape that no longer exists.

Three causes, not one

The 29 failures looked uniform but weren't:

Cause Fix
Envelope mismatch payload() helper unwraps result; success/error stay on the envelope
Assertions that could never fail assert "error" in result appeared 4×; the envelope always has that key
Missing optional deps reported as failures bs4/playwright absence now skips with the reason

Before changing anything I probed TerminalTool for ok / failing / missing-binary / timeout to establish that envelope success tracks the command's exit status, not merely "the tool ran" — so result["success"] assertions were already correct and only payload keys move.

Production fix included

A pipeline could not read a file at all. _handle_file_operation copied the step's routing action over the caller's parameter:

- id: read_data
  action: file          # selects the TOOL
  parameters:
    action: read        # selects the OPERATION  <- was overwritten by "file"

FileSystemTool received action="file" and failed with Unknown filesystem action: file. The metadata-routed branch in the same function already guarded this; the second branch didn't. Now consistent.

tests/test_filesystem_step_action.py covers read/write/list plus the no-parameter case the original behaviour existed for. Verified it fails 3/4 without the fix.

Also

  • Un-shadowed a test. Two methods in TestPipelineTestProvider shared a name, so the first (constructor + model registry checks) never ran. Renamed the second to what it actually tests. This immediately exposed that PipelineTestModel cannot be constructed at all — filed separately rather than half-fixed here.
  • Documented inline that passing structured data between steps needs | tojson, or a dict is interpolated with Python's repr and the validator rejects it as "not JSON or CSV".

Numbers

before after
test_tools_real_world.py 17 failed, 2 passed 15 passed, 4 skipped
whole integration selection 29 failed, 12 passed 12 failed, 28 passed
blocking gate 386 390 passed

Every skip names its missing prerequisite. Correctness lint clean including tests/integration, which CI does not currently lint.

Not fixed here

The remaining 12 failures / 9 errors are unrelated to the envelope and each other: YAML pipeline compilation (8), missing test fixture files, and tests needing registered models that aren't available without API keys.

🤖 Generated with Claude Code

…bering

Closes #433. The envelope {success, result, error} is the intended contract,
so the tests were asserting a superseded flat shape. Adds a `payload()` helper
that documents the contract in one place and unwraps it.

Three separate causes were behind the 29 failures, not one:

1. Envelope mismatch. `result["stdout"]` etc. now read `payload(result)`.
   `success` and `error` stay on the envelope -- `success` tracks the
   command's exit status, verified against TerminalTool for ok/failing/
   missing-binary/timeout cases before changing anything.

2. Assertions that could never fail. `assert "error" in result` appeared in
   four places. The envelope ALWAYS has that key, so those tests passed
   whether or not the tool handled the error at all. They now assert the
   error's value.

3. Missing optional dependencies reported as failures. bs4/playwright absence
   now skips with the reason naming what is missing, per CONTRIBUTING, rather
   than failing.

PRODUCTION FIX (not a test change): a pipeline could not read a file at all.
`_handle_file_operation` copied the step's routing action over the caller's
parameter, so `action: file` + `parameters.action: read` sent action="file"
to FileSystemTool, which failed with "Unknown filesystem action: file". The
metadata-routed branch in the same function already guarded against this; the
second branch did not. Now consistent. tests/test_filesystem_step_action.py
covers it and was confirmed to fail 3/4 without the fix.

Also found while fixing pipeline YAML: passing structured data between steps
needs `| tojson`, or a dict is interpolated with Python's repr and the
validator rejects it as "not JSON or CSV". Documented inline where it bites.

Un-shadowed a test: two methods in TestPipelineTestProvider shared a name, so
the first (which checks the constructor and model registry) never ran. Renamed
the second to what it actually tests. This immediately exposed that
PipelineTestModel cannot be constructed at all -- filed separately rather than
half-fixed here; reverting my partial kwarg fixes kept this change focused.

tests/integration/test_tools_real_world.py: 17 failed/2 passed -> 15 passed,
4 skipped. Whole integration selection: 29 failed/12 passed -> 12 failed/28
passed. Blocking gate 386 -> 390. Collection warnings still 0; correctness
lint clean including tests/integration, which CI does not currently lint.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jeremymanning
jeremymanning merged commit 2bc564c into main Aug 1, 2026
9 checks passed
@jeremymanning
jeremymanning deleted the fix/integration-tool-result-envelope branch August 1, 2026 14:54
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.

Integration tool tests assert against a superseded flat return shape (29 failed, 11 errors)

1 participant