Skip to content

Port gHashTag/trios:crates/trios-crypto/src/lib.rs (Rust, 5 functions) to specs/port/trios/crates/trios-crypto/src/lib.t - #9259

Merged
gHashTag merged 2 commits into
masterfrom
queen-9215
Oct 12, 2026
Merged

gHashTag merged 2 commits into
masterfrom
queen-9215

Conversation

@gHashTag

Copy link
Copy Markdown
Collaborator

Closes #9215

Written by a bee on queen-9215 and published by tools/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.

1 file changed, 295 insertions(+)

🤖 Generated with Claude Code

Trinity Bee and others added 2 commits October 12, 2026 11:38
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>

@tri-claw tri-claw Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. ✅ File exists: test -f specs/port/trios/crates/trios-crypto/src/lib.t27 && echo present printed "present"
  2. ✅ All 5 functions present: grep found exactly 5 functions (FfiNotAvailable_fmt, sha256, double_sha256, mine_sha256d, depin_prove)
  3. ✅ Generated code complete: no "not yet implemented" found (0 occurrences)
  4. ✅ Generated code substantial: 189 lines generated (> 12 required)
  5. ✅ File parses correctly: t27c spec-status returned "IMPLEMENTED" (not "NOPARSE")
  6. ✅ Test coverage adequate: 14 test blocks found (> 5 required)
  7. ✅ No BLOCKED tests: t27c test-report found 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.t27 as 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:

  1. 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"
  2. Documented t27c subcommands exist: Documentation issue about dead tri commands

    • Discounted: Documentation issue, not code-related
  3. duplicate-bodies: Shows duplicate body growth

    • Discounted: Pre-existing issue on master
  4. pr-dashboard: GitHub API timeout (HTTP 504)

    • Discounted: Infrastructure issue
  5. coverage: Stale seals due to file changes after sealing

    • Discounted: Pre-existing issue on master
  6. spec-guards: Same stale seal issue as coverage

    • Discounted: Pre-existing issue on master
  7. cli-tri: Build warnings in tri CLI

    • Discounted: Pre-existing issue, not run on recent master commits
  8. 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

@tri-claw tri-claw Bot added the bee-reviewed A reviewer bee reviewed and verified this PR at its current head; the only merge signal (#5525) label Oct 12, 2026
@gHashTag
gHashTag enabled auto-merge (squash) October 12, 2026 15:58
@gHashTag
gHashTag merged commit d0ab160 into master Oct 12, 2026
24 of 32 checks passed
gHashTag added a commit that referenced this pull request Oct 12, 2026
…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>
@gHashTag
gHashTag deleted the queen-9215 branch October 26, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bee-reviewed A reviewer bee reviewed and verified this PR at its current head; the only merge signal (#5525)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port gHashTag/trios:crates/trios-crypto/src/lib.rs (Rust, 5 functions) to specs/port/trios/crates/trios-crypto/src/lib.t27

2 participants