Repository navigation
feat(op): the broker's client interface: Exec and Post by account, the console and events streams, commands by run id, and its test double - #1140
Merged
David-Noble-at-work merged 5 commits intoOct 23, 2026
Conversation
…ncel, Console and Events per run, Command and Status by run id (#1129) pkg/op/broker.go is 2.7's wire with no wire: the Broker interface, ExecRequest and PostRequest with the wire's JSON tags, Stdin as the word auto_confirm or {"bytes"}, Script, and Refusal, the named policy failure a caller errors.As. pkg/op/broker_console.go is the console stream's frame: narration, output and control as strings, one payload each, Data() rendering the SSE data field, and the three constructors. broker_test.go pins the request and frame JSON to 2.7 § Message reference and § The wire, in detail, byte for byte.
…, delivers what a test enqueues with the per-run seq (#1129) A non-test file, so every package above the interface tests against it without a broker. Deliver and Emit stamp the run's console and events seq and fan out as the control plane does, a full subscriber missing a frame rather than blocking; Refuse makes an account fail with its Refusal; SetStatus makes a run known to Command and Status. Its test proves the order, the seq per run and per stream, the cancel, the refusal and the unknown run.
…'s plan is complete (#1129)
2 tasks done
David-Noble-at-work
added a commit
that referenced
this pull request
Oct 23, 2026
… through one sudo -n, the platform and the shell provider through it (#1143) ## 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 - [x] `make check` passes: the quality gate and every test, on the committed tree - [x] 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
This was referenced Oct 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lane 1 of schedule #1127: the broker's client interface, 2.7's wire with no wire, fixed in iteration 1 and never moved.
op.Broker,pkg/op/broker.go:ExecandPostby account, answering with an exec id or the namedRefusala callererrors.As;Cancel;ConsoleandEventsas per-run subscriptions, a channel and a cancel each, oneseqper run per stream;CommandandStatusby run id.ExecRequestis 6.2 § 7's request with 2.7's routing, argv or script, never a string;Stdinis the wordauto_confirmor{"bytes"};PostRequestis the posted unitplan.logondispatches, ruled on the interface now.pkg/op/broker_console.go:narration,output,controlas strings, one payload each,Data()rendering the SSEdata:field.broker_test.gopins the request and frame JSON to 2.7 § Message reference and § The wire, in detail, byte for byte, so iteration 2's facade carries them unchanged.op.RecordingBroker,pkg/op/broker_double.go: the test double in a non-test file; records every call, delivers what a test enqueues with the per-runseq, refuses an account on request. Every package above the interface tests against it without a broker.docs/plans/task/1129-broker-client-interface.mdiscomplete. Nothing behind the interface is built here: that is The in-process stub: the caller's account through pkg/process, root through one sudo -n behind the interface #1130 and The console stream never drops a frame: a slow subscriber receives every one, late, and the child is never blocked on it #1131.Test plan
make checkpasses: the quality gate and every test, after the four lint findings its first run reported were fixedpkg/op: the JSON pins, validation, the refusal, the double's order, seq, cancel and dropResolves #1129.
Written with AI assistance.
Signed-off-by: David Noble [email protected]
Assisted-by: Claude Code
Time
Computed by the algorithm of noblefactor-ops#188 at merge.