Repository navigation
spec(port): port specs/port/trios/crates/trios-agents/src/lib.t27 (Closes #7218) - #9948
Conversation
…oses gHashTag#7218) Port gHashTag/trios:crates/trios-agents/src/lib.rs (at 8b229e9489ee, 145+ lines) as specs/port/trios/crates/trios-agents/src/lib.t27 - Roadmap Stage 6, goal gHashTag#4548, target t27c gen-rust. The agents client's decisions are ported as pure functions and tested (7 tests, 7 pass, 0 vacuous, 26 runtime asserts, 100% function coverage), including the original's own create-agent and status tests: the FNV-1a hash of simple_id - the offset basis 0xcbf29ce484222325, the prime 0x100000001b3, xor-then-multiply per byte - with the probe-verified exact values (the empty seed answers the basis; the single-byte seed answers basis^byte times the prime); create_agent id-ing the NAME alone (the description and type never entering the id); get_agent_status answering idle with no task; the monotonic counter's fetch-from-1 contract (the first answer 1, pre-increment-then-use) with the spawn plan - the task id differs from the agent id and across counters; and get_task_result answering completed with the empty JSON object. The language's integer multiply PANICS on overflow (measured: u64 and u32 alike in this suite's runtime), so the original's wrapping_mul is rebuilt honestly from 32-bit halves - low = aL*bL fits, the cross terms taken mod 2^32, the halves recombining in range - verified against the wrap contract ((2^64-1)*2 mod 2^64 = 2^64-2). The hex formatting of the id and the HTTP client are the callers' plumbing. Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors, coverage 14/14, test-report 7/7 pass, 0 BLOCKED, gen 128 lines with 0 'not yet implemented', boundary exactly this one file, dupe_scan: all 9 introduced names unique across 2040 specs AND the SpawnPlan struct verified absent from the corpus type set by grep 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 #7218 port — What is verified:
CI (head 237303f): 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 #7218 auto-closed, and file the 14-step report. Dmitrii Fedorov (@dmitrii-f-t27) |
Summary
Port
gHashTag/trios:crates/trios-agents/src/lib.rs(at8b229e9489ee, 145+ lines) asspecs/port/trios/crates/trios-agents/src/lib.t27— Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #7218.The original is the HTTP client and MCP proxy for zig-agents, providing AI agent orchestration.
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 HTTP client and the atomic counter are the callers' plumbing) with 7 tests (26 runtime asserts, 0 vacuous, 100% function coverage), including the original's own create-agent and status tests:
simple_id— the FNV-1a hash: the offset basis0xcbf29ce484222325, the prime0x100000001b3, xor-then-multiply per byte, the answer formatted as 16 hex chars (the formatting itself is the caller's plumbing); the probe-verified exact values — the empty seed answers the basis unchanged, the single-byte seed answersbasis ^ bytetimes the prime (original lines 81-88);create_agent— the agent id is the simple_id of the agent name alone; the description and the type ride along in the config but never enter the id (lines 91-94);get_agent_status— theidlestatus with no task (lines 97-103);spawn_agent_task— the task-id plan: the id differs from the agent id and across counters (the name joined to the monotonic counter, the join the caller's plumbing) (lines 106-109);monotonic_id— the fetch-from-1 contract: the first answer is 1, pre-increment-then-use (lines 112-116);get_task_result— thecompletedstatus with the empty JSON object (lines 119-125).The measured language finding this port carries
The language's integer multiply panics on overflow (measured in this suite's runtime: u64 and u32 alike —
0xffffffffffffffff * 2fails), so the original'swrapping_mulis not directly expressible. It is rebuilt honestly from 32-bit halves, every intermediate value below 2^64 —low = aL*bLfits, the cross terms are taken mod 2^32, and the halves recombine in range — verified against the wrap contract:(2^64−1)·2 mod 2^64 = 2^64−2, and small values multiply exactly.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: 14/14 tested (100%) — no transports in this port.t27c test-report: 7 tests / 7 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes — the FNV basis and single-byte exact values, the determinism and seed-sensitivity, the wrap contract with the exact products, the name-only id with its insensitivity to the description and type, the idle status, the counter contract with the spawn plan, and the completed result.t27c gen | grep -c 'not yet implemented': 0;gen | wc -l: 141 (> 12).grep -cE '^\s*(pub )?fn (simple_id|create_agent|get_agent_status|spawn_agent_task|monotonic_id|get_task_result)\(': 6.grep -cE '^\s*test\s+(["|[A-Za-z_])': 7 (≥ 6).git status --short— exactly this one file. The repo's lefthook pre-commit passed.dupe_scan: all 9 introduced names unique across 2040 specs, and theSpawnPlanstruct 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)