Repository navigation
Conversation
tony
force-pushed
the
tmux-arena
branch
2 times, most recently
from
September 8, 2026 01:07
b0180a6 to
10954d3
Compare
why: let the shared arena execute the quickstart without taking tmux daemon ownership. what: - validate the descriptor contract before connecting. - use the configured production endpoint and emit verified JSON evidence.
why: tmux.NewServer returns an error and this path discarded it, so a bad binary or socket path from the arena descriptor became a zero-value Server that failed later, somewhere else, without naming the cause. what: propagate it, naming the step.
why: only the quickstart could run under the documentation arena, and it held the whole contract inline. Every other example program could run against a server it started and nothing else, so the site could prove one of them. what: - `examples/internal/exampletest` gains `ArenaServer`, `ResolveArenaServer` and `EmitEvidence`. Binding the artifact, the server and whether the arena is active into one value removes the risk the inline version carried, where the artifact id had to be written twice and could disagree with itself. - Seven more example programs resolve their server through it, each with its own `go-<example>` artifact. - `fast-path` stopped the server unconditionally. Under the arena that server is lent, and an example must never stop one it did not create: `run` now takes a server it is given and removes only the session it made, while standalone runs stop a server only when this process is the one that started it. Its session is named for the example rather than `work`, which the harness also uses. - `workspace/example_test.go` is in another module and its `Example` functions own stdout for an exact `// Output:` match, so an evidence line cannot go there. A small local copy of the contract lives in `workspace/arena_test.go` instead, leaving the quoted examples byte-identical. - The proof that dispatch really goes through the arena's tmux binary, and that evidence fails without a challenge, moves into one test in the shared package rather than being repeated per example.
why: the example programs can borrow the arena's server, and the library's own documented `Example` functions could not. Each one started a server of its own, so the site could prove the programs and nothing about the snippets a reader actually meets in the API documentation. what: - `exampleServer` is the injection point: when the arena is active the Examples share the lent server, and when it is not they start their own exactly as before. - `killExampleServer` refuses to stop a lent server, reports the refusal by name, and instead removes only the sessions created since the run began — so 38 Examples can share one server without colliding on session names. - `TestMain` prints one evidence record per documented source once the Examples have run. Evidence cannot go through an `Example`: `go test` diffs that output against `// Output:` verbatim, and an evidence line is dynamic. - The record names the documented file rather than the function, because that is the unit the site quotes and the supervisor keys coverage by. - `TestStopExampleServerRefusesToStopALentServer` covers both directions; removing the guard fails the lent case and leaves the owned one passing. Ten Examples keep their own server: six never start a daemon at all, and one embeds its socket name in a shell command it runs inside tmux.
The modernize linter is right: the hand-written loop says nothing the standard library does not say more plainly, and the package already imports slices.
This branch has not been deployed
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
Added since this PR opened
Three commits. A fix first:
tmux.NewServerreturns an error and this branch discarded it, so a bad binary or socket path from the descriptor became a zero-value Server that failed later without naming the cause. Then the shared contract across the examples, and the documentedExamplefunctions running on a lent server — five that assert sole tenancy keep an owned server, each named with its reason.go vetclean,go test ./tmux/ok.Verified on the branch before pushing; gates listed in the commit messages.