Skip to content

test(errors): add regression coverage for remote JSON-RPC error mapping#111

Draft
cursor[bot] wants to merge 1 commit intomainfrom
cursor/regression-prevention-tests-fc07
Draft

test(errors): add regression coverage for remote JSON-RPC error mapping#111
cursor[bot] wants to merge 1 commit intomainfrom
cursor/regression-prevention-tests-fc07

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor bot commented Apr 6, 2026

Description

Adds targeted regression tests for high-risk JSON-RPC error interop paths in asap.errors that were introduced with the recent error taxonomy and streaming work. These tests validate remote error metadata parsing/normalization, recoverable vs fatal classification, taxonomy fallback behavior, and JSON-RPC code slot normalization.

Fixes # (issue)

User Value

Users get more reliable client/server behavior when peers return structured JSON-RPC errors, especially during transient failures and retries. This reduces risk of silent misclassification (recoverable vs fatal), malformed retry hints, and taxonomy drift in core transport flows with large blast radius.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

  • ~/.local/bin/uv run pytest tests/test_errors.py -q
  • ~/.local/bin/uv run --with ruff ruff check tests/test_errors.py
  • ~/.local/bin/uv run --with ruff ruff format --check tests/test_errors.py

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Risky behavior now covered

  • Remote JSON-RPC error.data metadata handling (recoverable, retry_after_ms, alternative_agents, fallback_action, asap_taxonomy_code)
  • Taxonomy override using code field when present in remote payloads
  • Non-ASAP wire code handling (preserve wire code while normalizing internal ASAP slot)
  • Server-side JSON-RPC error data shaping via jsonrpc_error_data_for_asap_exception
  • Guard against duplicated troubleshooting text in connection error messages

Test files added/updated

  • Updated: tests/test_errors.py

Why these tests materially reduce regression risk

These assertions target protocol-interop behavior shared across transport client/server error flows, where small regressions can break retries, failover, or operator diagnostics across many integrations. The new tests lock down edge-case parsing and classification semantics without adding flaky network/system dependencies.

Open in Web View Automation 

Co-authored-by: Adrianno Esnarriaga <adriannoes@users.noreply.github.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
asap-protocol Ready Ready Preview, Comment Apr 6, 2026 0:09am

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.

1 participant