From d302e028ce568b16a5e43ffbafaa6be5596d372d Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Mon, 7 Sep 2026 08:43:59 +0200 Subject: [PATCH 1/2] State that @safety_critical promotes requirement, and bound E070 against E012 MEDUI-DEC-004 said an @safety_critical node requires a requirement identifier, but spec/component-model.md - where a reader looks for field requirements - never said the annotation promotes an otherwise-optional field. E070 and E012 could each be read as the code for the same authoring mistake. component-model.md now has a Safety annotations section: the annotation makes requirement required regardless of the component's own row (absence -> E070), while a component that already requires requirement reports the ordinary E012, so the codes never overlap. MEDUI-DEC-004 gains the same sentence. Case conformance/semantics/safety-critical-already-required pins the E012 path: an annotated CriticalButton missing requirement, asserting E012, not E070. --- .../safety-critical-already-required/case.json | 13 +++++++++++++ .../safety-critical-already-required/source.medui | 12 ++++++++++++ decisions/MEDUI-DEC-004-safety-and-goldens.md | 7 +++++-- spec/component-model.md | 13 +++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 conformance/semantics/safety-critical-already-required/case.json create mode 100644 conformance/semantics/safety-critical-already-required/source.medui 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..6c286d7 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: `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. From a96db8e5fe122f719d4490bc79d0e65a547fd61d Mon Sep 17 00:00:00 2001 From: Ambroise Leclerc Date: Mon, 7 Sep 2026 09:42:09 +0200 Subject: [PATCH 2/2] Spell MEDUI-E070 in full in the safety-annotations section Follow-up to review on PR #22: one reference used the shortened E070. --- spec/component-model.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/component-model.md b/spec/component-model.md index 6c286d7..93c671a 100644 --- a/spec/component-model.md +++ b/spec/component-model.md @@ -98,7 +98,7 @@ 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: `E070` is reachable +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