Data type families and array wire IDs

When designing an array encoding, decide which data types a reader must support together. An edition grants writers permission to use a wire ID. If that ID covers several data types, a reader supporting the edition must be able to decode every type covered by the contract. A generic ID works when that is the intended guarantee. Separate IDs let an edition promise support for one family while another family is still under development.

How patches use family-specific IDs

A patched array holds a base array, patch positions, and values to apply at those positions. Boolean, integer, and floating-point arrays share the in-memory encoding vortex.patches. During serialization the plugin picks a wire ID from the patch strategy. On read, the stored ID determines how to interpret the operation number in the metadata.

Wire ID

Accepted data type family

Meaning of operation 0

vortex.patched.bool

Boolean

Replace the base value at each patch position

vortex.patched.integer

Integer

Replace the base value at each patch position

vortex.patched.float

Floating point

Replace the base value at each patch position

The reader checks that the outer data type matches the decoded strategy. All three formats can then produce the same in-memory container and share compute kernels such as slicing.

What a frozen edition guarantees

Suppose a frozen edition permits integer patches and a later release implements decimal patches. If both used one generic wire ID, the edition’s ID check could not distinguish them. Extending that frozen ID to include decimals would let a newer writer pass the check and produce a file the edition’s original reader cannot decode.

With a separate decimal wire ID, the existing edition check can reject that output. A later edition can permit decimal patches as soon as its readers support them. Writers can continue using the original integer format for older readers, and the decimal implementation can reuse the same in-memory container.

The same reasoning applies to a new operation within a family. Suppose a future integer strategy combines low bits from the base with high bits from the patch. A reader that implements only replacement would reconstruct different integers if the writer reused operation zero, and it would reject an unknown operation number. Once the integer contract is frozen, this strategy therefore needs a new integer wire ID. Boolean and floating-point readers can keep using their existing contracts.