Skip to content

Replace brittle EOF string matching with type-safe downcasting #434

@coderabbitai

Description

@coderabbitai

Context

Related to PR #424 which demonstrates the pattern for modularisation by refactoring the connection module.

Request from: @leynos
Source: #424

Objective

Replace brittle string matching for EOF classification in codec-error world steps with type-safe downcasting.

Current situation

  • tests/worlds/codec_error/decoder_ops.rs:101 uses brittle string matching to classify EOF errors
  • This is fragile and prone to breakage if error messages change

Proposed solution

Since CodecError::Eof becomes an io::Error carrying EofError internally (src/codec/error.rs:298):

  1. Downcast via io::Error::get_ref() to EofError
  2. Delete the string-matching heuristic
  3. Use type-safe error classification instead

Benefits

  • Type-safe error classification
  • More robust to error message changes
  • Eliminates brittle string matching
  • Clearer intent and better maintainability

Metadata

Metadata

Assignees

Labels

lowAin't annoying anyone but the QA department

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions