Skip to content

spike(codec): compose value conversion from shared semantic rules #343

Closed

Description

@bbopen

Define conversion once for each logical value kind, then compose it through containers and scientific wrappers. Connect these rules to the callable contracts in #335.

The existing mapper collapses Python integers and floats to number. Return-schema generation and decoding make separate representation decisions. Reproduced outcomes are tracked in #331 and #332.

Scope:

  • Specify logical value kinds, numeric constraints, wire encodings, and decoded JavaScript representations separately.
  • Own one language-neutral value-contract description for policy, codec identifiers, and compatibility rules. Publish a frozen internal prototype interface for spike(codegen): compile complete callable contracts before emission #335.
  • Keep Python encoding and TypeScript decoding implementations explicit. Generate shared constants and structural checks where useful.
  • Apply primitive rules through records and collections, including supported scalar and model conversions.
  • Make Torch reuse ndarray conversion by dtype. Preserve Arrow payload fast paths without adding a second full traversal for schema validation.
  • Treat unsupported conversions as explicit outcomes, with paths and guidance.

Acceptance criteria:

Limit the prototype to two engineering days, one design iteration, and an independent review. This bounds investigation; it is not an implementation estimate. Preserve the existing transports, IR 0.4 inputs, and value-RPC execution model. Broad bigint and dataclass implementation remain separate work.

Activity

  1. added this to the Next milestone on Sep 11, 2026
  2. self-assigned this
    on Sep 11, 2026
  3. bbopen commented on Sep 20, 2026

    @bbopen
    OwnerAuthor

    The shared value contract now separates logical types, wire forms, decoded values, validators, and runtime capabilities. Default revision 2 freezes safe-number behavior and scientific provenance. Producer, decoder, generated types, and validators agree on root and nested values. Tests challenge dtype, shape, marker provenance, cycles, versions, unsupported kinds, depth, and payload limits.

    Independent review accepted union disjointness and the selected composition rules. Isolated revision 3 bigint and Point proofs demonstrate extension through shared descriptions; they are bounded prototypes, not universal extensibility or default transport claims.

    Evidence: docs/maintainers/value-contracts.v2.json, src/contracts/value-contract.ts, test/value_contracts.test.ts, test/architecture_mutations.test.ts, and docs/maintainers/architecture-decision-0.11.md.

    Verified release evidence:

    The architecture decision records the accepted scope and prototype limits.

    Closing with the implemented and verified 0.11 release outcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions