Skip to content

messages/mod.rs exceeds the audit file-length threshold (1430 > 800 LOC) #75

@nficano

Description

@nficano

Category: refactor Severity: major
Location: crates/arcp-core/src/messages/mod.rs:1-13

What

messages/mod.rs is 1430 lines and combines the central enum, wire-name mapping, helper predicates, re-exports, and large tests. The module is difficult to review when message-shape conformance changes touch one very large file.

Evidence

//! Wire-level message payload types.
//!
//! [`MessageType`] is a tagged enum (`#[serde(tag = "type", content =
//! "payload")]`) so on the wire a message renders flat:
//!
//! ```json
//! { "type": "ping", "payload": { "nonce": "..." } }
//! ```
//!
//! When this is `#[serde(flatten)]`-embedded into [`crate::envelope::Envelope`]
//! the `type` and `payload` keys appear at the envelope level alongside the
//! other metadata fields, matching the canonical wire format from ARCP v1.1
//! §5.

Proposed fix

Move message enum wiring, helper predicates, and tests into smaller cohesive modules while leaving payload structs in their existing per-surface files.

Acceptance criteria

  • The central message module is under 800 lines and serialization/deserialization tests still cover every message variant.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions