feat: schema-harden the domain publish path (musehub#117 Phase 1)
DOM_05: viewer_type is now a real enum (Literal['symbol_graph', 'piano_roll', 'generic']) instead of unvalidated free text. Dropped 'sequence_viewer' from the enum rather than keeping it as a documented- but-never-implemented dead value - the frontend never rendered it distinctly, only symbol_graph/piano_roll get real icon/color treatment today (see Phase 2 for building the real palette).
DOM_06: capabilities is now a real Pydantic model (DomainCapabilities/ DimensionSchema) instead of an unschema'd dict[str, PydanticJson]. merge_semantics is a fixed enum (ot|crdt|three_way); dimensions must be {name, description} objects, not arbitrary shapes. All fields default to safe empty values so the existing capabilities={} minimal-manifest case (used throughout the test suite) stays valid - only genuinely malformed input is rejected, with a specific 422 instead of a silent accept or a generic 500 further down the pipeline.
DOM_07: capabilities capped at 16 KB serialized and 50 dimensions - both generous for a real declarative manifest, both closing the unschema'd-JSON DoS surface that existed with no cap at all.
DOM_08: POST /api/domains rate limited (DOMAIN_REGISTER_LIMIT = 10/minute, mirroring the existing @limiter.limit pattern from wire.py).
10 new tests in test_domains.py covering each rejection case plus sanity checks that legitimate minimal/full manifests still succeed; DOMAIN_REGISTER_LIMIT added to test_rate_limiting.py's constants coverage. 76/76 in test_domains.py, 60/60 in test_rate_limiting.py, no regressions.
Semantic Changes
45 symbols
Files Changed
~4
998 in snapshot
0 comments
muse hub commit comment sha256:718975d3c370e58f13c9c213beaf5ab3fbb0e6f271af7ce22398d340ef85e55d --body "your comment"
No comments yet. Be the first to start the discussion.