Skip to content

spec(port): port specs/port/trios-railway/crates/trios-railway-audit/src/event.t27 (Closes #9790) - #9817

Merged
gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9790-audit-event
Oct 17, 2026
Merged

gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-9790-audit-event

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Summary

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

The original is the AU-02 Neon audit writer: audit_event inserts one row into igla_race_trials and returns the id, never silently swallowing errors (R5), and AuditArtifact::new builds the stdout JSON artifact the hourly watchdog parses without re-querying Neon.

Per the issue's rule ("Port the decision, not the plumbing"), the two listed functions are ported under their names — audit_event as an undefined; transport no test calls, AuditArtifact_new as a tested pure constructor — and the decisions are ported with 6 tests (20 runtime asserts, 0 vacuous), including the original's own four artifact tests:

  • gate2_contributes — the Gate-2 contribution rule: this row contributes exactly when bpb < target_bpb, strictly (original line 88; the original's own true-below and false-above tests);
  • image_sha_kept_len — the sha kept-length rule: at most the first eight characters, a shorter sha kept whole (original line 85; the original's own truncate and short tests); the slicing itself is the caller's string plumbing;
  • the insert shape — four columns (seed, bpb, step, image_sha), returning the id (original lines 129-131);
  • the Neon env fallback order — RAILWAY_POSTGRES_URL preferred, the legacy NEON_DATABASE_URL accepted per L-NEON-RENAME (original lines 101-103).

The clock is a parameter the caller passes (the original stamps Utc::now inside).

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: 8/9 tested — only the audit_event transport untested, by design.
  • 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: 100 (> 12).
  • grep -cE '^\s*(pub )?fn (AuditArtifact_new|audit_event)\(': 2. grep -cE '^\s*test\s+(["|[A-Za-z_])': 6 (≥ 2).
  • Boundary: git status --short — exactly this one file. The repo's lefthook pre-commit passed.
  • dupe_scan: all 9 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)

…src/event.t27 (Closes gHashTag#9790)

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

The AU-02 audit writer's decisions are ported as pure functions and
tested (6 tests, 6 pass, 0 vacuous, 20 runtime asserts), including
the original's own four artifact tests: the Gate-2 contribution rule
(bpb strictly below target_bpb), the image_sha kept-length rule (at
most eight characters, a shorter sha kept whole), the insert shape
(four columns, returning the id), and the Neon env fallback order
(RAILWAY_POSTGRES_URL preferred, legacy NEON_DATABASE_URL accepted).
The clock is a caller parameter and the sha slicing is the caller's
string plumbing guided by the kept-length decision. The audit_event
transport keeps its name with an undefined; body no test calls.

Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors,
coverage 8/9 (only the transport untested, by design), test-report
6/6 pass, 0 BLOCKED, gen 100 lines with 0 'not yet implemented',
boundary exactly this one file, dupe_scan: all 9 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 #9790 port — crates/trios-railway-audit/src/event.rs (gHashTag/trios-railway, at 8b229e9489ee, 182 lines) re-authored as specs/port/trios-railway/crates/trios-railway-audit/src/event.t27. One file, head 34f72ee05, Closes #9790.

What is verified:

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

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

Dmitrii Fedorov (@dmitrii-f-t27)

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