Route the context operations in the in-process server - #77
Merged
Conversation
The /contexts paths were absent from the route table, so every `rossoctl
contexts` command against a cortex context fell through to the mux and 404'd.
They are placeholders like most of the table, but they have to be present:
before: GET .../contexts/team1/research -> 404 page not found
after: GET .../contexts/team1/research -> 500 {"detail":"UNIMPLEMENTED"}
The 404 was not merely the wrong code. contextListError maps a 404 to "this
Rosso server does not support context infrastructure", naming the API version
that introduced the resource — a true statement about an old server and a
misleading one about a local cortex, which sent the reader to check their
server's version rather than their current context. UNIMPLEMENTED is what every
other unimplemented cortex endpoint reports.
Covered by a new test in wire_test.go that drives the real apiclient methods
rather than requesting hand-written paths. That distinction is the point: a test
asking for "/contexts/ns/name" directly would keep passing if the client changed
the path it requests, which is how the table fell behind to begin with. Verified
to fail, naming the cause, with the four routes removed.
TestRouteTableMatchesOpenAPI's count goes from 44 to 48. Its comment warns that
raising the number is only correct alongside evidence the OpenAPI document grew,
so the exception is recorded rather than waved through: these four are the
context resource API from rossoctl/rossoctl#2392, which postdates that document,
and they are transcribed from the paths internal/apiclient requests. The new
test is what holds them to that.
Assisted by Claude.
Signed-off-by: Ed Snible <snible@us.ibm.com>
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
/contextspaths were missing from the route table, so everyrossoctl contextscommand against a cortex context fell through to the mux and 404'd. They are placeholders like most of the table, but they have to be present:All four operations are affected —
create,list,get,delete.The 404 was not just the wrong code.
contextListErrormaps a 404 to "this Rosso server does not support context infrastructure", naming the API version that introduced the resource — true of an old server, misleading for a local cortex, and it sends the reader to check their server version instead of their current context.Covered by a new test in
wire_test.gothat drives the realapiclientmethods rather than hand-written paths. That distinction is the point: a test requesting/contexts/ns/namedirectly would keep passing if the client changed the path it asks for, which is how the table fell behind. Verified to fail — naming the cause — with the four routes removed.TestRouteTableMatchesOpenAPI's count goes 44 → 48. Its comment warns that raising it is only correct with evidence the OpenAPI document grew, so the exception is recorded rather than waved through: these four are the context resource API from rossoctl/rossoctl#2392, which postdates that document, and they are listed from the pathsinternal/apiclientrequests.Assisted by Claude.