Add combat turn normalization and invariants
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
# D&D Combat-Turn Artifact Contract
|
||||
|
||||
This document defines the durable artifact, serialization, extraction, and
|
||||
candidate-validation boundaries for D&D combat turns. Normalization and a
|
||||
selectable production pipeline lane are not part of this contract yet.
|
||||
This document defines the durable artifact, serialization, extraction,
|
||||
candidate-validation, and standalone normalization boundaries for D&D combat
|
||||
turns. Production composition and a selectable pipeline lane are not part of
|
||||
this contract yet.
|
||||
|
||||
## Artifact identity
|
||||
|
||||
@@ -119,5 +120,34 @@ at least four Unicode code points against complete cited-text tokens. Targets
|
||||
are not checked deterministically.
|
||||
|
||||
The extractor and validators are package-complete but are not registered by the
|
||||
production D&D family registrar yet. Normalization, production composition,
|
||||
and selectable configuration are defined when implemented.
|
||||
production D&D family registrar yet.
|
||||
|
||||
## Normalization boundary
|
||||
|
||||
The standalone normalizer uses key `dnd/combat-turns`, requires `merged`,
|
||||
provides `normalized`, accepts no options, and accepts the same optional
|
||||
`players`, `party`, `glossary`, deprecated `roster`, and structured `npcs`
|
||||
reference slots as extraction. The NPC registry is resolved during
|
||||
preparation; runtime normalization uses that immutable prepared view.
|
||||
|
||||
Normalization policy is `dnd.combat_turns.normalize.v1`. It display-normalizes
|
||||
actor, summary, declarations, targets, and non-null resolutions; canonicalizes
|
||||
exact registry actor and target matches; orders and deduplicates exact source
|
||||
references; stable-sorts records by earliest valid source-document position; and
|
||||
collapses only records with the same actor identity, turn kind, round value, and
|
||||
complete valid evidence set. The first normalized record is retained without
|
||||
merging its actions or prose. Invalid evidence is never eligible for duplicate
|
||||
collapse. Every mutation and collapse emits a bounded warning using the merged
|
||||
input index in its scope.
|
||||
|
||||
The normalizer reports `normalization_policy` and `identity_policy` metadata and
|
||||
fingerprints, plus `npc_registry_digest`, `npc_count`, and `npc_registry` only
|
||||
when a registry is bound. The normalized-invariants validator is
|
||||
`normalize/dnd/combat-turns/invariants`; it defers shape and source-reference
|
||||
failures, then checks display normalization, target identity uniqueness,
|
||||
canonical evidence ordering, chronology, and duplicate identity. It rejects
|
||||
with `invalid_combat_turn_normalization` under policy
|
||||
`dnd.combat_turns.validator.normalized.v1`.
|
||||
|
||||
The normalizer and normalized-invariants validator are package-complete but are
|
||||
not registered by the production D&D family registrar yet.
|
||||
|
||||
Reference in New Issue
Block a user