Skip to content

Domain types own their own serialization (P5 violation) #385

Description

@flyingrobots

Migrated from Method backlog

GitHub Issues are now the live work tracker. Repository docs remain Method evidence.

Field Value
Source backlog docs/method/backlog/bad-code/SUB_p5-serialization-on-types.md
Archived source docs/archive/backlog/github-issue-migration-2026-06-01/docs/method/backlog/bad-code/SUB_p5-serialization-on-types.md
Original lane bad-code
Original id SUB_p5-serialization-on-types
Original legend SUB
Original feature observer-admission-runtime
Original release home v19.0.0

Original backlog card

Domain types own their own serialization (P5 violation)

Effort: S

What's Wrong

canonicalJson() lives directly on TickReceipt, EffectEmission,
and DeliveryObservation. ORSet has serialize()/deserialize().

P5: "Serialization is the codec's problem. Domain types do not know
how they are encoded." These methods couple domain types to a specific
encoding format and make it impossible to swap codecs.

Suggested Fix

Move serialization to codec modules in src/infrastructure/codecs/.
Domain types expose their data via accessors; codecs own the encoding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:runtimePrimary work area: runtime.priority:laterDeferred or speculative work.status:availableOpen and available for prioritization; not blocked or actively in progress.type:debtDebt, rot, or structural risk.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions