Skip to content

spec(port): port specs/port/trios/crates/trios-claude/src/process.t27 (Closes #6384) - #9963

Merged
gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-6384-claude-process
Oct 17, 2026
Merged

gHashTag merged 1 commit into
gHashTag:masterfrom
dmitrii-f-t27:zcode-port-6384-claude-process

Conversation

@dmitrii-f-t27

Copy link
Copy Markdown
Contributor

Summary

Port gHashTag/trios:crates/trios-claude/src/process.rs (at 8b229e9e9489ee, 130 lines) as specs/port/trios/crates/trios-claude/src/process.t27 — Roadmap Stage 6 (goal #4548), target t27c gen-rust. Closes #6384.

The original is the Claude CLI process driver: it spawns and streams the claude CLI, runs one-shot prompts, and cleans up on drop.

Per the issue's rule ("Port the decision, not the plumbing"), all seven listed functions are ported under their names as pure functions (no transports — the process spawns, the stream pumps and the directory creation are the callers' plumbing) with 7 tests (33 runtime asserts, 0 vacuous, 100% function coverage):

  • ClaudeProcess_new — the childless start carrying only the config (original lines 22-27);
  • ClaudeProcess_spawn — the create-only-when-missing directory rule, both invocations' exact argument table (claude --print --model <model> --output-format json, the one-shot prompt appending <prompt> as the final argument), the both-streams piping with the receiver-dropped break, and the child becoming held (lines 29-79);
  • ClaudeProcess_send_prompt — the trimmed stdout on success, the process-failed error carrying stderr otherwise (lines 81-101);
  • ClaudeProcess_kill — terminating the held child clears it; with no child the kill is a no-op success (lines 103-109);
  • ClaudeProcess_is_running / ClaudeProcess_status — the held-child running verdict and its Running/Idle mapping (lines 111-121);
  • ClaudeProcess_drop — the last-resort cleanup: the drop start-kills only a held child (lines 124-129);
  • plus the stdout/stderr/exit event triple of the stream (lines 10-14).

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: 17/17 tested (100%) — no transports in this port.
  • t27c test-report: 7 tests / 7 pass / 0 FAIL / 0 BLOCKED, 0 vacuous passes — the childless start with its config, the event triple, the directory rule both ways, the full argument table for both invocations with the piping and break rules, the prompt verdict both ways, the kill-clears and running/status mapping, and the drop start-kill.
  • t27c gen | grep -c 'not yet implemented': 0; gen | wc -l: 159 (> 12).
  • grep -cE '^\s*(pub )?fn (ClaudeProcess_new|ClaudeProcess_spawn|ClaudeProcess_send_prompt|ClaudeProcess_kill|ClaudeProcess_is_running|ClaudeProcess_status|ClaudeProcess_drop)\(': 7. grep -cE '^\s*test\s+(["|[A-Za-z_])': 7 (≥ 7).
  • Boundary: git status --short — exactly this one file. The repo's lefthook pre-commit passed.
  • dupe_scan: all 10 introduced names unique across 2042 specs, and the ProcessState struct verified absent from the corpus type set by grep 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)

…Closes gHashTag#6384)

Port gHashTag/trios:crates/trios-claude/src/process.rs (at
8b229e9e9489ee, 130 lines) as specs/port/trios/crates/
trios-claude/src/process.t27 - Roadmap Stage 6, goal gHashTag#4548,
target t27c gen-rust.

The Claude CLI process driver's decisions are ported as pure
functions and tested (7 tests, 7 pass, 0 vacuous, 33 runtime
asserts, 100% function coverage): the childless start carrying only
the config, the stdout/stderr/exit event triple, the
create-only-when-missing directory rule, both invocations' exact
argument table (claude --print --model <model> --output-format
json, the one-shot prompt appending <prompt> as the final argument),
the both-streams piping with the receiver-dropped break, the prompt
verdict (trimmed stdout on success, the process-failed error
carrying stderr otherwise), the kill that clears the held child,
the running/status mapping (held = Running, none = Idle), and the
Drop start-kill of only a held child - the last-resort cleanup.
The process spawns, the stream pumps and the directory creation
are the callers' plumbing.

Verified: parse OK, spec-status IMPLEMENTED, typecheck 0 errors,
coverage 17/17, test-report 7/7 pass, 0 BLOCKED, gen 159 lines
with 0 'not yet implemented', boundary exactly this one file,
dupe_scan: all 10 introduced names unique across 2042 specs AND
the ProcessState struct verified absent from the corpus type set
by grep before the commit, 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 #6384 port — crates/trios-claude/src/process.rs (gHashTag/trios, at 8b229e9e9489ee, 130 lines) re-authored as specs/port/trios/crates/trios-claude/src/process.t27. One file, one commit, head a5f0e9fe5, Closes #6384.

What is verified:

  • t27c parse OK, spec-status IMPLEMENTED, typecheck 0 errors / 0 warnings, coverage 17/17 (100%) — no transports in this port, t27c test-report 7 tests / 7 pass / 0 FAIL / 0 BLOCKED, 0 vacuous — the childless start carrying only the config, the stdout/stderr/exit event triple, the create-only-when-missing directory rule, both invocations' exact argument table (claude --print --model <model> --output-format json, the one-shot prompt appending <prompt> as the final argument) with the both-streams piping and the receiver-dropped break, the prompt verdict (trimmed stdout on success, the process-failed error carrying stderr otherwise), the kill that clears the held child, the running/status mapping, and the Drop start-kill of only a held child.
  • gen → 159 lines, 0 not yet implemented; the 7 required names count exactly 7; 7 test blocks; boundary exactly the one file.
  • dupe_scan: all 10 introduced names unique across 2042 specs, and the ProcessState struct verified absent from the corpus type set by grep before the commit; the bare body scan adds no duplicate group (752/221 unchanged).
  • The t27b-native-run artifact of this head (commit a5f0e9f, run 39041585258): process.t27 row — reference pass, t27b pass, tests 7, invariants 0, asserts 33, blockers [], detail empty, reference_disagree: [].

CI (head a5f0e9f): required trio green — validate, check-linked-issue, parse-ratchet — Check L1 TRACEABILITY green and Corpus ratchet green; 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 #6384 auto-closed, and file the 14-step report.

Dmitrii Fedorov (@dmitrii-f-t27)

This was referenced Oct 17, 2026
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-claude/src/process.rs (Rust, 7 functions) to specs/port/trios/crates/trios-claude/src/process.t27

2 participants