Skip to content

Audit #[repr(u8)], #[derive] order, and serde conventions #340

@joaquinbejar

Description

@joaquinbejar

Overview

Audit #[repr], #[derive] order, and serde attributes across every
public type. Small stable enums get #[repr(u8)]; #[derive] clauses
follow the canonical order; single-field newtypes use
#[serde(transparent)]; public-facing enums use
#[serde(rename_all = "snake_case")] unless an existing wire contract
prevents it; deserialized config / input DTOs use
#[serde(deny_unknown_fields)].

Context

  • rules/global_rules.md §Compiler Attributes — §#[repr], §#[derive],
    §Serde conventions.
  • Canonical derive order:
    Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default.

Tasks

  • Apply #[repr(u8)] to Side, OptionStyle, OptionType, and any
    other small stable enum (coordinate with upstream financial_types
    — avoid double-repr)
  • Reorder every #[derive(...)] to the canonical sequence; strip
    unjustified Default / Ord / Copy
  • #[serde(deny_unknown_fields)] on every input DTO
  • #[serde(rename_all = "snake_case")] on public-facing enums unless
    an existing wire contract forbids it; document the exception

Acceptance criteria

  • Canonical derive order everywhere
  • DTOs deny unknown fields
  • cargo clippy --all-targets --all-features --workspace -- -D warnings clean
  • cargo test --all-features --workspace clean (serde round-trips)

References

  • rules/global_rules.md — §Compiler Attributes

Metadata

Metadata

Assignees

Labels

refactorCode refactoring without changing behaviortype-safetyRelated to type safety improvements

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions