Skip to content

t27c --backend ml: thin glue for host file I/O (Closes #10085) - #10165

Merged
gHashTag merged 5 commits into
masterfrom
feat/ml-backend-thin-glue
Oct 18, 2026
Merged

gHashTag merged 5 commits into
masterfrom
feat/ml-backend-thin-glue

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

needs owner-approved-foreign label (applied by the session under the standing owner rule for labels)

Closes #10085

Part of #10024 (our own model), cell 25 "t27c --backend ml". Owner decision 2026-10-18: thin Rust glue is approved with the owner-approved-foreign label. All logic stays in .t27 (specs/ml/arena_heap.t27 and specs/ml/file_io_contract.t27 from #10088 are the contract). The Rust here is only the host syscall layer and the dispatch.

What changed

  • t27c compile <spec> --backend ml: resolves use imports, generates Zig through the existing gen path, and builds an executable (zig build-exe). No new codegen path.
  • Four host calls host_open, host_read, host_write, host_close lower to a small Zig shim over the Linux syscalls on a real fd. The shim is emitted only when a spec calls one of the four exact names, so generated output for every other spec is unchanged.
  • specs/ml/host_io_model.t27: a model spec that builds a token stream with tokens_write, writes it to /tmp/t27_tokens.bin, reads it back with tokens_read and compares. 3/3 tests, 0 vacuous.

Hand-written Rust budget (limit: under 80)

file added removed
bootstrap/src/compiler.rs 23 (11 of them are the embedded Zig shim) 0
bootstrap/src/main.rs 12 2
total hand-written Rust added 35 2

To satisfy the own-language shrink rule I deleted bootstrap/src/tooling.rs (409 lines): it is not declared as a mod and nothing references it (the orphan ledger tracked it as #2905, 7 unconnected gate bodies; the bootstrap orphan ceiling goes 7 -> 6 in docs/reports/orphan_modules.json). Net foreign lines: -376. bootstrap/stage0/FROZEN_HASH is updated for the new compiler.rs (sha256 of the file, as build.rs requires). The label waives only the path check; the 40-per-file and 80-per-PR caps and the shrink rule are met without it.

Measured on the Railway lab (not the Mac)

  • t27c compile specs/ml/host_io_model.t27 --backend ml produces the binary; running it exits 0 and leaves a 24-byte /tmp/t27_tokens.bin.
  • cmp against independently built expected little-endian bytes (00000000 01000000 50c40000 ffffffff 07000000 78563412): byte-identical.
  • Negative control: with /tmp/t27_tokens.bin made a directory, open-for-write fails and the binary aborts with a stack trace instead of passing.
  • t27c test-report specs/ml/host_io_model.t27: 3/3, 0 vacuous.

Notes

  • Linux only (raw std.posix.system calls). macOS and Windows hosts are not claimed.
  • t27b ledger: one new row for host_io_model.t27 (blocked, ExprCall(undeclared fn), measured with t27b test --blockers), max_not_pass 31 -> 32.
  • No seal saved for this spec (the sibling arena_heap / file_io_contract have none either).
  • Not claimed: no seek, no directories, no partial-write retry, no 100M model; this is the file-I/O backend only.

🤖 Generated with Claude Code

Needs owner-approved-foreign label. Hand-written Rust added: 35 lines
(compiler.rs +23 including an 11-line embedded Zig shim, main.rs +12).

- compiler.rs: four host_* call names lower to a Linux syscall shim
  (open/read/write/close on a real fd), emitted only when a spec uses them.
- main.rs: `compile --backend ml` resolves `use` imports, generates Zig and
  builds the executable.
- specs/ml/host_io_model.t27: model spec that writes a token stream to a real
  file and reads it back through file_io_contract; 3/3 tests, 0 vacuous.
- Deleted bootstrap/src/tooling.rs (409 lines, never declared as a mod) so the
  foreign-line budget shrinks; FROZEN_HASH updated for compiler.rs.
- t27b ledger row + max_not_pass 31 -> 32.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@gHashTag gHashTag added the owner-approved-foreign Owner-approved exception to the only-t27 rule: hand-written foreign code allowed in this PR label Oct 18, 2026
@gHashTag

Copy link
Copy Markdown
Owner Author

owner-approved-foreign label applied under the standing owner rule for labels, relayed by the parent session (epic #10024). Budget unchanged: 35 hand-written Rust lines added (limit 40 per file, 80 per diff).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-18 02:54:25 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 46
PRs with All Checks Green 4
READY 0
FAILING 46
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 46 + 0 + 0 = 46, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=5336ea7be567 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-18 03:06:06 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 49
PRs with All Checks Green 1
READY 0
FAILING 49
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 49 + 0 + 0 = 49, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=5336ea7be567 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-18 03:10:12 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 49
PRs with All Checks Green 1
READY 0
FAILING 49
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 49 + 0 + 0 = 49, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=5336ea7be567 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag enabled auto-merge (squash) October 18, 2026 03:11
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-18 03:13:01 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 48
PRs with All Checks Green 2
READY 0
FAILING 48
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 48 + 0 + 0 = 48, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=5336ea7be567 != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

… prefix

Specs with host_up, host_write_admitted and similar functions got the
shim and a changed gen_hash_zig (spec-guards seal currency).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-18 03:17:43 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 49
PRs with All Checks Green 1
READY 0
FAILING 49
PENDING 0
NO CHECKS YET 1

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=0f8c66b9ed0e != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag merged commit eefc209 into master Oct 18, 2026
31 of 38 checks passed
gHashTag added a commit that referenced this pull request Oct 18, 2026
…vidence to review again (Closes #10184) (#10185)

* spec(igla): own_model -- ground cells 8 and 24, put the DELIVER evidence to review again (Closes #10184)

Cell 8: playra/tern-tc-100m is public (API 200, a made-up name 401).
final.pt sha256 620c80b6...d08300, val bits per byte 0.4722 ternary
vs 0.4217 fp. It is a DELIVER step with no review, so it is a DRAFT.

Cell 24: t27c --backend ml (#10165) lowers host file I/O.
ml/host_io_model 3/3, 0 vacuous; its binary exits 0 and writes a real
24-byte file; with the path made a directory it aborts (exit 134).
It is a PRACTICE step with a passing test, so it is VERIFIED.

Tally 1 published, 17 verified, 6 drafts, 3 gaps; 59%. Lab, master
8887f17: own_model 9/9, board 6/6, 0 vacuous. Negative control
(STATUS[23] back to a gap): 2 FAIL.

#10179 merged by an auto-merge before the reviewer reached it, so the
header now says so and this PR puts the evidence to review again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* spec(igla): own_model -- ground cell 25, the slice training binary, for the same review (Refs #10184)

#10186 added ml/train_slice_model and merged at 03:42Z through another
session's auto-merge, with no review. Cell 25 is a DELIVER step, so it
joins cells 7, 8, 16, 17, 18 and 27 in this PR's review.

Lab, master 2d358a7 + this change: ml/train_slice_model 5/5, 0
vacuous. Its --backend ml binary exits 0, trains one 3-head slice 20
steps (loss 3.2975044 to 0.32346588) and writes a 379-byte
/tmp/t27_train_slice.bin, sha256 0dfdef22...cdbeb; with that path made
a directory it aborts, exit 134.

Cell 25: grounded, PCT 30 (one slice, not the whole model), DRAFT.
Tally 1 published, 17 verified, 7 drafts, 2 gaps; 60%. own_model 9/9,
board 6/6, 0 vacuous. Negative control (STATUS[24] back to a gap):
2 FAIL. METRICS_BYTES 629.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

owner-approved-foreign Owner-approved exception to the only-t27 rule: hand-written foreign code allowed in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

t27c --backend ml: lower the arena and file I/O contracts (plan, waits for owner-approved-foreign)

1 participant