cultcache-py: MessagePack is the default payload; PayloadCodec; convert (py-msgpack-default) #179

Merged
libby merged 2 commits from hands/py-msgpack-default-r2 into main 2026-11-17 03:27:46 +00:00
Member

Lands cultlib-gaps:ruling:py-msgpack-default and follow_ups py-msgpack-default-version-bump and py-default-payload-json. Port of origin/hands/py-msgpack-default (20 commits, tip d9f73281, ~1234 behind main) as one squash onto current main.

What it does

  • define_document_type reads and writes MessagePack by default. A definition's payload_codec (PayloadCodec; MESSAGEPACK_PAYLOAD_CODEC, JSON_PAYLOAD_CODEC, PayloadCodecFault, CultCachePayloadFormatError) owns the format and replaces the payload_encoder/payload_decoder fields and parameters.
  • MessagePack codec: reference-reader keys, 64-bit integers, timestamp range, no ext but timestamp, one check on read and write.
  • convert(source, destination, definitions) writes a new store from a 0.3 JSON store, never touching the source.
  • Python replication's stamp router reads through the codec (no map-key judgement of its own).

Reconciled with main (main wins)

  • Main's read_payload_tree stays the one payload read: depth first, a tail is refused by count as a plain ValueError with main's text (pinned by test_union_parity and cultnet). The branch had made a tail a typed CultCachePayloadFormatError(not_one_value); that is dropped, so a 0.3 JSON object read as MessagePack now fails with the tail message. Branch tests re-pinned to it. read_payload_tree gained an optional depth_faults argument; its default decoder is still plain msgpack.
  • Store write/commit path (commit_store_file, stamps, _encode_snapshot, StoreUnreadableError) kept; the store reader now uses the codec's map-key reader. _file_bytes is a static helper on both file stores, used by convert. Main's catalog-publish refusal text kept over the branch's.
  • Main's stamp-routed tail tolerance in _infer_schema_version_from_payload kept; cultnet test adapted to resolve_document_for_raw_record (main has no ..._and_schema_id_...).

Version: pyproject stays 0.4.0. 0.4.0 is declared but untagged (last tag cultcache-py-v0.3.0) and main's Unreleased section is already its breaking minor; this change is the same minor over 0.3.0, so no further bump. CHANGELOG entry added. Tagging cultcache-py-v0.4.0 is the merger's.

Dependency on #176: convert and its README section raise CultCacheError, importable today from cultcache_py.cache. Root export is left to #176 (hands/cultcache-py-closeout); the README names the class only, so nothing here duplicates it. If #176 merges first, nothing to change.

Tests (py 3.13, venv in packages/cultcache-py, cultnet-py and cultmesh-py installed editable): cultcache-py 369 passed, 2 skipped; cultnet-py 177 passed; cultmesh-py 161 passed. Not run: Brokkr's bridge update named in the ruling; not admitted to Huginn.

🤖 Generated with Claude Code

Soul pass follow-ups (second commit): convert carries the source's store header (v3 stays v3; pinned by v3-base.msgpack, mutation-checked); README states the one-digit JSON exception and the untyped-slot byte difference; CHANGELOG records entry-type codec inheritance (bin-keyed main-era entries now fail to load), the doubled tree walk (left in place) and the roughly 2x codec cost; store-reader docstring/test name corrected; stale references fixed. Accepted by Self: the JSON codec's depth_faults=(RecursionError,) typed refusal resolves deferred cut-union-bounds-py.s2.depth-typed-refusal-lost for the JSON codec only.

