Repository navigation
test(mock): the mock must serve every base the plugin can produce - #142
Merged
Merged
Conversation
The coverage invariant behind every offline case. The request-shape and plugin suites assert what a request LOOKS like; if the plugin starts sending to a base this server does not serve, the answer is `404 no_route` — and a case that checks the headers rather than the status passes anyway. So a base the plugin knows and the mock does not is a hole in the whole suite, and it is silent. The bases come from the plugin's own constants (`OPENCODE_PLANE_API`, `LEGACY_PLANE_API`, `OPENCODE_FAMILY_API`, `DEFAULT_USAGE_BASE_URL`), so a vendor move that adds a family fails here rather than in a case that happens not to look. **The first version of this test proved nothing, and that is worth recording.** It fetched the constants AS GIVEN — absolute URLs on `opencode.ai` — so it left the machine, asked the real gateway, and passed while the mock went untouched. The suite is supposed to be offline; a probe that reaches the internet is both a lie and a flake. It now takes the plugin's PATH and the mock's origin. Planted a missing family root, it fails with the base named; the matrix suite catches the same hole from the other side (the exercised combinations), so the two together close it.
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.
The coverage invariant behind every offline case.
The request-shape and plugin suites assert what a request looks like. If the plugin starts sending to a base this server does not serve, the answer is
404 no_route— and a case that checks the headers rather than the status passes anyway. So a base the plugin knows and the mock does not is a hole in the whole suite, and it is silent.The bases come from the plugin's own constants —
OPENCODE_PLANE_API,LEGACY_PLANE_API,OPENCODE_FAMILY_API,DEFAULT_USAGE_BASE_URL— so a vendor move that adds a family fails here rather than in a case that happens not to look.The first version of this test proved nothing
Worth recording, because it is the exact failure this suite exists to catch: it fetched the constants as given — absolute URLs on
opencode.ai— so it left the machine, asked the real gateway, and passed while the mock went untouched.The mock suite is supposed to be offline; a probe that reaches the internet is both a lie and a flake. It now takes the plugin's path and the mock's origin.
Verification
Planted a missing family root:
…while the matrix suite (
protocol-compat.mock.ts) catches the same hole from the other side — the exercised plane × protocol × family combinations. The two together close it.vp check