ADR-060: Legacy choice values¶
Status¶
Accepted.
Context¶
Renaming choice values otherwise rejects existing recorded answers on update. Templates need a declarative way to carry those answers to current values before validation and rendering. History-discovered migrations run after rendering and cannot repair an answer rejected during evaluation.
Decision¶
Add an optional question-level legacy string-to-string map to choice and multi_choice.
Keys are obsolete stored values and targets are current choice values, not labels or question names.
Translate only SuppliedAnswer::Recorded, after ordinary coercion and before answer validation.
This includes recorded comma-list conversion from ADR-055.
Multi-choice translation preserves order and duplicates, including duplicates introduced by converging aliases.
Normal choice membership and distinct-selection bounds apply afterward.
Require direct mappings: reject targets that are also sources, including self-maps and cycles. Reject sources still present in the offered catalogue, independently of answer origin. Literal catalogues must contain all targets. Dynamic catalogues may filter out unused targets; selected translated values must still be offered. Inactive questions and empty dynamic catalogues retain existing skipping behavior. Exact string matching adds no expressions, environment access or graph dependencies. Inheritance replaces the entire question declaration, including the map.
Explicit CLI/file inputs, defaults, prompts, seeds, composed typed forwarding and switch candidates are unchanged. Shared previews translate in memory, while successful update uses existing semantic config writeback, including when the rendered tree is unchanged. No historical schema inspection or migration-file discovery is needed.
Consequences¶
Authors retain every supported historical spelling mapped directly to its current value.
A successful update reaches a stable answer in one pass and subsequent updates avoid configuration rewrites.
Failed validation leaves configuration and the rendered ref unchanged.
The additive manifest field and questions JSON object expose compatibility without changing stored answer formats.
Runtime catalogue ambiguity is reported as tpl::eval::legacy_source_offered with template-author remediation.