mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-08-31 02:41:44 +00:00
A composition can set a variable to a value outside that variable declared enum options. The value silently falls back, the composition renders something the author did not ask for, and no signal says a choice was ignored. Warns on both paths that resolve a variable, because they are separate. The runtime guard covers a top-level composition. The compile guard covers a sub-composition given instance values: those are baked into the variables table at compile time and the scoped getVariables shim only reads that table, so the runtime guard never runs there. That sub-comp case is the one that motivated this, and it was the silent one. Both call the same helper, so the message and the per-process dedupe set are shared and an author sees one warning either way. A warning rather than an error, for symmetry: the same defect must not carry two severities depending on which mount path an author happened to use. Escalation already has a home in lint, which a project can make blocking. The check is split across four small helpers rather than one function: parsing the declaration, naming the composition, reducing the option set to comparable scalars, and deciding whether a value actually fell back. As one function it audited at 21 cyclomatic and 25 cognitive. Tests were mutation-checked. Five distinct breakages each killed a test, including one that coerces the unknown value to the default instead of warning, which would turn a diagnostic into a silent rewrite.