Repository navigation
spec(port): port specs/port/trios/crates/trios-cli/src/db.t27 (Closes #9169) - #9905
Conversation
…HashTag#9169) Port gHashTag/trios:crates/trios-cli/src/db.rs (at 8b229e9489ee, 211 lines) as specs/port/trios/crates/trios-cli/src/db.t27 - Roadmap Stage 6, goal gHashTag#4548, target t27c gen-rust. The leaderboard SQLite storage's decisions are ported as pure functions and tested (9 tests, 9 pass, 0 vacuous, 26 runtime asserts, 100% function coverage): the fixed database path at .trinity/leaderboard.db with its parent directory created on demand, the nine-column entry shape with the id optional until insert answers it, the two indexes covering the two common queries (val_bpb for top, agent for by_agent), the eight value columns the insert writes, the best-N ordering of top (val_bpb ascending under the limit), the newest-first ordering of by_agent, the one-row-or- none optionality of by_exp_id, the exp_id key of delete, and the three aggregates of stats (count, MIN(val_bpb), AVG(val_bpb)). The SQLite connection and the SQL round-trips are the callers' plumbing. Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors, coverage 16/16, test-report 9/9 pass, 0 BLOCKED, gen 126 lines with 0 'not yet implemented', boundary exactly this one file, dupe_scan: all 10 introduced names unique across 2040 specs AND both struct names (OpenPlan, StatsShape) 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 #9169 port — What is verified:
CI (head c3aff26): 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 #9169 auto-closed, and file the 14-step report. Dmitrii Fedorov (@dmitrii-f-t27) |
Summary
Port
gHashTag/trios:crates/trios-cli/src/db.rs(at8b229e9489ee, 211 lines) asspecs/port/trios/crates/trios-cli/src/db.t27— Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #9169.The original is the SQLite leaderboard: local persistent storage for experiment results.
Per the issue's rule ("Port the decision, not the plumbing"), all eight listed functions are ported under their names as pure functions (no transports — the SQLite connection and the SQL round-trips are the callers' plumbing) with 9 tests (26 runtime asserts, 0 vacuous, 100% function coverage):
Leaderboard_path/Leaderboard_open— the fixed database path.trinity/leaderboard.db, the parent directory created on demand, the nine-column leaderboard table and its two indexes covering the two common queries (original lines 30-66, 208-211);Leaderboard_insert— the eight value columns written, answering the rowid (lines 69-87);Leaderboard_top— the best-N rows byval_bpbascending under the limit (lines 90-116);Leaderboard_by_agent— the agent's rows newest-timestamp-first (lines 119-145);Leaderboard_by_exp_id— the one row with that experiment id, or none (lines 148-172);Leaderboard_delete— removal by theexp_idkey (lines 175-178);Leaderboard_stats— the three aggregates: the count, the minimum and the averageval_bpb(lines 181-197).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: 16/16 tested (100%) — no transports in this port.t27c test-report: 9 tests / 9 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes.t27c gen | grep -c 'not yet implemented': 0;gen | wc -l: 126 (> 12).grep -cE '^\s*(pub )?fn (Leaderboard_open|Leaderboard_insert|Leaderboard_top|Leaderboard_by_agent|Leaderboard_by_exp_id|Leaderboard_delete|Leaderboard_stats|Leaderboard_path)\(': 8.grep -cE '^\s*test\s+(["|[A-Za-z_])': 9 (≥ 8).git status --short— exactly this one file. The repo's lefthook pre-commit passed.dupe_scan: all 10 introduced names unique across 2040 specs, and both 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)