* feat(schemas): add immutable typed data models (#3)
Implement the frozen-dataclass data models for every inter-stage document
(MASTER_SPEC §9): Concept, Character, Interaction, Metadata, ResolvedTag,
CategoryMap, PromptOutput, and Scene, plus SceneObject.
- Immutable once produced: frozen dataclasses, concept arrays stored as tuples,
free-form mappings (Concept.metadata, CategoryMap) wrapped read-only.
- from_json / to_json on every model; model round-trip is lossless for all
documented fields, and each to_json() validates against its schema (#2).
- Concept loads from a bare string or an object; confidence is carried in
metadata and never affects logic (§9.3, §12.7).
- SceneObject aliases Concept: in V1 objects serialize as concepts per the
grammar (§10.4) and scene schema; §9.5 owner/attributes are not required in V1.
Tests: construction, serialization, round-trip, schema conformance, and
immutability (frozen assignment + read-only nested mapping).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(schemas): use default_factory for read-only mapping fields (Python 3.11)
Python 3.11 rejects a mappingproxy as a dataclass field default (treated as a
mutable default); 3.12+ allows it. Wrap the shared empty read-only mapping in a
default_factory so the models build on the minimum supported version.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* test(schemas): use pytest.approx for float confidence assertion
Avoid exact float equality in the Concept confidence test (SonarCloud
reliability rule). No behaviour change.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: kunail0804 <kunail0804@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>