Skip to content

cow-venue: type the retry classifier boundary with OrderbookApiErrorType #496

Description

@mfw78

Follow-up from the end-of-train refactor analysis. Target: L3 . Priority: medium.

Problem

classify(error_type: &str), is_already_submitted(error_type: &str), and the internal GeneratedRow.error_type: &'static str operate on raw wire strings (crates/cow-venue/src/classification.rs:42, :80, :88), and the adapter calls them on api.error_type: String (crates/cow-venue/src/adapter.rs:391, :418). But cowprotocol::ApiError already exposes error_kind() -> OrderbookApiErrorType (a typed enum with an Unknown(String) fallback), and the crate's own parity test at classification.rs:287-:297 already trusts OrderbookApiErrorType to assert every table row names a real error type. So the typed key exists but the hot path stays stringly, and a call site can pass an arbitrary or misspelt &str with no compile-time signal.

Change

Have the public classify/is_already_submitted take OrderbookApiErrorType; the adapter passes api.error_kind() instead of &api.error_type. Key GeneratedRow lookups by comparing against the enum's canonical spelling. The build.rs-generated table may stay string-backed internally (compare via as_str()), but the boundary the adapter crosses becomes typed and the Unknown(_) case becomes explicit rather than an unlisted-string default.

Acceptance criteria

  • classify and is_already_submitted accept OrderbookApiErrorType, not &str.
  • The adapter passes api.error_kind(); no &str error-type flows across the classifier boundary.
  • The Unknown(_) variant is handled explicitly at the call site.
  • The existing parity test still passes; classification behaviour is unchanged for known types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions