Repository navigation
spec(t27f): spec_graph -- the core graph IR a .t27 spec becomes (Closes #10020) - #10029
Merged
Merged
Conversation
#10020) T27F is the visual spec of .t27 (trinity#1648, RFC trinity#1649). Its core is the graph a spec turns into before any view draws it; until now that IR did not exist anywhere. specs/t27f/spec_graph.t27 writes it as a spec: - GRAPH_IR_VERSION 1; node kinds (module, const, fn, test, invariant, bench, use, opaque), edge kinds (calls, uses, tested_by, constrains, data_flow) and labels (exact, derived, suggested, unknown) as u8 codes with name tables. - SpecGraph / GraphNode records: every node has a source span, every edge a source line. - validate_graph returns the first broken rule of 18 (version, path, capacity, module root, node kind/label/name, span order/outside/missing, edge kind, dangling, endpoint kinds, unknown node, label strength, line, duplicate); first_bad_node / first_bad_edge name the record. - Source mapping both ways: node_at(n) gives the span, node_at_line(l) the innermost node of a line. - TESTED_BY is DERIVED from CALLS (tested_by_matches_calls). - node_widget binds kind x label to a ui_plan catalog widget; SUGGESTED and UNKNOWN nodes get only a text block. - Fixture: specs/tutorial/08_modules_and_arrays.t27 read by hand (15 nodes, 16 edges), and a UI plan built from it that passes validate_plan. Not claimed: no t27c exporter, no renderer, no graph diff. SKILL.md "What exists" splits the core row into schema (this spec) and exporter (still missing); specs/OWNERS.md t27f row names the new module. Lab (Railway, master cc80a30): t27c test-report 13/13 pass, 0 FAIL, 0 BLOCKED, 0 vacuous, 5 invariants proved; t27b --check 13 PASS, 0 FAIL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
gHashTag
enabled auto-merge (squash)
October 17, 2026 17:06
Contributor
PR DashboardGenerated at: 2026-10-17 17:08:57 UTC
Summary
Seal Status
|
… the corpus (Closes #10020) The types ratchet flagged GraphNode as a new conflicted type name: specs/test_framework/graph_drift_detection.t27 already defines it. Lab re-run: t27c test-report 13/13, 0 vacuous; t27b --check 13 PASS. sha256 392fa5050ada47f8d801338bf89e99c024d1fcc47d619ee748733a180d9e788c. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
PR DashboardGenerated at: 2026-10-17 17:13:23 UTC
Summary
Seal Status
|
This was referenced Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10020
T27F is the visual spec of
.t27(epic gHashTag/trinity#1648, RFC gHashTag/trinity#1649; AST/IR audit gHashTag/trinity#1650). Its core is the graph a spec becomes before any view draws it. Until now that IR existed nowhere. This PR writes it as a spec, so that a future exporter has a contract to meet and a validator to pass.What
specs/t27f/spec_graph.t27decidesGRAPH_IR_VERSION = 1. Node kinds: module, const, fn, test, invariant, bench, use, opaque. Edge kinds: calls, uses, tested_by, constrains, data_flow. Labels: exact, derived, suggested, unknown. All are u8 codes with name tables. Allowed endpoint kinds per edge kind are node-kind bit masks, and an invariant rebuilds them from the named kinds.SpecGraphholds parallel arrays, asUiPlandoes. Every node has kind, label, name and span (line_start,line_end). Every edge has kind, endpoints, label and source line.SpecGraphNodeis the node-inspector record.validate_graphreturnsGRAPH_OKor the first rule broken, out of 18.first_bad_nodeandfirst_bad_edgename the record that broke it. Rules of note:node_at(n)gives the span.node_at_line(l)gives the innermost node of a line, and a comment line maps to the module.tested_by_matches_callschecks that TESTED_BY is exactly CALLS-from-a-check read backwards.node_widget(kind, label)picks a catalog widget ofspecs/t27f/ui_plan.t27. SUGGESTED and UNKNOWN nodes get only a text block.tutorial_08_plan()builds a UI plan from the fixture, and it passesvalidate_plan.specs/tutorial/08_modules_and_arrays.t27at 2f39502 (93 lines, sha256c291e925...8039a, unchanged on current master), read by hand into 15 nodes and 16 edges. Every top-level declaration has a node;std.testingis an UNKNOWN opaque node.Not claimed: t27c has no graph export, there is no renderer, and there is no graph diff. The SKILL.md "What exists" table now splits the core row into schema (this spec) and exporter (still missing).
Lab evidence (Railway, fresh clone at master
cc80a305d)t27c test-report specs/t27f/spec_graph.t27t27b test specs/t27f/spec_graph.t27 --check(qemu-aarch64)392fa5050ada47f8d801338bf89e99c024d1fcc47d619ee748733a180d9e788con both (1 of 1 match)Negative controls (file mutated on the lab, then restored and re-hashed):
EDGE_TO_KINDS[calls]changed from 4 to 6 (calls could end at a const): t27c refuses to compile, because the comptime invariantedge_masks_are_spelled_rightfails; t27b failsedge_endpoints_must_exist_and_fit.power_of_twospan changed from 66-68 to 66-73:source_mapping_goes_both_waysfails on both tools.One finding during the work: t27c inlines an imported module, so a top-level name defined in both files fails to compile. Here that was
validate_headerandERR_IR_VERSION; this spec usesvalidate_graph_headerandERR_GRAPH_VERSION.Files:
specs/t27f/spec_graph.t27(new, .t27 only, ASCII),.claude/skills/t27f/SKILL.md,specs/OWNERS.md(t27f row). Nothing ran on the Mac.🤖 Generated with Claude Code