Repository navigation
spec(port): port specs/port/trios/crates/trios-server/src/tools/trios_kg.t27 (Closes #9402) - #9867
Conversation
…_kg.t27 (Closes gHashTag#9402) Port gHashTag/trios:crates/trios-server/src/tools/trios_kg.rs (at 8b229e9489ee, 148 lines) as specs/port/trios/crates/trios-server/ src/tools/trios_kg.t27 - Roadmap Stage 6, goal gHashTag#4548, target t27c gen-rust. The trios-kg MCP tools' decisions are ported as pure functions and tested (8 tests, 8 pass, 0 vacuous, 26 runtime asserts, 100% function coverage): the four-name dispatch table, each tool's required-key gate with its defaults (entity_type and name for create_entity with the empty-object properties; source, target and edge_type for create_edge with the weight defaulting to 1.0; the query for kg_query with the limit defaulting to 10; the source for kg_traverse with max_depth defaulting to 1), the three-row cap on both mock enumerations, and the djb2-style hash stub - 5381, then hash = hash * 33 + byte per input byte - with the entity ids hashing the name alone and the edge ids covering all three parts. The JSON reading and building are the callers' plumbing. Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors, coverage 10/10, test-report 8/8 pass, 0 BLOCKED, gen 141 lines with 0 'not yet implemented', boundary exactly this one file, dupe_scan: all 8 introduced names unique across 2040 specs AND all 4 introduced struct names absent from the corpus type set (both checked before the commit), bare body scan adds no duplicate group (752/221 unchanged). Dmitrii Fedorov ([@dmitrii-f-t27](https://github.com/dmitrii-f-t27))
|
@gHashTag Please merge this PR into master via the golden chain — rights on gHashTag/t27 are read-only for me (403), so the merge itself needs your action. What this is: the #9402 port — What is verified:
CI (head e1cae96): required trio green — The 3 reds are the base-red trio, not this change: After the merge I will: verify the spec file live on the merge SHA, confirm #9402 auto-closed, and file the 14-step report. Dmitrii Fedorov (@dmitrii-f-t27) |
Summary
Port
gHashTag/trios:crates/trios-server/src/tools/trios_kg.rs(at8b229e9489ee, 148 lines) asspecs/port/trios/crates/trios-server/src/tools/trios_kg.t27— Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #9402.The original exposes Knowledge Graph operations over MCP with four tools behind a name dispatcher (R0 mock stub): kg_create_entity, kg_create_edge, kg_query and kg_traverse, with every mock id derived through a djb2-style hash stub.
Per the issue's rule ("Port the decision, not the plumbing"), all six listed functions are ported under their names as pure functions (no transports — the JSON reading and building are the callers' plumbing) with 8 tests (26 runtime asserts, 0 vacuous, 100% function coverage):
dispatch— the four-name routing table; anything else answers None (lines 9-17);kg_create_entity— the entity_type + name gate, the empty-object properties default, the id hashing the name alone (lines 20-48);kg_create_edge— the source + target + edge_type gate, the weight defaulting to 1.0, the id covering all three parts (lines 51-81);kg_query— the query gate, the limit defaulting to 10, the mock results capping at three Concept rows (lines 84-110);kg_traverse— the source gate, max_depth defaulting to 1, the mock paths capping at three related_to edges (lines 113-138);md5_compute— the hash stub: 5381, then hash = hash * 33 + byte per input byte, with known-value tests (lines 140-148).Verification (all run live from the worktree root, zig 0.16.0)
t27c parse: OK.t27c spec-status: IMPLEMENTED.t27c typecheck: 0 errors, 0 warnings.t27c coverage: 10/10 tested (100%) — no transports in this port.t27c test-report: 8 tests / 8 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes — the hash stub's known values (empty input 5381, single byte 5381·33 + 97), the edge hash covering all three parts, the dispatch table with the unknown-name rejection, every gate with its defaults, and the three-row caps at, below and at the boundary.t27c gen | grep -c 'not yet implemented': 0;gen | wc -l: 141 (> 12).grep -cE '^\s*(pub )?fn (dispatch|kg_create_entity|kg_create_edge|kg_query|kg_traverse|md5_compute)\(': 6.grep -cE '^\s*test\s+(["|[A-Za-z_])': 8 (≥ 6).git status --short— exactly this one file. The repo's lefthook pre-commit passed.dupe_scan: all 8 introduced names unique across 2040 specs, and — after the corpus-ratchet lesson — all 4 introduced struct names verified absent from the corpus type set by grep before the commit; the bare body scan adds no duplicate group (752 bodies / 221 groups on base, identical with this spec present).Dmitrii Fedorov (@dmitrii-f-t27)