Skip to content

spec(port): port specs/port/trios/crates/trios-rainbow-bridge/src/channel.t27 (Closes #9734) - #9815

Merged
gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9734-rainbow-channel
Oct 17, 2026
Merged

gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9734-rainbow-channel

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Summary

Port gHashTag/trios:crates/trios-rainbow-bridge/src/channel.rs (at 8b229e9489ee, 137 lines) as specs/port/trios/crates/trios-rainbow-bridge/src/channel.t27 — Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #9734.

The original declares exactly seven colour channels in ROY G BIV order (an eighth variant is forbidden — R7 + ONE SHOT §8, mirrored by the Coq seven_channels_total lemma) and the total function mapping each of the seven payload variants to its one legal channel — a match with no wildcard arm, total and injective on colour.

Per the issue's rule ("Port the decision, not the plumbing"), the one listed function is ported under its name as a tested pure decision, with 4 tests (61 runtime asserts, 0 vacuous, 100% function coverage):

  • channel_of_payload — the mapping: claim → red, heartbeat → orange, done → yellow, honey → green, state → blue, violation → indigo, victory → violet (original lines 100-110);
  • channel_count / channel_in_order — the canonical ROY G BIV order (Channel::ALL, original lines 33-46), asserted to be exactly seven — the original's own exactly_seven_channels test;
  • payload_kind_count / payload_kind_in_order — the seven payload kinds in the sample order of the original's own injectivity test;
  • the total-and-injective-on-colour property is proven by a double loop over all 49 ordered pairs, mirroring the original's channel_of_payload_is_total_and_injective_on_colour test;
  • the empty answer marks the unreachable eighth variant, mirroring the wildcard-free match.

The language does not compile enum values as arguments or literals, so both enums are modelled by their serde snake_case tags — the shape this series uses for command strings.

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: 5/5 tested (100%) — no transports in this port.
  • t27c test-report: 4 tests / 4 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes.
  • t27c gen | grep -c 'not yet implemented': 0; gen | wc -l: 131 (> 12).
  • grep -cE '^\s*(pub )?fn (channel_of_payload)\(': 1. grep -cE '^\s*test\s+(["|[A-Za-z_])': 4 (≥ 1).
  • Boundary: git status --short — exactly this one file. The repo's lefthook pre-commit passed.
  • dupe_scan: all 5 names unique across 2040 specs; the bare body scan adds no duplicate group (752 bodies / 221 groups on base, identical with this spec present).

Dmitrii Fedorov (@dmitrii-f-t27)

…nnel.t27 (Closes gHashTag#9734)

Port gHashTag/trios:crates/trios-rainbow-bridge/src/channel.rs (at
8b229e9489ee, 137 lines) as specs/port/trios/crates/trios-
rainbow-bridge/src/channel.t27 - Roadmap Stage 6, goal gHashTag#4548,
target t27c gen-rust.

The payload-to-channel total function is ported as pure functions
and tested (4 tests, 4 pass, 0 vacuous, 61 runtime asserts, 100%
function coverage): exactly seven channels in ROY G BIV order (the
original's own exactly_seven test), the per-kind mapping claim->red,
heartbeat->orange, done->yellow, honey->green, state->blue,
violation->indigo, victory->violet, and the total-and-injective-on-
colour property proven by the double loop over all 49 pairs - the
original's own injectivity test. The language does not compile enum
values as arguments or literals, so both enums are modelled by
their serde snake_case tags; the empty answer marks the unreachable
eighth variant, mirroring the original's wildcard-free match. No
transport exists in this port.

Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors,
coverage 5/5, test-report 4/4 pass, 0 BLOCKED, gen 131 lines with 0
'not yet implemented', boundary exactly this one file, dupe_scan:
all 5 names unique across 2040 specs, bare body scan adds no
duplicate group (752 bodies / 221 groups unchanged).

Dmitrii Fedorov ([@dmitrii-f-t27](https://github.com/dmitrii-f-t27))
@dmitrii-f-t27

Copy link
Copy Markdown
Contributor Author

@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 #9734 port — crates/trios-rainbow-bridge/src/channel.rs (gHashTag/trios, at 8b229e9489ee, 137 lines) re-authored as specs/port/trios/crates/trios-rainbow-bridge/src/channel.t27. One file, head be081ddcc, Closes #9734.

What is verified:

  • t27c parse OK, spec-status IMPLEMENTED, typecheck 0 errors / 0 warnings, coverage 5/5 (100%) — no transports, t27c test-report 4 tests / 4 pass / 0 FAIL / 0 BLOCKED, 0 vacuous (61 runtime asserts), including the original's own exactly_seven_channels test and the total-and-injective-on-colour property proven over all 49 ordered pairs.
  • gen → 131 lines, 0 not yet implemented; fn (channel_of_payload)( count 1; 4 test blocks; boundary exactly the one file.
  • dupe_scan: all 5 names unique across 2040 specs; bare body scan adds no duplicate group (752/221 unchanged).
  • The t27b-native-run artifact of this head (commit be081dd, run 38993399324): channel.t27 row — reference pass, t27b pass, tests 4, invariants 0, asserts 61, blockers [], detail empty, reference_disagree: [].

CI (head be081dd): required trio green — validate, check-linked-issue, parse-ratchet; 26 checks pass overall, incl. emit-bitexact, t27b-native-linux, t27b-native-macos.

The 3 reds are the base-red trio, not this change: cli-tri (the #3324 include_str!), duplicate-bodies (only the known base names), t27b-native-ratchet (the same verdict red the Queen's port PRs carry; this spec's own row is reference pass + t27b pass — the registration debt is the UNLISTED class).

After the merge I will: verify the spec file live on the merge SHA, confirm #9734 auto-closed, and file the 14-step report.

Dmitrii Fedorov (@dmitrii-f-t27)

@gHashTag
gHashTag merged commit 28f9439 into gHashTag:master Oct 17, 2026
26 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port gHashTag/trios:crates/trios-rainbow-bridge/src/channel.rs (Rust, 1 function) to specs/port/trios/crates/trios-rainbow-bridge/src/channel.t27

2 participants