From b0c0fdd4b14d229618c55f31400d468ceb046c62 Mon Sep 17 00:00:00 2001 From: giles Date: Mon, 29 Jun 2026 17:11:51 +0000 Subject: [PATCH] =?UTF-8?q?plan:=20Phase=203=20target=20is=20the=20CONSOLE?= =?UTF-8?q?=20=E2=80=94=20engine=20renders=20the=20same=20picker=20to=20a?= =?UTF-8?q?=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The non-browser platform is a console/TUI renderer: the engine's platform ops map to a text-node tree (harness-web's mock DOM is ~90% there), render-to-console prints it, a raw-stdin input loop drives simulate-click/input. The same ~relate-picker runs unchanged in a terminal — browser is one platform binding, console another, test harness a third. Co-Authored-By: Claude Opus 4.8 --- plans/sx-native-engine-tests.md | 38 +++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/plans/sx-native-engine-tests.md b/plans/sx-native-engine-tests.md index 6f4049c6..f8226809 100644 --- a/plans/sx-native-engine-tests.md +++ b/plans/sx-native-engine-tests.md @@ -74,10 +74,40 @@ Keep ONLY what needs a real browser in `relate-picker.spec.js` / `spa-check.spec Delete the per-behavior browser tests now covered by SX. Net: ~2 browser tests + an SX suite. -### Phase 3 — Stretch: the engine drives a non-browser target ("something else") -The mock platform already *is* a non-browser target. This phase makes it a real -alternative renderer (e.g. server-side DOM string-builder, or a native UI shim) and runs -the same picker through it — concretely proving platform-independence. Optional / future. +### Phase 3 — The engine drives the CONSOLE (the non-browser target) +The concrete "something else" is a **terminal / console platform**. This is the natural +sibling of the test harness: a harness test *asserts* the engine's output tree; the +console platform *renders* that same tree to text. Same platform abstraction — one +observes it, one draws it. + +What it means concretely: +- **Platform ops → a console-backed element tree.** The engine only ever calls platform + primitives: `dom-create-element`, `dom-append`, `dom-set-attr`, `dom-query` (by id, for + `sx-target`), `dom-remove-child`, `dom-parent`, `morph-children`, `dom-listen`, `fetch`, + `set-timeout`. Implement these against an in-memory tree of text nodes instead of the + browser DOM. The mock DOM in `web/harness-web.sx` is ~90% of this already. +- **Render = print the tree as text** (ANSI/box-drawing) — a `render-to-console` mode + alongside `render-to-html` / `render-to-dom` (see `spec/render.sx`'s mode table). The + results `