Repository navigation
spec(t27f): add the spec -> graph IR exporter in t27 (Closes #10162) - #10173
Merged
Merged
Conversation
export_graph(path, src) scans spec source bytes into a SpecGraph: one node per top-level declaration, brace-matched spans, EXACT CALLS/USES/CONSTRAINS edges, refusal past MAX_NODES/MAX_EDGES. Tutorial 08 matches the hand-read fixture on all 14 declaration nodes and all 9 EXACT edges; the fixture-only std.testing node and 7 DERIVED edges are not emitted. Refs gHashTag/trinity#1648, #1649. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
gHashTag
enabled auto-merge (squash)
October 18, 2026 02:47
Contributor
This was referenced Oct 18, 2026
This was referenced Oct 18, 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 #10162
Epic gHashTag/trinity#1648, RFC gHashTag/trinity#1649.
What this adds
specs/t27f/spec_graph_export.t27(modulet27f_spec_graph_export): the T27F exporter, written in t27.export_graph(path, src)is a deterministic byte scanner from spec source to aSpecGraph;export_verdictisvalidate_graphof the result. It reuses spec_graph's builders, codes andvalidate_graphthroughuseand restates none of them.pub). module/use/const/fn/test/invariant/bench map to their NODE_* kind. struct/enum/var/spec/endmodule are OPAQUE + EXACT. Anything else, or a keyword with no readable name, is OPAQUE + UNKNOWN.//comments and;comment lines are skipped. A brace-less declaration ends at its;line or its last indented continuation line.(), USES a declared const or imported name, invariant CONSTRAINS a const.validate_graphanswers ERR_TOO_MANY_NODES / ERR_TOO_MANY_EDGES; nothing is truncated.Docs:
.claude/skills/t27f/SKILL.md(exporter row with its limits, graph view row now "drawn by the MCP toolt27f_graph(gHashTag/t27-mcp#9)", the "Show a spec" and "does not claim" sections),specs/OWNERS.md(t27f/row).Verified (Railway lab only, nothing built or run on the Mac)
t27c test-report specs/t27f/spec_graph_export.t27: 20 tests, 20 pass, 0 fail, 0 vacuous of 20.t27b test specs/t27f/spec_graph_export.t27 --check(qemu-aarch64): 20 passed, 0 failed, 259 runtime asserts.;lines and an escaped quote, brace-less continuation, block-form module, edge direction rules, dedupe, both overflow boundaries (20 vs 21 nodes, 24 vs 27 edges), empty source and empty path.specs/tutorial/08_modules_and_arrays.t27(sha256 c291e925d9dabef8b72b5a64aef153a2126c0b0b43d67bc08b1b2d7eaa98039a, checked locally; the file's last change is 2f39502).Tutorial 08: exporter vs the hand-read
tutorial_08_graph()Not an exact match. Compared field by field, the differences are:
std.testing, OPAQUE + UNKNOWN, lines 79..89) is a region inferred from call targets, not a declaration, so the scanner does not produce it.The test
tutorial_08_exports_the_fixture_exactly_except_what_is_derivedasserts exactly this boundary, with negative controls (a moved span, a moved edge line).Not claimed
useresolution, no block comments.[]const u8slice, not the[65536]u8plus a length sketched in the task: t27 slices carry their length, and the probe on both compilers accepted it.spec_graph_view.t27has noview_fxcase for an exported graph./dataon the lab was 100% full, so the lab run used/root/w-sgxinstead of/data/w-sgx.0 lines of non-t27 code; ASCII only under specs/.
🤖 Generated with Claude Code