Skip to content

spec(port): port specs/port/trios-railway/crates/trios-railway-experience/src/lib.t27 (Closes #9769) - #9821

Merged
gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9769-experience-lib
Oct 17, 2026
Merged

gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9769-experience-lib

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Summary

Port gHashTag/trios-railway:crates/trios-railway-experience/src/lib.rs (at 8b229e9489ee, 140+ lines) as specs/port/trios-railway/crates/trios-railway-experience/src/lib.t27 — Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #9769.

The original is the append-only writer for .trinity/experience/<YYYYMMDD>.trinity, enforcing L7 (the experience log) and L21 (context immutability): it only ever opens files in append mode and never seeks or truncates — a caller that would truncate has no method to call.

Per the issue's rule ("Port the decision, not the plumbing"), the two listed functions are ported under their names — append_line as an undefined; transport no test calls, ExperienceLine_from_hash as a tested pure constructor — and the decisions are ported with 5 tests (28 runtime asserts, 0 vacuous):

  • phi_step_count / phi_step_in_order / is_valid_phi_step — the eleven-step PHI LOOP catalogue (CLAIM…PUSH, mirroring NOW.json) and the membership gate: from_hash builds the line only for an allowed step, bailing otherwise — the original's own rejects_unknown_phi_step test;
  • ExperienceLine_from_hash — the built/invalid verdict with the carried fields and the absent evidence (skip_serializing_if becomes the absent flag); the clock (Utc::now) and the hash triplet arrive as parameters;
  • the file layout rules — the experience directory, the trios_railway_<YYYYMMDD>.trinity daily file (prefix, suffix, compact %Y%m%d date format), one JSON record per line with its trailing newline, and the append-only contract (create(true).append(true), never truncate — L21).

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/12 tested — only the append_line transport untested, by design.
  • t27c test-report: 5 tests / 5 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes.
  • t27c gen | grep -c 'not yet implemented': 0; gen | wc -l: 148 (> 12).
  • grep -cE '^\s*(pub )?fn (ExperienceLine_from_hash|append_line)\(': 2. grep -cE '^\s*test\s+(["|[A-Za-z_])': 5 (≥ 2).
  • Boundary: git status --short — exactly this one file. The repo's lefthook pre-commit passed.
  • dupe_scan: all 11 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)

…ence/src/lib.t27 (Closes gHashTag#9769)

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

The append-only experience writer's decisions are ported as pure
functions and tested (5 tests, 5 pass, 0 vacuous, 28 runtime
asserts), including the original's own rejects_unknown_phi_step
test: the eleven-step PHI LOOP catalogue and its membership gate
(from_hash builds the line only for an allowed step, bailing
otherwise), the line's carried fields with the absent evidence, and
the file layout rules - the experience directory, the
trios_railway_<YYYYMMDD>.trinity daily file, the compact date
format, the trailing newline per record, and the append-only
contract (create(true).append(true), never truncate - L21). The
clock and the hash triplet arrive as parameters; the append_line
transport keeps its name with an undefined; body no test calls.

Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors,
coverage 11/12 (only the transport untested, by design),
test-report 5/5 pass, 0 BLOCKED, gen 148 lines with 0 'not yet
implemented', boundary exactly this one file, dupe_scan: all 11
names unique across 2040 specs, bare body scan adds no duplicate
group (752/221 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 #9769 port — crates/trios-railway-experience/src/lib.rs (gHashTag/trios-railway, at 8b229e9489ee, 140+ lines) re-authored as specs/port/trios-railway/crates/trios-railway-experience/src/lib.t27. One file, head 01dfca17d, Closes #9769.

What is verified:

  • t27c parse OK, spec-status IMPLEMENTED, typecheck 0 errors / 0 warnings, coverage 11/12 (only the append_line transport untested, by design), t27c test-report 5 tests / 5 pass / 0 FAIL / 0 BLOCKED, 0 vacuous — including the original's own rejects_unknown_phi_step test.
  • gen → 148 lines, 0 not yet implemented; the 2 required names count exactly 2; 5 test blocks; boundary exactly the one file.
  • dupe_scan: all 11 names unique across 2040 specs; bare body scan adds no duplicate group (752/221 unchanged).
  • The t27b-native-run artifact of this head (commit 01dfca1, run 38996181282): lib.t27 row — reference pass, t27b pass, tests 5, invariants 0, asserts 28, blockers [], detail empty, reference_disagree: [].

CI (head 01dfca1): 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 #9769 auto-closed, and file the 14-step report.

Dmitrii Fedorov (@dmitrii-f-t27)

@gHashTag
gHashTag merged commit 3c172c7 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

2 participants