Migrated from Method backlog
GitHub Issues are now the live work tracker. Repository docs remain Method evidence.
| Field |
Value |
| Source backlog |
docs/method/backlog/cool-ideas/PROTO_typed-codec-port-pattern.md |
| Archived source |
docs/archive/backlog/github-issue-migration-2026-06-01/docs/method/backlog/cool-ideas/PROTO_typed-codec-port-pattern.md |
| Original lane |
cool-ideas |
| Original id |
PROTO_typed-codec-port-pattern |
| Original legend |
PROTO |
| Original feature |
runtime-boundaries |
Original backlog card
Typed codec port pattern — domain never touches raw bytes for serde
The ShardPort pattern (domain works with typed shard objects, port
adapter owns Uint8Array ↔ object conversion) generalizes to ALL ports.
Instead of ports returning Uint8Array and the domain decoding:
// Current — domain does serde
const raw: Uint8Array = await port.read(key);
const decoded = codec.decode(raw); // domain is doing serde
Every port returns typed domain objects directly:
// Clean — port adapter owns serde
const shard: MetaShard = await shardPort.loadMeta(key);
// MetaShard is a typed domain object. Port decoded it.
This is SSTS P5 ("serialization is the codec's problem") taken to
its logical conclusion. The domain layer never imports a codec. Never
calls encode/decode. Never touches Uint8Array for serde purposes.
Bytes enter and leave through port adapters.
The domain can still work with Uint8Array when bytes ARE the domain
value (content blobs, binary attachments). The distinction: domain
bytes are content; adapter bytes are encoding.
Migrated from Method backlog
GitHub Issues are now the live work tracker. Repository docs remain Method evidence.
docs/method/backlog/cool-ideas/PROTO_typed-codec-port-pattern.mddocs/archive/backlog/github-issue-migration-2026-06-01/docs/method/backlog/cool-ideas/PROTO_typed-codec-port-pattern.mdcool-ideasPROTO_typed-codec-port-patternPROTOruntime-boundariesOriginal backlog card
Typed codec port pattern — domain never touches raw bytes for serde
The ShardPort pattern (domain works with typed shard objects, port
adapter owns Uint8Array ↔ object conversion) generalizes to ALL ports.
Instead of ports returning
Uint8Arrayand the domain decoding:Every port returns typed domain objects directly:
This is SSTS P5 ("serialization is the codec's problem") taken to
its logical conclusion. The domain layer never imports a codec. Never
calls encode/decode. Never touches
Uint8Arrayfor serde purposes.Bytes enter and leave through port adapters.
The domain can still work with
Uint8Arraywhen bytes ARE the domainvalue (content blobs, binary attachments). The distinction: domain
bytes are content; adapter bytes are encoding.