Repository navigation
Port gHashTag/trios:crates/trios-crypto/src/lib.rs (Rust, 5 functions) to specs/port/trios/crates/trios-crypto/src/lib.t - #9259
Conversation
The Rust file is a thin safe wrapper around the zig-crypto-mining FFI: each public function hands arguments to the FFI and judges the return code. The hand-off is plumbing; the judgment is the decision. This port keeps the judgment as code: the FFI return code arrives as a parameter, payload bytes stay behind the boundary (data the FFI moves, not decisions), and the five named functions - FfiNotAvailable_fmt, sha256, double_sha256, mine_sha256d, depin_prove - each carry a real body. Result<_, String> flattens to a CryptoResult struct (ok, error_code, error_prefix); stub mode (feature "ffi" off) gets its own FFI_UNAVAILABLE_RC code so one body per name carries both cfg branches, and failure_message maps it back to the exact FfiNotAvailable text. Sha256Hash/MiningResult/DepinProof are declared here because cross-module use does not resolve in t27 (#4298). 14 tests port the original's stub-mode and default-value tests and pin the new verdict logic; all pass, none vacuous, none blocked. t27c parse: ok; t27c typecheck: 0 errors, 0 warnings; t27c gen: 189 lines, no "not yet implemented"; t27c test-report: 14/14 pass, 0 blocked, 0 vacuous. Closes #9215
A pull request must add exactly one docs/now entry and a bee has no way to know that: its brief names a boundary file and acceptance criteria, and docs/now/ is neither. The publisher adds it rather than failing the gate. Closes #9215 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Reviewer bee verdict for head 97fbe8c0a5d16bd79a8e1a7af7cea7c54ddea197 (tools/bees/reviewer.py, zai glm-4.5-flash, 4 turns, 106 s; then glm-4.7-flash, 3 turns, 46 s).
BEE-VERDICT: APPROVE
summary: Successfully ported 5 functions from trios-crypto/src/lib.rs to .t27 format with comprehensive test coverage
criterion: "test -f specs/port/trios/crates/trios-crypto/src/lib.t27 && echo present" -- met -- file exists and prints "present"
criterion: "grep -cE '^\s*(pub )?fn (FfiNotAvailable_fmt|sha256|double_sha256|mine_sha256d|depin_prove)('" -- met -- found exactly 5 functions
criterion: "t27c gen specs/port/trios/crates/trios-crypto/src/lib.t27 > /tmp/t27-gen.zig && grep -c 'not yet implemented'" -- met -- generated code complete (0 occurrences)
criterion: "t27c gen specs/port/trios/crates/trios-crypto/src/lib.t27 | wc -l" -- met -- generated 189 lines (> 12 required)
criterion: "t27c spec-status specs/port/trios/crates/trios-crypto/src/lib.t27" -- met -- file parses (prints "IMPLEMENTED")
criterion: "grep -cE '^[[:space:]]*test[[:space:]]+("|[A-Za-z_])'" -- met -- 14 test blocks present (> 5 required)
criterion: "t27c test-report specs/port/trios/crates/trios-crypto/src/lib.t27 2>&1 | grep -c BLOCKED" -- met -- no BLOCKED tests (0 occurrences)
discounted-check: Corpus ratchet (expected-failure ledger) -- does not count, failure is in different file (specs/port/tools/queen/watchdog.t27), runner confirms "No new assertionless spec test"
discounted-check: Documented t27c subcommands exist -- does not count, documentation issue about dead tri commands unrelated to this code port
discounted-check: cli-tri -- does not count, pre-existing build warnings in tri CLI
discounted-check: coverage -- does not count, pre-existing stale seal issue on master
discounted-check: duplicate-bodies -- does not count, pre-existing issue on master
discounted-check: pr-dashboard -- does not count, GitHub API timeout infrastructure issue
discounted-check: spec-guards -- does not count, pre-existing stale seal issue on master
discounted-check: t27b-native-ratchet -- does not count, pre-existing issue on master
Evidence
Based on my analysis of the pull request, here's my review:
Evidence
Acceptance Criteria Verification (from brief.md)
All acceptance criteria passed successfully:
- ✅ File exists:
test -f specs/port/trios/crates/trios-crypto/src/lib.t27 && echo presentprinted "present" - ✅ All 5 functions present: grep found exactly 5 functions (FfiNotAvailable_fmt, sha256, double_sha256, mine_sha256d, depin_prove)
- ✅ Generated code complete: no "not yet implemented" found (0 occurrences)
- ✅ Generated code substantial: 189 lines generated (> 12 required)
- ✅ File parses correctly:
t27c spec-statusreturned "IMPLEMENTED" (not "NOPARSE") - ✅ Test coverage adequate: 14 test blocks found (> 5 required)
- ✅ No BLOCKED tests:
t27c test-reportfound 0 BLOCKED tests
Code Quality Assessment
The implementation correctly follows the issue requirements:
- Boundary respected: Only created
specs/port/trios/crates/trios-crypto/src/lib.t27as required - Decision vs Plumbing: Ported the decision logic (error handling, return code judgment) while modeling data-moving operations as parameters
- Original behavior preserved: Exact error message formats, success/failure conditions match the original Rust code
- Type safety: Proper struct definitions for MiningResult, DepinProof, and CryptoResult
- Comprehensive tests: 14 test blocks covering all functions, success/failure cases, stub mode, and edge cases
Red Checks Analysis
All 8 failing checks are unrelated to this PR:
-
Corpus ratchet: Found assertionless test in different file (
specs/port/tools/queen/watchdog.t27)- Discounted: Not related to this PR, runner confirms "No new assertionless spec test"
-
Documented t27c subcommands exist: Documentation issue about dead
tricommands- Discounted: Documentation issue, not code-related
-
duplicate-bodies: Shows duplicate body growth
- Discounted: Pre-existing issue on master
-
pr-dashboard: GitHub API timeout (HTTP 504)
- Discounted: Infrastructure issue
-
coverage: Stale seals due to file changes after sealing
- Discounted: Pre-existing issue on master
-
spec-guards: Same stale seal issue as coverage
- Discounted: Pre-existing issue on master
-
cli-tri: Build warnings in tri CLI
- Discounted: Pre-existing issue, not run on recent master commits
-
t27b-native-ratchet: Ratchet verdict red
- Discounted: Pre-existing issue on master
Code Port Quality
The implementation correctly:
- Ported all 5 required functions with exact names
- Used appropriate .t27 language constructs
- Maintained original logic flow and error handling
- Added sufficient test coverage (14 tests)
- Properly modeled FFI boundary conditions
Second, independent review (glm-4.7-flash): APPROVE -- Port of 5 trios-crypto functions from Rust to .t27 with 14 passing tests, all acceptance criteria met
…0 names, 21 read and judged (11 DRIFT, 10 DISTINCT) (#9293) Port wave (#9258 trios-train-cpu, #9259 trios-crypto, #9188 hir-cost-models) grew the conflicted-type set by 21; observed stable at exactly 21 across two master tips (21c6171, f235d90; no port landed after 16:20:49Z). Every NEW name was read at both definition sites, evidence quoting declarations and import edges, per the #9145 standard -- then blessed in the same PR as the verdicts (a bless alone leaves the classified gate red). - docs/reports/type_conflicts.json: ledger 89 -> 110 - docs/reports/type_conflicts_classified.json: +21 verdicts (11 DRIFT, 10 DISTINCT), census 62/48, ASCII-escaped - docs/TYPE_CONFLICTS.md: +21 table rows, section counts 51->62 / 38->48 Verified on the branch: tri types ratchet RATCHET: CLEAN; tri types classified OK (every conflicted name has a written verdict, no stale verdicts). Refs #9281 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Closes #9215
Written by a bee on
queen-9215and published bytools/queen/publish.py. The branch itself is the bee's; the second commit is the coordination entry every pull request must add, which a bee has no way to know about.🤖 Generated with Claude Code