Skip to content

feat(op): the in-process broker: the caller through pkg/process, root through one sudo -n, the platform and the shell provider through it - #1143

Merged
David-Noble-at-work merged 7 commits into
developfrom
feature/1130-in-process-stub
Oct 23, 2026
Merged

David-Noble-at-work merged 7 commits into
developfrom
feature/1130-in-process-stub

Conversation

@David-Noble-at-work

@David-Noble-at-work David-Noble-at-work commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Lane 2 of schedule #1127: the broker in the app's process, behind the interface #1140 landed.

  • op.InProcessBroker, pkg/op/broker_stub.go: a Broker that forks commands from the app's process. The caller's account runs through pkg/process, the direct path of 2.7, kept; root runs through one sudo -n, the only place the word now exists in pkg, retired in iteration 3; any other account is a named Refusal; Post is refused until the logon lane. Frames reach the console as the child speaks, through process.Runner.Stream, the relay with callbacks; Cancel kills the child; Track is the run registry Command and Status answer from. op.Run is the synchronous collect every provider needs. The runtime environment carries a Broker, the in-process one by default.
  • pkg/platform takes a CommandRunner through its spec; New hands it to every leaf and the service manager through the commander they embed. Seventy call sites say root or caller where a boolean said sudo; runCommand and helpers_unix.go are deleted; grep -rn sudo pkg/platform finds nothing. LocalRunner is the default for a platform built outside a runtime environment, the caller alone. op.PlatformRunner is the broker's adapter the environment builds its detected platform with.
  • The shell provider runs through the broker, a caller script of dialect sh, never a string to -c. The pkg and service providers change nothing and now run through the broker by way of their platform.
  • 6.2 § 10's interim row names the broker; 2.7's status companion says it landed. The plan docs/plans/task/1130-in-process-stub.md is active: Phase 6 after the merge is make install and a writ deploy from an unprivileged shell on Media-Server.

Two things to judge: every manager command now narrates its audit line, $ brew info foo, through the process runner, where the old runner printed nothing; and frames are live from this lane, which leaves #1131 the never-dropping spool and the event sink.

Test plan

  • make check passes: the quality gate and every test, on the committed tree
  • 25 new tests across pkg/op, pkg/platform and the shell provider: the three accounts, the script tier with an injection attempt that arrives as text, stdin, env and cwd, auto-confirm, dry-run, cancel, a launch failure, the adapter's fold into platform.Result, the leaves' accounts on refresh, the shell provider's request shape and refusal

For #1130, which closes when Phase 6 converges the machine.

Written with AI assistance.

Signed-off-by: David Noble [email protected]
Assisted-by: Claude Code

Time

Marker UTC Elapsed
opened (first commit) 2026-10-23T01:18:58Z —
submitted (PR opened) 2026-10-23T02:35:27Z 1.3 h after opened
merged 2026-10-23T03:53:49Z 1.3 h after submitted; 2.6 h in all

Computed by the algorithm of noblefactor-ops#188 at merge.

…r through pkg/process, root through one sudo -n; op.Run collects an exec (#1130)

pkg/op/broker_stub.go is the Broker that lives in the app's process and forks commands from it: the direct path of
2.7 for the caller's own account, kept; sudo -n in front of a root exec, the one place the word appears in pkg,
retired in iteration 3; any other account a named Refusal; Post refused until plan.logon. Frames reach the console
as the child speaks, through process.Runner.Stream, the relay with callbacks that keeps dry-run and the audit line.
op.Run subscribes, execs and collects until the control frame. The runtime environment carries a Broker, the
in-process one by default, a RecordingBroker through the spec in tests. The per-run stream moves to
broker_stream.go, shared with the double. The plan is approved, Phases 1 and 2 ticked, its two departures noted.
…ery call names its account, and runCommand's sudo is gone (#1130)

pkg/platform takes its runner through Spec.WithCommandRunner; New hands it to every leaf and the service manager
through the commander they embed, and defaults to LocalRunner, which stands for the caller alone. Seventy call sites
say AccountRoot or AccountCaller where a boolean said sudo; runCommand and helpers_unix.go are deleted, and
`grep -rn sudo pkg/platform` finds nothing. apt declares DEBIAN_FRONTEND=noninteractive once, where it belongs.
op.PlatformRunner is the adapter the runtime environment builds its detected platform with, after its broker
exists: each manager command is an exec through the broker, folded back into the platform's Result. The double
gains Complete, for a caller that waits and does not care what the command said. runWindowsCommand is named as
6.2 § 10's interim row until lane 8. The plan's Phase 3 box is ticked with its two departures and the one visible
change.
…ent's broker, a caller script of dialect sh (#1130)

Exec is op.Run of an ExecRequest: the body the command, written to a file and run by sh, never a string to -c; the
result folds back from the frames, stderr the narration lines. Two tests prove the request's shape through a
RecordingBroker and that a refusal is the error with no result. The plan's Phase 4 box is ticked.
…status says it landed; #1130's plan is active through the deploy (#1130)
…ss, and a killed child's abandoned pipes no longer hang the broker (#1130)

The race detector, which CI's test job runs and I had not, found Cancel reading child.Process while Start wrote it
on the run goroutine; each exec now has a context of its own, Cancel cancels it, and the child is the run
goroutine's alone. dash forks `sleep` where bash execs it, so a kill left an orphan holding stdout and Wait blocked
until it exited; WaitDelay bounds that wait, and the cancel test runs `sleep 30; true` so every sh forks. The
platform-wiring test skips on Windows, whose leaves reach the runner at lane 8.
@David-Noble-at-work
David-Noble-at-work merged commit 65ee707 into develop Oct 23, 2026
21 checks passed
@David-Noble-at-work
David-Noble-at-work deleted the feature/1130-in-process-stub branch October 23, 2026 03:53
David-Noble-at-work added a commit that referenced this pull request Oct 23, 2026
…erge (#1145)

## Summary

- **Plan 1130 is `complete`.** Phase 6 after #1143's merge: `make install`, `writ --version` reporting 65ee707; `writ deploy` from an unprivileged shell on Media-Server, 279 links, every one resolving. One status line and one tick, nothing else.

## Test plan

- [x] The quality gate passes; the file is Markdown

Resolves #1130.

Written with AI assistance.

Signed-off-by: David Noble <[email protected]>
Assisted-by: Claude Code
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.

1 participant