feat(client): load scenarios from outside the repository - #520
Draft
claude[bot] wants to merge 1 commit into
Draft
claude[bot] wants to merge 1 commit into
claude[bot] wants to merge 1 commit into
Conversation
Add `--scenario-file <path>` to `client` and `list`. The file is a JavaScript module whose default export is one scenario or an array of them. They run through the same runner as the built-in scenarios, so a team can keep checks for its own product next to its code, or try a scenario out before proposing it here. Loaded scenarios stay apart from conformance: - with `--scenario-file`, only loaded scenarios can be selected, by `--scenario <name>` or as the `custom` suite; combining it with `--requirements`, a built-in suite or a built-in scenario is an error, raised before any file is imported - a name must be path-safe and must not match any built-in scenario - every run says which scenarios were loaded and that they are not part of MCP conformance; `list` and the suite summary mark them "(custom)" A loaded scenario is untyped, so the checks it returns are checked: a mistyped status fails the run instead of reading as a pass. `examples/scenarios/trace-id.mjs` is a complete example with a client that passes it, and the README documents the scenario object.
commit: |
felixweinberger
marked this pull request as ready for review
September 24, 2026 13:33
felixweinberger
marked this pull request as draft
September 24, 2026 13:33
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.
Requested by Felix Weinberger · Slack thread
Adds
--scenario-file <path>toclientandlist, so a team can run its own client scenarios through the runner without changing this repository.Why
Client scenarios can only be added by changing this repository. That is right for conformance, but it leaves no place for two things people want to do with the same runner:
registerScenario()already exists insrc/scenarios/index.tsand has no caller; this gives it one.Try it
After
npm install && npm run build:A scenario file is a JavaScript module whose default export is one scenario (
name,description,source,start(ctx),stop(),getChecks()) or an array of them. It imports nothing from the package, and the same file serves every spec version the scenario applies to.What is in it
src/scenarios/custom.ts: loads the modules, validates names and shapes, registers through the existingregisterScenario(), and applies the selection rules.src/index.ts: the option onclientandlist, thecustomsuite, the(custom)label.src/scenarios/index.ts:listScenariosForSpec()reads the registry, so loaded scenarios follow--spec-version.examples/scenarios/:trace-id.mjs, a complete commented scenario for a product-specific check, and a client that passes it.README.md: "Writing Your Own Scenarios".src/scenarios/custom.test.ts: 51 tests, including the example end to end throughrunConformanceTest.How it stays apart from conformance
--scenario-filenever yields official results: it cannot be combined with--requirements, a built-in suite or a built-in scenario, and that is checked before any file is imported.listand the suite summary mark them(custom).status: 'PASS'would otherwise print "Passed: 0/0 … OVERALL: PASSED".Behaviour without the option
Unchanged.
listoutput and the membership and order of every suite at every spec version are byte-identical tomain.Notes for review
everything-client.ts. A scenario that lives outside the suite needs a client that lives outside it too; the everything-client dispatches on built-in scenario names.import()), the same trust model as--command. The README says so.--scenariois given, also for a file with one scenario, so that exit codes do not depend on how many scenarios a file defines.start()that never settles ends the process with exit 0. The same is true of built-in scenarios, so the fix belongs in the runner and can be sent separately.servercommand and the hosted deployment, which keeps running exactly the scenarios in this repository.Open question
traceability --results <dir>reads everychecks.jsonunder a directory and counts check ids of the formsep-<number>-…. A custom run saved into the same directory would be counted. This PR only documents "use your own id prefix". Should loaded scenarios be refused such ids, or shouldchecks.jsoncarry a marker?How it was tested
npm run checkandnpm test: clean, 48 files, 673 tests.-o,--expected-failures,--spec-version, interactive mode, from another folder.🤖 Generated with Claude Code
https://claude.ai/code/session_01AvvJSiaDgQMo5FftSjEohh
Generated by Claude Code