Module def_store

Module def_store 

Source
Expand description

DefinitionStore — file-per-definition CRUD on <root>/<id>.json with a sibling retired/<id>.json tombstone tree.

Sibling of store.rs (the named-instance Registry). Same on-disk discipline: atomic rename for cross-process safety, a forward-compat merge that preserves unknown fields, refuses schema downgrades, and never clobbers an unparseable file. Holds the GLOBAL agent-definition roster so any channel/version sees the same agents (P0.2 of docs/specs/SPEC_CROSS_CHANNEL_AGENT_PERSISTENCE_2026-06-13.md).

The forward-compat merge helpers below intentionally parallel the private ones in store.rs. They are kept separate (not shared) so this addition is fully isolated from the in-production instance registry; a later cleanup can extract a generic file-store both use.

Structs§

DefinitionStore

Enums§

DefStoreError

Functions§

merge_for_write 🔒
Merge an in-memory record into an on-disk file’s raw JSON, preserving fields beyond this binary’s struct shape. Returns Ok(None) (skip, leave file intact) on corrupt JSON, missing schema_version, or schema_version above DEF_MAX_SUPPORTED_SCHEMA. Parallels store.rs::merge_for_write (see module docs).
merge_known 🔒
Overwrite target‘s top-level keys with updates’ keys, preserving keys absent from updates; recurses into data.
read_and_validate 🔒
to_pretty 🔒