bankai/canonical
Canonical, deterministic byte encoding of a Task for content-addressing.
Determinism contract: identical Task field values MUST produce identical bytes, in every process, on every run. Therefore:
- fixed field order
- every variable-length value is length-prefixed (32-bit big-endian count)
- enums map to a fixed byte; Option to a tag byte
- Ints (bignum-safe) are encoded as length-prefixed decimal strings
- the relationship + labels lists are SORTED before encoding
- a leading VERSION byte lets us invalidate every hash if the encoding ever changes (see ADR-0002 — canonical-serialization versioning)
content_hash is intentionally NOT encoded — it is derived from these bytes.
Values
pub fn canonical_bytes(task: types.Task) -> BitArray