Replace stringly-typed patterns with enums and consolidate test utilities #7

Closed
opened 2026-03-01 09:56:28 +00:00 by mahmoud · 0 comments
Owner

Description

The codebase has accumulated several DRY violations and stringly-typed patterns that increase maintenance
burden:

  1. Duplicated test configs: test_config() -> Config is copy-pasted in 5 files with all 27+ fields — every
    Config change requires updating all 5
  2. Duplicated MockSigner: Identical mock in tft_to_spore.rs and node_register.rs
  3. Status strings: Transaction statuses ("PROCESSING", "CONFIRMED", etc.) compared with == — a typo would
    silently fail
  4. Event type strings: event_type field is a raw String compared with == in handlers
  5. Refund string protocol: RefundHandler returns "refund:0xhash" and bridge does
    strip_prefix("refund:") — fragile
  6. Unnecessary async constructors: Handler new() methods are async but contain no async ops
  7. Dead code: Several #[allow(dead_code)] functions that are genuinely unused
### Description The codebase has accumulated several DRY violations and stringly-typed patterns that increase maintenance burden: 1. **Duplicated test configs**: `test_config() -> Config` is copy-pasted in 5 files with all 27+ fields — every Config change requires updating all 5 2. **Duplicated MockSigner**: Identical mock in `tft_to_spore.rs` and `node_register.rs` 3. **Status strings**: Transaction statuses ("PROCESSING", "CONFIRMED", etc.) compared with `==` — a typo would silently fail 4. **Event type strings**: `event_type` field is a raw String compared with `==` in handlers 5. **Refund string protocol**: `RefundHandler` returns `"refund:0xhash"` and bridge does `strip_prefix("refund:")` — fragile 6. **Unnecessary async constructors**: Handler `new()` methods are async but contain no async ops 7. **Dead code**: Several `#[allow(dead_code)]` functions that are genuinely unused
mahmoud self-assigned this 2026-03-01 10:00:24 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_tfspores#7
No description provided.