Lands `cultlib-gaps:ruling:py-msgpack-default` and follow_ups `py-msgpack-default-version-bump` and `py-default-payload-json`. Port of `origin/hands/py-msgpack-default` (20 commits, tip d9f73281, ~1234 behind main) as one squash onto current main. **What it does** - `define_document_type` reads and writes MessagePack by default. A definition's `payload_codec` (`PayloadCodec`; `MESSAGEPACK_PAYLOAD_CODEC`, `JSON_PAYLOAD_CODEC`, `PayloadCodecFault`, `CultCachePayloadFormatError`) owns the format and replaces the `payload_encoder`/`payload_decoder` fields and parameters. - MessagePack codec: reference-reader keys, 64-bit integers, timestamp range, no ext but timestamp, one check on read and write. - `convert(source, destination, definitions)` writes a new store from a 0.3 JSON store, never touching the source. - Python replication's stamp router reads through the codec (no map-key judgement of its own). **Reconciled with main (main wins)** - Main's `read_payload_tree` stays the one payload read: depth first, a tail is refused by count as a plain `ValueError` with main's text (pinned by `test_union_parity` and cultnet). The branch had made a tail a typed `CultCachePayloadFormatError(not_one_value)`; that is dropped, so a 0.3 JSON object read as MessagePack now fails with the tail message. Branch tests re-pinned to it. `read_payload_tree` gained an optional `depth_faults` argument; its default decoder is still plain msgpack. - Store write/commit path (`commit_store_file`, stamps, `_encode_snapshot`, `StoreUnreadableError`) kept; the store reader now uses the codec's map-key reader. `_file_bytes` is a static helper on both file stores, used by `convert`. Main's catalog-publish refusal text kept over the branch's. - Main's stamp-routed tail tolerance in `_infer_schema_version_from_payload` kept; cultnet test adapted to `resolve_document_for_raw_record` (main has no `..._and_schema_id_...`). **Version**: pyproject stays 0.4.0. 0.4.0 is declared but untagged (last tag cultcache-py-v0.3.0) and main's Unreleased section is already its breaking minor; this change is the same minor over 0.3.0, so no further bump. CHANGELOG entry added. Tagging `cultcache-py-v0.4.0` is the merger's. **Dependency on #176**: `convert` and its README section raise `CultCacheError`, importable today from `cultcache_py.cache`. Root export is left to #176 (hands/cultcache-py-closeout); the README names the class only, so nothing here duplicates it. If #176 merges first, nothing to change. **Tests** (py 3.13, venv in packages/cultcache-py, cultnet-py and cultmesh-py installed editable): cultcache-py 369 passed, 2 skipped; cultnet-py 177 passed; cultmesh-py 161 passed. Not run: Brokkr's bridge update named in the ruling; not admitted to Huginn. 🤖 Generated with [Claude Code](https://claude.com/claude-code) **Soul pass follow-ups (second commit)**: convert carries the source's store header (v3 stays v3; pinned by `v3-base.msgpack`, mutation-checked); README states the one-digit JSON exception and the untyped-slot byte difference; CHANGELOG records entry-type codec inheritance (bin-keyed main-era entries now fail to load), the doubled tree walk (left in place) and the roughly 2x codec cost; store-reader docstring/test name corrected; stale references fixed. Accepted by Self: the JSON codec's `depth_faults=(RecursionError,)` typed refusal resolves deferred `cut-union-bounds-py.s2.depth-typed-refusal-lost` for the JSON codec only.
cultcache-py: define_document_type defaults to MessagePack payloads; a definition's PayloadCodec owns its format; convert writes a new store (py-msgpack-default)
Some checks failed
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Has been cancelled
2267c81866
Ports hands/py-msgpack-default (20 commits) onto main as one squash. Main's one-value
payload read (bytes after the first value refused by count, depth first, plain
ValueError), update-with-retry, stamp hardening and store lock/commit path are kept;
the codec replaces payload_encoder/payload_decoder. JSON_PAYLOAD_CODEC reads 0.3
stores; convert(source, destination, definitions) rewrites them to a new store.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
cultcache-py: convert keeps the source store's header; README and CHANGELOG state the format limits exactly; stale references fixed
All checks were successful
CultMesh portability and performance / ubuntu-latest reactive semantics and leases (pull_request) Successful in 24m50s
b36cf5ed91
Soul pass on #179: a v3 source converted to v1 (now carried, pinned by the v3-base vector and
mutation-checked); README states the one-digit JSON exception once and the object-slot byte
difference from C#; CHANGELOG records the entry-type codec inheritance, the doubled walk and the
accepted JSON depth refusal; the store-reader docstring and test name no longer overstate
'codec alone'; stale payload_decoder/_refuse_past_depth_limit references fixed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
libby merged commit 7bbc56f5dd into main 2026-11-17 03:27:46 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
GameCult/CultLib!179
No description provided.