Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
6d060fd
widgets: catalogue all 82 widget folders and the factory law -- 28 to…
claude Oct 19, 2026
9d714ff
widgets: gatle rules ported to .t27 -- 3 tests, 19 asserts; gen-js lo…
claude Oct 19, 2026
749e318
widgets: gallery rules as scalar .t27 -- 195 widgets, refusal verdict…
claude Oct 19, 2026
ddcabdf
widgets: the gallery reader as pure .t27 -- meta tags, entities, loca…
claude Oct 19, 2026
def022a
widgets: the logic stage runs through wasm -- gatle_rule built with g…
claude Oct 19, 2026
d4d8ccd
widgets: html_out -- the one HTML writer for native widget views, bou…
claude Oct 19, 2026
45af0f3
widgets: jtag-verdict is the first widget drawn natively -- words, ru…
claude Oct 19, 2026
b337706
widgets: json_scan reads data.json as bytes -- 284965 values of 143 w…
claude Oct 19, 2026
e83cc48
widgets: race-the-bee drawn natively from data.json -- 13014-byte was…
claude Oct 19, 2026
30e1744
widgets: lut-treemap logic ported to .t27 -- 9 tests, 14667449 compar…
claude Oct 19, 2026
f595a17
widgets: lut-explain logic ported to .t27 -- 9 tests, 1395124 compari…
claude Oct 19, 2026
e5117d0
widgets: rename the lut logic specs to underscores (Closes #10960)
claude Oct 19, 2026
f972b81
widgets: lut-depth logic ported to .t27 -- 7 tests, 12125 comparisons…
claude Oct 19, 2026
a8fe710
widgets: stat-card logic ported to .t27 -- 8 tests, 30827 comparisons…
claude Oct 19, 2026
76893bd
widgets: fasm-skyline logic ported to .t27 -- 7 tests, 384784 compari…
claude Oct 19, 2026
7fce749
widgets: catalog records five more logic files at PORT_LOGIC -- lut-d…
claude Oct 19, 2026
fceb821
Merge remote-tracking branch 'origin/master' into claude/t27-widgets-…
claude Oct 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions specs/t27f/widget_factory.t27
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
; spec the widget's .t27 (words, rules, tests, data sources). The hand column of the catalog is
; everything that is NOT this stage.
; logic the pure functions of the tool (parse, grade, layout), written in .t27 and generated to
; JavaScript by gen-ts. The spec's own test blocks are the fixed answers; a data builder no
; wasm (t27c gen-c, then zig cc --target=wasm32-wasi), not JavaScript: gen-js lowers no bodies. The spec's own test blocks are the fixed answers; a data builder no
; longer re-imports a hand file "so the page cannot drift from the spec".
; plan what is drawn, as a ui_plan.t27 plan: widget ids from an allowlist, no markup, no script.
; The primitives below extend ui_plan's catalog; they are not a second catalog.
Expand All @@ -30,7 +30,7 @@
; hand-written lines do not grow. (c) is the same rule as t27b's "net <= 0" and FROZEN_HASH ports.
; --
; Not claimed: no stage past `spec` exists as a program today. gatle's rules are ported to
; specs/widgets/gatle_rule.t27 and pass, but gen-js/gen-ts do not lower fn bodies, so no JS is generated; no plan is drawn by a renderer; t27b has not compiled a data builder. The primitives are
; specs/widgets/gatle_rule.t27 and built to wasm (0 mismatches over 866178 comparisons against rule.js), but the widget page still loads the hand-written rule.js: the trinity side is not changed; no plan is drawn by a renderer; t27b has not compiled a data builder. The primitives are
; PROPOSED from reading the 28 tools by name, not measured; wave 1 (catalog.t27, 11 tools of at
; most 700 hand lines) measures them and may rename or merge them.
; phi^2 + 1/phi^2 = 3 | TRINITY
Expand Down Expand Up @@ -83,14 +83,18 @@ pub const CLAW_TOOL_COUNT : u32 = 3;
pub const CLAW_TOOLS : [3]str = ["t27f_widgets", "t27f_widget_make", "t27f_widget_port_plan"];

/// MEASURED 2026-10-19 with t27c 0.5.2 on specs/widgets/gatle_rule.t27: gen-js and gen-ts emit
/// declarations (consts, structs) and skip every fn body -- "this backend lowers declarations, not
/// bodies". Until a body-lowering JS backend exists the logic stage writes a tested .t27 rule
/// (the single source) but cannot generate the JavaScript the page runs. Flip this when it can.
/// declarations only and skip every fn body (#10943), so the logic stage does not go through them.
/// It goes through the path the Queen's app.wasm already takes: `t27c gen-c`, then
/// `zig cc --target=wasm32-wasi -Oz -mexec-model=reactor` with one -Wl,--export per function.
/// gatle_rule.t27 became a 490-byte wasm; 866178 comparisons against the hand-written rule.js
/// (random and boundary inputs, every function) gave 0 mismatches. Byte slices and out buffers pass
/// through the module's linear memory; module-level `var` arrays and `[]u8` out parameters work.
pub const LOGIC_VIA_WASM : bool = true;
pub const GEN_JS_LOWERS_BODIES : bool = false;

/// The logic stage can produce its artefact only when the backend lowers bodies.
/// The logic stage can produce its artefact when some route lowers bodies.
pub fn logic_stage_ready() -> bool {
return GEN_JS_LOWERS_BODIES;
return LOGIC_VIA_WASM or GEN_JS_LOWERS_BODIES;
}

/// A stage is the next of a port stage only by one step.
Expand Down Expand Up @@ -224,8 +228,10 @@ test every_claw_tool_is_a_t27_name_the_service_mounts {
assert TRI_VERBS[0] == "widget list";
}

test the_logic_stage_waits_for_a_body_lowering_backend {
assert logic_stage_ready() == false;
test the_logic_stage_runs_through_wasm_while_gen_js_lowers_no_bodies {
assert logic_stage_ready();
assert LOGIC_VIA_WASM;
assert GEN_JS_LOWERS_BODIES == false;
}

test the_logic_stage_removes_exactly_the_logic_file {
Expand Down
31 changes: 23 additions & 8 deletions specs/widgets/catalog.t27
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@
; 3. 23 tools have a Node data builder (5572 lines) and 24 a Python card renderer (3415 lines).
; The card is a picture of the page; t27f draws pictures from specs already (SF_STILL).
; --
; Not claimed: that any hand column has been rewritten. Every tool is at PORT_WORDS today: its
; words live in its spec, its logic and drawing still live in JavaScript. A tool moves up only when
; its output is byte-identical to the hand version, and the factory spec states that gate.
; Stages reached, each with a differential against the hand-written version on the trinity side.
; PORT_LOGIC (the pure logic file is .t27, built to wasm, 0 mismatches against the JavaScript):
; gatle 866178 comparisons, lut-depth 12125, stat-card 30827, fasm-skyline 384784, lut-treemap
; 14667449, lut-explain 1395124.
; gatle is at PORT_LOGIC (specs/widgets/gatle_rule.t27: 866178 comparisons vs rule.js, 0 mismatches)
; and jtag-verdict and race-the-bee at PORT_DRAW (specs/widgets/jtag_verdict.t27: 3015 DOM
; comparisons vs tool.js, 0 mismatches; specs/widgets/race_the_bee.t27: 59, with 13 data variants, 0). Every other tool is at PORT_WORDS: its words live in its spec, its logic and drawing
; still live in JavaScript. A stage is reached on the t27 side first; the page in trinity keeps
; loading the hand-written file until that repo's migration PR deletes it. A tool moves up only when
; its output is identical to the hand version, and the factory spec states that gate.
; The Swift and React widgets are counted, not classified: they are another renderer's targets.
; ASCII only (L3), English only (LANG-EN).
; phi^2 + 1/phi^2 = 3 | TRINITY
Expand Down Expand Up @@ -83,7 +90,7 @@ pub const PORT_LOGIC : u8 = 2; // pure logic is .t27, generated to JS by gen-ts
pub const PORT_DRAW : u8 = 3; // the page is drawn by the trusted renderer from a plan
pub const PORT_SEALED : u8 = 4; // the spec seal keys the page, the data and the card
pub const PORT_STAGES : u8 = 5;
pub const TOOL_PORT : [28]u8 = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
pub const TOOL_PORT : [28]u8 = [1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 3, 2, 2, 2, 1, 1, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1];

; Port waves, by the hand lines a tool still carries (logic + draw + css + data + card).
; Wave 1 is the small tools, wave 3 the largest; a wave is a batch of port issues.
Expand Down Expand Up @@ -219,9 +226,17 @@ test the_waves_cover_every_tool_once {
assert hand_lines(12) == 1432;
}

test no_tool_has_left_the_words_stage_yet {
assert count_port(PORT_WORDS) == TOOL_COUNT;
assert count_port(PORT_LOGIC) == 0;
assert count_port(PORT_DRAW) == 0;
test eight_tools_have_left_the_words_stage_with_a_differential {
assert count_port(PORT_WORDS) == TOOL_COUNT - 8;
assert count_port(PORT_LOGIC) == 6;
assert count_port(PORT_DRAW) == 2;
assert count_port(PORT_SEALED) == 0;
assert TOOL_PORT[4] == PORT_LOGIC;
assert TOOL_PORT[7] == PORT_LOGIC;
assert TOOL_PORT[11] == PORT_LOGIC;
assert TOOL_PORT[12] == PORT_LOGIC;
assert TOOL_PORT[13] == PORT_LOGIC;
assert TOOL_PORT[19] == PORT_LOGIC;
assert TOOL_PORT[10] == PORT_DRAW;
assert TOOL_PORT[16] == PORT_DRAW;
}
Loading
Loading