Repository navigation
Show the MCP replay on port builds and accept Ruby's indented require - #246
Merged
Merged
Conversation
why: libtmux-ruby's own docs build failed with "core-capabilities: ruby/send-keys has no import lines" while rendering /demo/home. Ruby master's examples/api/capture.rb and examples/api/new_window.rb put `require "libtmux"` inside the begin block, two spaces in, after the `# docs:begin main` marker, so README excerpts of that region carry the require. The Ruby completeness rule only accepted `require` at column 0. Docs CI stayed green because it reads the revision-bound example cache, where both files still had the require at column 0; the port's build reads the live files and fails. what: - Ruby `imports` rule matches `require` after leading spaces or tabs. A commented require still does not count, `require_relative` and `Example.` still trip the `local` rule, and a program with no require still reports "has no import lines". - Add examples/api/capture.rb as a fixture, taken from libtmux/libtmux-ruby master 20744401ee9f (git blob f070fac, last changed by 2156612), and test that the begin-wrapped program has no problems, that dropping its require reports the missing imports, that a helper stays refused, and that the entry rule still matches the wrapped shape. - Go, Rust and TypeScript rules are unchanged. Go and TypeScript imports are top-level by spec and every formatter leaves them at column 0. Rust `use` inside `fn main` is legal but unusual, and the Rust showcase files on libtmux-rs master all keep it at column 0. The example cache is not refreshed: the generator reads the revision the Ruby API model pins (9b1545562), so a cache refresh to master needs a model revision bump and a Ruby checkout, not this fix.
… check why: The host-name check matches a one-letter user name such as `d` as a token. A backslash was not a word boundary for it, so the `\d` in a tool's input pattern (`^%\d+$`) read as the name and refused a file that only holds public schema text. The next change stores those schemas in each transcript, and the recorder and the committed-recording test both run this check. what: - Treat a backslash before a name as an escape, not a token boundary, for both leaks() and sanitize(). - Test that a pattern's escape is neither reported nor rewritten, and that a name beside it still is.
why: A port's own docs build runs gen-mcp-protocol.mjs --source-bound, which regenerates the tools/list snapshot at the port's head. The snapshot's revision is then that commit and never the one a recording was made at, and buildShowcase required the two to be equal. Every port built that way printed "Requests only" for the worked example; only Python, whose MCP product has its own pinned checkout, kept its replay. Docs CI and local previews read the committed snapshot, whose revision equals the recording's, so no test saw it. A recording stays true while the calls it replays are the same contract on the server being documented, whatever the commit. what: - Store the input and output schemas of each tool a transcript calls, taken from the snapshot the recorder already verifies against the checkout; the recorder's --check compares them too. - Backfill the committed transcripts from the committed snapshot at each transcript's own revision. The diff only adds the key. - Show a recording when its steps equal the example's, none failed, and every tool it called is still advertised with the recorded schemas, compared without regard to key order. A changed or missing schema, a missing tool, or a transcript without schemas gives requests only. - Keep naming the revision the results were recorded at, and when the page documents a later one, say the tools take and return the same schemas there. - Test a snapshot rewritten at another revision the way build-site.sh does for each port, a changed input or output schema for each recorded tool, a tool that is gone, and the page's provenance line. Replace the test that required equal revisions with one that checks the stored schemas against the snapshot.
why: The earlier exemption for a backslash before a name let `C:\Users\d\AppData`, `\\wsl-box\share\file` and `USERPROFILE=C:\Users\tony` through leaks() and sanitize(), so a Windows host's user or machine name could reach a committed recording. It was added only because `contracts` (JSON Schema patterns such as `^%\d+$`) now sits inside the scanned text. The contracts are copied from the committed tools/list snapshot and never carry session data, so the host check has no reason to read them. what: - Restore the token boundary as it was before the exemption. - Add withoutContracts() and scan the transcript without that key, in the recorder and in the test over the committed recordings. - Test that the three constructed names are found and rewritten again, and that a contract pattern with `\d` does not trip the scan while a name in a recorded step still does. - The tests fail with the exemption restored, and fail when contracts are scanned.
why: The page said a recorded tool takes and returns "the same schemas" at the documented revision, which reads as if the shown values are what that server returns. Equal schemas fix the shape of a call and its result, not the values. The earlier wording also called the documented revision "later", and a tag or a pinned build can document an older one; a snapshot's revision does not say which is newer. Two gaps let a recording stand when it should not. Ruby's recorded tmux_capabilities result lists the tools the server enabled, and a snapshot that advertises another set still passed on the two called tools' schemas. A tool recorded without an output schema compared equal to one without, so "same schemas" claimed a return shape nobody had checked. what: - State the provenance plainly: the results were recorded at one revision, the page documents a different one, the calls have the same input and output schemas there, and the values may differ. Name no direction. - Say "input schemas" alone when a called tool has no recorded output schema (Recording.outputsChecked, from statesOutputs()). - Show no recording when a result lists tools and the list is not the set the snapshot advertises, in either direction. A list is any array of strings, at any depth, that names every tool the session called, so no key name such as enabled_tools is assumed. - Test the Ruby additions and removals, a list on another port under a different key, lists that must be ignored, direction-neutral wording for a documented revision that looks newer and one that looks older, and the input-only claim. Seven of the new tests fail on the previous commit and pass here; the committed recordings of the other ports name no tool in their results and are unaffected.
tony
marked this pull request as ready for review
November 3, 2026 04:57
tony
temporarily deployed
to
docs-preview-cleanup
November 3, 2026 05:05 — with
GitHub Actions
Inactive
This branch was previously 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.
Why
Two features from #232 pass every docs-side check but break in a port's own docs build. That build regenerates its data at the port's head (
gen-mcp-protocol.mjs --source-bound,gen-example-sources.mjsinbuild-site.sh), while docs CI and previews read the committed copies.buildShowcaseaccepted a recording only whentranscript.revision === snapshot.revision. A port build's snapshot is always at the port head, so that never held.core-capabilities: ruby/send-keys has no import lines.programProblemsrequiredrequireat column 0, and Ruby master'sexamples/api/capture.rbindents it insidebeginso README excerpts carry it.What changes
contracts(mcp-contract.ts). The nine committed transcripts are backfilled from the committed snapshot at their own revision. A changed or missing schema, a missing tool, or a transcript withoutcontractsstill falls back to requests-only. The provenance line still names the revision the results were recorded at, and says when the page documents a different revision.require(/^[ \t]*require ["']/m). A commented require andrequire_relativeare still refused.^%\d+$held the user named).Verification
build-site.shdoes. It fails onmainfor all nine recorded ports and passes here. Its controls cover a changed input or output schema, a missing tool, nocontracts, an unrelated tool change and key order.capture.rb(20744401e) passes the completeness rule; three cases fail without the fix.core-capabilities,mcp-showcase,mcp-transcript-checks,mcp-replay,port-landing-page,product-copy). No build was run here; this PR's CI is the first full run.Schema comparison is strict, descriptions included, so a reworded parameter description at a port's head sends that port back to requests-only until it is re-recorded.
The same three commits are on #245, which drops them when it rebases.
Review follow-ups
An independent review approved this PR. Its findings 1, 2, 3 and 5 are fixed in two commits on top of the first three; the rest are listed below.
documentedRevisiondoc comment and the recorder header use the same neutral wording.tmux_capabilitiesresult listsdata.enabled_tools, and a snapshot advertising another set still passed on the two called tools' schemas. A recording now shows only when every list of strings in a result that names all the tools the session called is the set the snapshot advertises, in either direction; otherwise the page falls back to requests only. The check does not assume the key name, and Ruby is the only committed recording whose results name any tool. A server that lists only a subset on purpose would fall back to requests only until someone looks at it.C:\Users\d\AppData,\\wsl-box\share\fileandUSERPROFILE=C:\Users\tonythroughleaks()andsanitize(). It is reverted. The recorder and the test over the committed recordings scan the transcript without itscontractskey, because those schemas are copied from the committedtools/listsnapshot and never carry session data (^%\d+$is the pattern that needed the exemption).Verification
mcp-showcasefailed (the provenance wording for a documented revision that looks newer and one that looks older, the input-only claim,outputsChecked, Ruby with a tool removed, Ruby with a tool added, and a list under another key). Against the restored exemption, the three constructed leaks fail; withcontractsscanned, the pattern case and the committed-recordings test fail.core-capabilities,mcp-showcase,mcp-transcript-checks,mcp-replay,port-landing-page,product-copy.oxlintis clean on the touched sources, andtscreports nothing in them (it reports unrelated errors elsewhere in this checkout).scripts/gen-mcp-transcript.mjsitself, which needs each port's checkout. The recorder reaches the scan throughwithoutContracts, which the tests cover.Left for later