diff --git a/conformance/semantics/safety-critical-already-required/case.json b/conformance/semantics/safety-critical-already-required/case.json new file mode 100644 index 0000000..8981f2f --- /dev/null +++ b/conformance/semantics/safety-critical-already-required/case.json @@ -0,0 +1,13 @@ +{ + "id": "MEDUI-CASE-SEMANTICS-SAFETY-CRITICAL-ALREADY-REQUIRED", + "phase": "semantics", + "source": "source.medui", + "inputs": { + "themeTokens": ["Theme.Colors.CriticalAction"], + "textPackages": [{ "locale": "en-US", "keys": ["STR-HALT"] }] + }, + "expected": { + "valid": false, + "diagnostics": [{ "code": "MEDUI-E012", "line": 4, "column": 5 }] + } +} diff --git a/conformance/semantics/safety-critical-already-required/source.medui b/conformance/semantics/safety-critical-already-required/source.medui new file mode 100644 index 0000000..e10c7db --- /dev/null +++ b/conformance/semantics/safety-critical-already-required/source.medui @@ -0,0 +1,12 @@ +Screen SafetyCriticalAlreadyRequired { + layout: Vertical { spacing: 0px; padding: 0px; } + @safety_critical(cv_check: [Bounds]) + CriticalButton { + id: halt; + width: 200px; + height: 80px; + label: t("STR-HALT"); + color: Theme.Colors.CriticalAction; + on_press: TriggerHalt; + } +} diff --git a/decisions/MEDUI-DEC-004-safety-and-goldens.md b/decisions/MEDUI-DEC-004-safety-and-goldens.md index 13c3082..32d9237 100644 --- a/decisions/MEDUI-DEC-004-safety-and-goldens.md +++ b/decisions/MEDUI-DEC-004-safety-and-goldens.md @@ -2,8 +2,11 @@ Status: Accepted -An `@safety_critical` node requires an explicit requirement identifier. A positioned node receives -an automatic `Bounds` golden. When both rules apply, the compiler emits one merged entry with +An `@safety_critical` node requires an explicit requirement identifier: the annotation promotes +`requirement` to required regardless of the component's own field list, and its absence is +`MEDUI-E070`. A component that already requires `requirement` and omits it reports the ordinary +`MEDUI-E012` instead, so the two codes never overlap. A positioned node receives an automatic +`Bounds` golden. When both rules apply, the compiler emits one merged entry with deduplicated checks. Dynamic content pins bounds and applicable color, not its changing value. These mechanisms provide reviewable engineering evidence; they do not by themselves establish diff --git a/spec/component-model.md b/spec/component-model.md index 202a640..93c671a 100644 --- a/spec/component-model.md +++ b/spec/component-model.md @@ -88,5 +88,18 @@ checks (`MEDUI-E071`), members outside a closed set (`MEDUI-E034`), and unknown identifiers (`MEDUI-E035`) fail compilation. An unknown `charset` or screen `layout` kind is also fatal and has no code assigned yet. +## Safety annotations + +`@safety_critical(cv_check: [...])` marks a node for rendered-truth evidence (MEDUI-DEC-004). The +annotation **promotes `requirement` to required** on the node it annotates, whatever that +component's own row says: a `Button` or `TextInput`, where `requirement` is otherwise optional, +must carry one once annotated, and its absence reports `MEDUI-E070`. + +`MEDUI-E070` is only ever the promotion failure. A component whose own row already requires +`requirement` — `CriticalButton`, `NumericDisplay`, `StatusIndicator` — that omits it reports the +ordinary `MEDUI-E012` (missing required field), annotated or not; the annotation adds no obligation +it did not already have. So the two codes never both apply to the same node: `MEDUI-E070` is reachable +only where the schema made `requirement` optional and the annotation made it required. + Compiled output is a flat, locale-free sequence of nodes with absolute rectangles and a finite draw budget. Implementation-specific output fields beyond these shared semantics are permitted.