Skip to content

feat(t27f_graph): draw the T27F graph view from spec_graph_view.t27 - #9

Merged
gHashTag merged 1 commit into
masterfrom
t27f/graph-view
Oct 17, 2026
Merged

gHashTag merged 1 commit into
masterfrom
t27f/graph-view

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

What

A new tool, t27f_graph. It draws the T27F graph view (gHashTag/t27 specs/t27f/spec_graph_view.t27, landed by gHashTag/t27#10059, which closes gHashTag/t27#10034) as an SVG file and returns its path. This is the first host that draws spec_graph_view.t27. Before this, its header said "no host draws this yet".

Every box position, size, fill, stroke and dash, and every edge end, stroke and dash, comes from the spec's own fx_* functions, running inside wasm/t27f.wasm. Every constant comes from the generated wasm/spec_graph_view.mjs: backdrop, text colour, font size, and the kind and label names. The glue only writes SVG.

Files

Generated on the Railway lab (t27c at gHashTag/t27 950631580, zig 0.16.0):

  • wasm/spec_graph_view.zig: from t27c gen. It inlines the spec_graph and ui_plan items the view uses.
  • wasm/spec_graph_view.mjs: from t27c gen-js.
  • wasm/t27f.wasm: grew from 6095 to 16523 bytes. reel.zig and deck.zig regenerate byte-identical.

Hand-written foreign glue. It is disclosed here because the owner's rule allows only the thinnest I/O glue:

  • server.mjs, +27 lines: 1 import, 1 comment line, and the 25-line t27f_graph tool, which loops over nodes and edges and writes <rect>, <line> and <text>.
  • wasm/export.zig, +8/-2 lines: adds the third module and a seen() dedupe over every earlier module, where before only mods[0] was checked. It also raises the comptime eval branch quota, which the walk over three modules needs.

Docs: wasm/BUILD (provenance, rebuild steps, sha256 table) and README.md (one tool row).

Verification

  1. Fresh node server.mjs JSON-RPC tools/call t27f_graph:
    • fixture 0 gives 15 nodes, 16 edges, 1860x484;
    • fixture 1 gives 16 nodes, 17 edges.
  2. These numbers match the spec's host_entry_points_match_the_layout asserts:
    • node 14 at (1610, 408), size 200x36, label unknown, kind opaque;
    • node 0 is 44 high, stroke 0x1B7F3B;
    • fixture 1 node 15 fill 0xFFF1D0.
  3. Visual check in a browser:
    • one column per node kind;
    • the unknown node sits alone in the band below;
    • the suggested node is drawn orange and dashed.
  4. sha256 of every generated file was compared on the lab and on the Mac: equal.

Not claimed

  • Node names are strings in SpecGraph, which the wasm export cannot pass. So boxes are labelled by kind, index, inference label and source line span, not by name.
  • t27c has no graph exporter yet, so only the two spec_graph fixtures can be drawn.

🤖 Generated with Claude Code

New tool t27f_graph: every box and edge position, size and style comes from
specs/t27f/spec_graph_view.t27 (gHashTag/t27#10059) running in t27f.wasm.
Generated: spec_graph_view.zig/.mjs, t27f.wasm. Hand glue: server.mjs +27,
export.zig +8/-2 (third module, dedupe over all earlier modules, quota).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gHashTag
gHashTag merged commit e068b4e into master Oct 17, 2026
2 checks passed
@gHashTag
gHashTag deleted the t27f/graph-view branch October 17, 2026 18:36
@tri-claw

tri-claw Bot commented Oct 17, 2026

Copy link
Copy Markdown

Summary by t27-bees

This PR adds a new t27f_graph tool that renders the T27F graph view (spec_graph_view.t27) as SVG. The wasm module grows to include the spec's layout functions (fx_*), while the JS glue only writes SVG using constants from the generated spec_graph_view.mjs. Verification matches the spec's own layout asserts.

Worth a look

  • server.mjs:706 — Node rectangles use hardcoded rx="6" for rounded corners. The spec's fx_* functions don't expose a corner radius (no VIEW_RADIUS constant exists), so this styling diverges from "every box position, size, fill, stroke and dash comes from the spec."
  • server.mjs:697 — The nm() helper falls back to the raw numeric value if no constant matches (?? k). If a node kind/label/edge kind lacks a corresponding NODE_*, LABEL_*, or EDGE_* constant, the SVG label will show e.g. module 0 instead of module.
  • server.mjs:700–701 — stroke-dasharray="${d}" passes a single number (e.g. 6 from VIEW_LABEL_DASH). SVG dash arrays expect pairs (e.g. 6,6); a single number renders as a solid line in some viewers.
  • wasm/export.zig:8 — @setEvalBranchQuota(100000) raises the comptime branch limit to handle three modules. If the generated spec_graph_view.zig grows further, this quota may need another increase or the build will fail at comptime.
  • wasm/export.zig:12–16 — The new seen() dedupe checks all prior modules (k < i), not just mods[0]. If reel.zig and spec_graph_view.zig both declare a same-named pub fn, the reel version wins silently. No conflict exists today, but future additions could shadow unintentionally.

Read: 7 files, +1277 -11, the whole diff up to 60000 characters (the rest was not read). Head 81bf047. Model: openai-compatible/nvidia/nemotron-3-ultra-550b-a55b. Commands: @t27-bees review | summary | help | pause | resume. Free for every repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

spec(t27f): spec_graph_view -- the first T27F graph view, a deterministic layout of a spec graph

1 participant