Repository navigation
test(surface): anchor CLI and MCP tests on the built package - #126
Merged
Merged
Conversation
Tests that exercise the CLI or the MCP server now drive dist/cli.js as a separate process and the MCP server over stdio (ADR 0003), through tests/support/public-surface.ts. A ratchet fails when a test imports src/cli or src/mcp outside an exact, motivated allowlist, or when an allowlist entry goes stale. Refs #84 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
6 tasks done
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
Re-anchors the CLI and MCP tests on the public process boundary (ADR 0003: in 3.0.0 the public contract is CLI + MCP + schemas), so a later implementation of the same commands and tools can be swapped in under them.
tests/support/public-surface.ts:runPublicClirunsdist/cli.jsas a separate process, with the call shape of the in-processrunCli;connectPublicMcpstartsassertledger mcp [--root] [--allow-unsafe-execution]over stdio;listedInputSchemasreads the schemas published bytools/list, the public equivalent of the SDK-internaltoolInputSchemaJson.runCli/createAssertLedgerServer+InMemoryTransportto these helpers.qualification-mcpnow expects the mechanism digest of the built modules, since that is what the stdio server runs.tests/public-surface-anchoring.test.ts: ratchet that fails when a test importssrc/cliorsrc/mcp/outside an exact allowlist, and when an allowlist entry no longer imports one. Allowlist, each with its reason:bun-preflight-diagnostics: mocksnode:child_processinside the CLI process;developer-experience: injects setup/demo dependencies and checks source-run refusals (its other calls now go through the built CLI);naming-migration: pins thecreateTestForgeServeralias of the JS API removed in 3.0.0.Internal tests (engine, core, SDK) are unchanged.
Proof
Negative witnesses in a disposable worktree at
924d039(distbuilt there), each red onERR_ASSERTIONin the designated test, then green after restore:diagnostics.test.ts:import "../src/cli.js"addedtests reach the CLI and MCP server only…(unlisted)naming-migration.test.ts:src/mcpimport →dist/mcptests reach the CLI and MCP server only…(stale)dist/cli.jsonly: usage textassertledger→assertledgrsupports help and version aliases…dist/mcp/index.jsonly:assertledger_doctorregistered under another namekeeps runtime MCP opt-in…The last two mutate only the built package, with sources untouched: the migrated tests observe what ships.
pnpm check: 996 tests pass, 0 fail.7c623ae, candidate924d039, subject digestsha256:5f5f3a5e…, classifier categorytest_oracles(24 paths).Limits
integration.test.tskeeps one server root per connection: the CLI accepts a single--root.Test plan
pnpm checkRefs #84
🤖 Generated with Claude Code