Skip to content

spec(port): port specs/port/trios-railway/crates/trios-railway-core/src/hash.t27 (Closes #9762) - #9864

Merged
gHashTag merged 2 commits into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9762-railway-hash
Oct 17, 2026
Merged

gHashTag merged 2 commits into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9762-railway-hash

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Summary

Port gHashTag/trios-railway:crates/trios-railway-core/src/hash.rs (at 8b229e9489ee, 105 lines) as specs/port/trios-railway/crates/trios-railway-core/src/hash.t27 — Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #9762.

The original seals the R7 audit triplet RAIL=<verb> @ project=<8c> service=<8c> sha=<8c> ts=<rfc3339> over a SHA-256 of the verb, the project id, the optional service id and the token fingerprint — the digest is the first 8 bytes (16 hex chars), and the bearer token itself is never embedded, only its 7-char-class fingerprint (the first 4 bytes of the token's own SHA-256).

Per the issue's rule ("Port the decision, not the plumbing"), the three listed functions are ported under their names as plan-verdict pure functions (the SHA-256 and the clock are the caller's plumbing — no builtin here) with 6 tests (21 runtime asserts, 0 vacuous, 100% function coverage), including the original's own determinism, no-leak and format tests:

  • RailwayHash_seal — the content-addressed seal: the input order (verb, project, service only when present, then the fingerprint), the 8-byte digest, deterministic modulo time, never embedding the bearer token;
  • RailwayHash_triplet — the audit line's five-field layout with the absent service rendered as -;
  • token_fingerprint — the 4-byte, 8-hex-char audit-safe fingerprint that never leaks the token.

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: 11/11 tested (100%) — no transports in this port.
  • t27c test-report: 6 tests / 6 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes.
  • t27c gen | grep -c 'not yet implemented': 0; gen | wc -l: 115 (> 12).
  • grep -cE '^\s*(pub )?fn (RailwayHash_seal|RailwayHash_triplet|token_fingerprint)\(': 3. grep -cE '^\s*test\s+(["|[A-Za-z_])': 6 (≥ 3).
  • Boundary: git status --short — exactly this one file. The repo's lefthook pre-commit passed.
  • dupe_scan: all 13 introduced names unique across 2040 specs (checked 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)

…rc/hash.t27 (Closes gHashTag#9762)

Port gHashTag/trios-railway:crates/trios-railway-core/src/hash.rs
(at 8b229e9489ee, 105 lines) as specs/port/trios-railway/crates/
trios-railway-core/src/hash.t27 - Roadmap Stage 6, goal gHashTag#4548,
target t27c gen-rust.

The R7 triplet hash's decisions are ported as pure functions and
tested (6 tests, 6 pass, 0 vacuous, 21 runtime asserts, 100%
function coverage), including the original's own determinism,
no-leak and format tests: the seal's input order (verb, project,
service only when present, then the fingerprint), the 8-byte digest
(16 hex chars), the 4-byte token fingerprint (8 hex chars) with the
bearer token never embedded, the triplet's five-field layout with
the absent service as dash, and the 8-char id short form. The
SHA-256 and the clock are the caller's plumbing - no builtin here -
so the digest is carried as the plan's length and ordering rules,
deterministic modulo time as the original's own test pins.

Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors,
coverage 11/11, test-report 6/6 pass, 0 BLOCKED, gen 115 lines with
0 'not yet implemented', boundary exactly this one file, dupe_scan:
all 13 introduced names unique across 2040 specs (checked before
the commit), bare body scan adds no duplicate group (752/221
unchanged).

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

The corpus ratchet caught a type name gaining a second definition:
SealPlan already lives in specs/port/scripts/ci/rebuild_evidence.t27.
Renamed to RailwaySealPlan so the corpus's conflicted-type set stays
at its ledger of 110 names. All oracles re-verified after the
rename.

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 #9762 port — crates/trios-railway-core/src/hash.rs (gHashTag/trios-railway, at 8b229e9489ee, 105 lines) re-authored as specs/port/trios-railway/crates/trios-railway-core/src/hash.t27. One file, head 98d7a140e, Closes #9762.

What is verified:

  • t27c parse OK, spec-status IMPLEMENTED, typecheck 0 errors / 0 warnings, coverage 11/11 (100%) — no transports, t27c test-report 6 tests / 6 pass / 0 FAIL / 0 BLOCKED, 0 vacuous — the original's own determinism, no-leak and format tests carried over: the seal's input order (verb, project, service only when present, then the fingerprint), the 8-byte / 16-hex digest, the 4-byte / 8-hex audit-safe fingerprint that never embeds the bearer token, the triplet's five-field layout with the absent service as -, and the 8-char id short form.
  • gen → 115 lines, 0 not yet implemented; the 3 required names count exactly 3; 6 test blocks; boundary exactly the one file.
  • dupe_scan: all 13 introduced names unique across 2040 specs; the bare body scan adds no duplicate group (752/221 unchanged).
  • The t27b-native-run artifact of this head (commit 98d7a14, run 39012996008): hash.t27 row — reference pass, t27b pass, tests 6, invariants 0, asserts 22, blockers [], detail empty, reference_disagree: [].

CI (head 98d7a14): required trio green — validate, check-linked-issue, parse-ratchet — Check L1 TRACEABILITY green (both commits carry their Closes #9762 reference), and Corpus ratchet green after the fix below; 26 checks pass overall, incl. emit-bitexact, t27b-native-linux, t27b-native-macos.

A fix this PR carried: the first head tripped the Corpus ratchet — a type name gaining a second definition: my SealPlan struct already lived in specs/port/scripts/ci/rebuild_evidence.t27, moving the conflicted-type set off its ledger of 110. The second commit (carrying its own Closes #9762) renames it to RailwaySealPlan; the corpus ratchet is green on this head.

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 #9762 auto-closed, and file the 14-step report.

Dmitrii Fedorov (@dmitrii-f-t27)

This was referenced Oct 17, 2026
@gHashTag
gHashTag enabled auto-merge (squash) October 17, 2026 18:13
@gHashTag
gHashTag merged commit b9d394c 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-railway:crates/trios-railway-core/src/hash.rs (Rust, 3 functions) to specs/port/trios-railway/crates/trios-railway-core/src/hash.t27

2 participants