| 1 | <!-- English translation of adr/0066-cockpit-ui-vs-ide-presentation-layer.md. Canonical Russian: ../../adr/0066-cockpit-ui-vs-ide-presentation-layer.md --> |
| 2 | |
| 3 | # ADR 0066: Cockpit UI and presentation IDE layer - separate supports |
| 4 | |
| 5 | **Status:** Accepted |
| 6 | **Date:** 2026-04-19 |
| 7 | |
| 8 | ## Related ADRs |
| 9 | |
| 10 | | ADR | Role | |
| 11 | |-----|------| |
| 12 | | [0021](0021-pfd-mfd-cockpit-attention-model.md) | Attention model, EICAS | |
| 13 | | [0046](0046-presentation-layout-authority-and-cockpit-invariants.md) | Policy `presentation` | |
| 14 | | [0064](0064-deck-primitives-visual-language-render-layer-and-palette.md) | `PrimitivesKit`, cabin palette | |
| 15 | | [0065](0065-instrument-categories-domain-taxonomy.md) | Categories / `graph_kind` | |
| 16 | | [0013](0013-command-surface-and-discoverability.md) | Command Palette | |
| 17 | | [0030](0030-command-ids-hotkeys-and-ui-registry-layers.md) | Command registry, hotkeys | |
| 18 | | [0079](0079-ide-display-system-ids-overlay-pipeline.md) | IDS - shell overlays (**not** cockpit UI) | |
| 19 | |
| 20 | **Code:** `Cockpit/PrimitivesKit/`, `Features/UiChrome/`, `Themes/*.json`. |
| 21 | |
| 22 | --- |
| 23 | ## Context |
| 24 | |
| 25 | The product simultaneously contains: |
| 26 | |
| 27 | 1. **Instrumental layer of the cockpit** - deck, PFD/MFD/Forward zones, instruments, lamps, semantic map as a visual tool, role palette in the sense of EICAS/annunciator ([0021](0021-pfd-mfd-cockpit-attention-model.md), [0064](0064-deck-primitives-visual-language-render-layer-and-palette.md)). |
| 28 | 2. **IDE shell** - menu, window, command palette, modal overlays without “device” semantics, standard fields and indents for settings and dialogs, theme tokens for **regular** UI. |
| 29 | |
| 30 | Without an explicit separation, discussions and code reviews mix **Cockpit UI** and **presentation layer IDE** (conventionally “UI kit” of Chrome): they drag cockpit primitives into dialogs or, conversely, duplicate overlays and indents inside `PrimitivesKit`. This breaks the semantic boundary and makes it difficult for the theme and cockpit to evolve independently. |
| 31 | |
| 32 | --- |
| 33 | |
| 34 | ## Solution |
| 35 | |
| 36 | Fix **two supports** (two design contexts), not two mandatory namespaces for each line of code: |
| 37 | |
| 38 | | Support | Meaning | Typical place in code/artifacts | |
| 39 | |-------|--------|---------------------------------------| |
| 40 | | **Cockpit UI** | Visual language of **instruments and deck** in the cockpit metaphor: types of indicators, drawing of instruments, semantic colors of the cockpit (`CockpitPrimitivesPalette`), Skia-scenes of instruments, Dark Cockpit rules for **this** layer. | `Cockpit/PrimitivesKit/`, cockpit palette; ADR [0064](0064-deck-primitives-visual-language-render-layer-and-palette.md), [0063](0063-instrument-deck-named-composition-one-anchor.md), [0065](0065-instrument-categories-domain-taxonomy.md); connection with [0021](0021-pfd-mfd-cockpit-attention-model.md). | |
| 41 | | **IDE presentation (chrome)** | App-wide **non-device** things: window shell, command palette, reusable **modal overlays**, consistent padding/typography for chrome, `CascadeTheme` theme tokens/JSON for **shell**. | `Features/UiChrome/`; `Views/` for specific screens; themes in `Themes/`; commands and palette - [0013](0013-command-surface-and-discoverability.md), [0030](0030-command-ids-hotkeys-and-ui-registry-layers.md). | |
| 42 | |
| 43 | **Default rule:** if a widget makes sense **without** the deck / attention zones / device metaphor - it does not belong to **Cockpit UI**; if the meaning is “show the state in the deck cell / on the device / in the cockpit strip” - do not mix it with the general overlay layer and “just IDE”. |
| 44 | |
| 45 | **Invariant:** the **cabinet semantic palette** ([0064](0064-deck-primitives-visual-language-render-layer-and-palette.md)) is not the only color directory for the entire application: **theme** and **chrome** can set tokens for menus, editor and modals; hex matches are allowed only as a conscious agreement, not as a mandatory dependency of the cockpit on the shell. |
| 46 | |
| 47 | --- |
| 48 | |
| 49 | ## Consequences |
| 50 | |
| 51 | - Reviews and discussions clearly indicate the context: **Cockpit** vs **chrome IDE**; controversial cases are resolved by the default rule from the table above. |
| 52 | - New **reused** non-modal chrome primitives (overlays, standard settings cards) are being developed in the **`Features/UiChrome`** zone (or nearby in `Views`, without transferring to `Cockpit/`). |
| 53 | - **Cockpit** remains responsible for the consistency of instruments, deck and Skia rendering according to [0064](0064-deck-primitives-visual-language-render-layer-and-palette.md); do not duplicate the menu palette there “for the sake of file unity.” |
| 54 | |
| 55 | ### Testing in assembly (Roslyn) |
| 56 | |
| 57 | The **imports** border between `Features/UiChrome` and `Cockpit/PrimitivesKit` is fixed by the `CascadeIDE.ArchitectureAnalyzers` analyzer: |
| 58 | |
| 59 | - **CASCOPE011** - `using CascadeIDE.Cockpit.PrimitivesKit` is prohibited in `Features/UiChrome/`. |
| 60 | - **CASCOPE012** - `using CascadeIDE.Features.UiChrome` is prohibited in `Cockpit/PrimitivesKit/`. |
| 61 | Details and Constraints (MCP/`RoslynMcpWorkspace`) - [CascadeIDE.ArchitectureAnalyzers/README.md](../../CascadeIDE.ArchitectureAnalyzers/README.md). The full list of CASCOPE* is there. |
| 62 | |
| 63 | --- |
| 64 | |
| 65 | ## Non-targets (current phase) |
| 66 | |
| 67 | - Introduce a separate "UIKit" build or rename folders in one commit without the need. |
| 68 | - A comprehensive catalog of all theme tokens and components (this is a live guide and code, not duplicated in ADR). |
| 69 | - Disallow exceptions: a local prototype in a feature is possible, but does not define a second canon without revising the ADR. |
| 70 | |
| 71 | --- |
| 72 | |
| 73 | ## Alternatives (briefly) |
| 74 | |
| 75 | | Option | Minus | |
| 76 | |--------|--------| |
| 77 | | One “UI kit for everything”, including the cockpit | Mixing semantics; the cabin pulls the shell and vice versa | |
| 78 | | Verbal agreement only | No stable link for review and onboarding | |
| 79 | | New ADR for each control (button, field) | Noise; the layer boundary is sufficient at the level of this ADR | |