Skip to content

fix(executor): classify HTTP errors via structured status, not substring (closes #322)#334

Merged
obchain merged 1 commit intomainfrom
fix/322-submit-classifier-substring
Apr 25, 2026
Merged

fix(executor): classify HTTP errors via structured status, not substring (closes #322)#334
obchain merged 1 commit intomainfrom
fix/322-submit-classifier-substring

Conversation

@obchain
Copy link
Copy Markdown
Owner

@obchain obchain commented Apr 25, 2026

Summary

  • Replace substring matching on rendered transport error with structured TransportErrorKind::HttpError(http).status check.
  • Removes the platform-sensitive failure on Linux runners caused by random ephemeral ports colliding with HTTP-status substrings (e.g. port 42912 contains '429').
  • Behaviour unchanged for genuine 4xx / 5xx / non-HTTP transport errors.

Test plan

  • cargo test -p charon-executor submit:: — 11 passed locally on macOS.
  • CI runs the same suite — should now be green on Linux runners too.

Closes #322.

…ubstring

The submit classifier matched 4xx codes by substring-checking the
rendered transport error message. On Linux runners the random ephemeral
port (range 32768-60999) frequently contained substrings like '404' or
'429', causing legitimate ECONNREFUSED errors to be mis-classified as
RpcRejected instead of ConnectionLost. macOS ephemeral range starts at
49152, so the collision never reproduced there — hence the
platform-sensitive test failure tracked in #322.

Switch to structured matching on TransportErrorKind::HttpError and
read http.status as u16 directly. 4xx still surfaces as RpcRejected
(deterministic, caller should not rebuild submitter); 5xx and any
other transport error fall through to ConnectionLost so the caller
reconnects on the next tick.

Closes #322.
@obchain obchain merged commit 14d7b93 into main Apr 25, 2026
4 checks passed
@obchain obchain deleted the fix/322-submit-classifier-substring branch April 25, 2026 18:49
obchain added a commit that referenced this pull request Apr 26, 2026
* ci: restore fmt + clippy gates and switch rust job back to Linux

Followup to #319 (clippy unblocked), #320 (workspace fmt), #322
(submit classifier Linux-safe).

- Add cargo fmt --all -- --check as the first rust-job step.
- Add cargo clippy --workspace --all-targets --locked -- -D warnings
  before tests, so lint regressions block merge instead of leaking in.
- Switch rust job from macos-latest back to ubuntu-latest. The
  platform-sensitive ECONNREFUSED classifier was fixed by #334
  (substring match -> structured TransportErrorKind::HttpError.status
  check), so the macOS pin is no longer needed. Linux runners are
  faster and cheaper.

Reviewer (blockchain-code-reviewer) confirmed step ordering, cache
locality, action syntax, and permissions are clean.

* ci: cargo fmt --all on token_meta.rs (introduced post #335)
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.

fix(executor): submit_returns_connection_lost_when_transport_fails is platform-sensitive on Linux

1 participant