From 250c5c22b8af12fd81f299ef158977483433c30a Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Thu, 23 Jul 2026 03:57:55 +0000 Subject: [PATCH] Align the spell response schema --- docs/internal/modules.md | 12 ++++++------ .../spells/assets/schemas/dnd_spells_llm.v1.json | 2 +- internal/modules/dnd/extract/spells/schema_test.go | 7 +++++++ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/docs/internal/modules.md b/docs/internal/modules.md index fd06114..0e48a53 100644 --- a/docs/internal/modules.md +++ b/docs/internal/modules.md @@ -334,12 +334,12 @@ independently for extraction and normalization. The combat normalizer prepares an external NPC registry before execution or receives a generated registry at the ordered step handoff, then uses the immutable view during runtime. It display-normalizes actors, -rewrites exact canonical-name or alias matches for actors, orders -and deduplicates source references, stable-sorts records by source-document -position, and collapses only exact duplicate identities with fully valid -evidence. It deep-clones output storage and emits bounded warnings scoped to -merged input indexes. Its metadata and fingerprints identify the normalization -and NPC identity policies. External bindings may contribute registry +rewrites canonical-name matches for actors, orders and deduplicates source +references, stable-sorts records by source-document position, and collapses +only exact duplicate identities with fully valid evidence. It deep-clones +output storage and emits bounded warnings scoped to merged input indexes. Its +metadata and fingerprints identify the normalization and NPC identity policies. +External bindings may contribute registry digest/count metadata; generated identity is retained in framework provenance and dependency fingerprints. The normalizer is included in the production D&D registrar with the default combat normalization chain. diff --git a/internal/modules/dnd/extract/spells/assets/schemas/dnd_spells_llm.v1.json b/internal/modules/dnd/extract/spells/assets/schemas/dnd_spells_llm.v1.json index 71ec207..7dab9ff 100644 --- a/internal/modules/dnd/extract/spells/assets/schemas/dnd_spells_llm.v1.json +++ b/internal/modules/dnd/extract/spells/assets/schemas/dnd_spells_llm.v1.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "notarius.dnd.spells.llm", + "$id": "notarius.dnd.spells", "type": "object", "additionalProperties": false, "required": ["spell_casts"], diff --git a/internal/modules/dnd/extract/spells/schema_test.go b/internal/modules/dnd/extract/spells/schema_test.go index 8f7b4fa..1f603bb 100644 --- a/internal/modules/dnd/extract/spells/schema_test.go +++ b/internal/modules/dnd/extract/spells/schema_test.go @@ -20,6 +20,13 @@ func TestLoadResponseSchemaUsesExtractorOwnedLLMSchema(t *testing.T) { if !strings.HasPrefix(schema.SHA256, "sha256:") || !json.Valid(schema.JSONSchema) { t.Fatalf("schema metadata = %#v, want valid hashed JSON", schema) } + var schemaDocument map[string]any + if err := json.Unmarshal(schema.JSONSchema, &schemaDocument); err != nil { + t.Fatalf("Unmarshal(schema.JSONSchema) error = %v, want nil", err) + } + if schemaDocument["$id"] != ResponseSchemaID { + t.Fatalf("schema $id = %#v, want %q", schemaDocument["$id"], ResponseSchemaID) + } valid := validSpellsResponse() validJSON, err := json.Marshal(valid)