Feature/chat - #29
Conversation
…nd data structures
…comprehensive tests for `ServeChat` and `ServeChatHealth`.
…penAPI specification
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Relocates the spec from api/ into runtime/schema/ alongside the existing JSON schema files, and renames it to mued_v0.1.0.yml to make the version explicit. Removes the api/ package; embed is now owned by runtime/schema. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously, responses that failed spec validation were only logged as warnings and forwarded anyway. Now a failed µEd response validation returns 500 to the caller. The legacy / route is unaffected — it has no matching path in the spec so the middleware passes it through unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Chat passes the µEd ChatRequest directly to workers (no legacy conversion). Adds checkMuEdVersion to reject unsupported API versions with 406, and sets the X-Api-Version response header on all /chat and /chat/health responses. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… methods directly, removing legacy `Handle` logic. Update tests accordingly.
…at and chat health handlers for consistent error handling.
…d corresponding test.
Refactor `MuEdChatRequest`, `MuEdChatResponse`, and related health structures for compatibility with µEd spec. Replace typed fields (`user`, `context`, etc.) with freeform maps to ensure full data fidelity. Simplify worker response validation and default handling. Add regression tests to verify unaltered data passthrough.
| mockRuntime.AssertExpectations(t) | ||
| } | ||
|
|
||
| func TestServeChat_Unauthorized(t *testing.T) { |
There was a problem hiding this comment.
does shimmy enforce a authorization header now?
There was a problem hiding this comment.
No shimmy doesn't enforce auth headers. This test just tests that they are accepted correctly if the header has been set.
There was a problem hiding this comment.
ok, can you confirm whether shimmy enforces x-api-version headers?
There was a problem hiding this comment.
They aren't required either. Shimmy uses the yaml of muEd to validate what is and what isn't required.
There was a problem hiding this comment.
then why is it mentioned in the PR on reflectiveChat ?
There was a problem hiding this comment.
I'll update those docs, I've just manually confirmed that the API is optional see
Line 52 in d1f6cf9
| return args.Get(0).(runtime.EvaluationResponse), args.Error(1) | ||
| } | ||
|
|
||
| func (m *mockRuntime) Chat(ctx context.Context, req runtime.ChatRequest) (runtime.ChatResponse, error) { |
There was a problem hiding this comment.
so to understand, only /evaluate has tests here
There was a problem hiding this comment.
We could add tests here, but would have to come up with a suitable method for mocking chat functions.
| CommandPreview Command = "preview" | ||
|
|
||
| // CommandEvaluate is the command to evaluate the response. | ||
| CommandEvaluate Command = "eval" |
There was a problem hiding this comment.
there is no CommandEvaluateHealth Command?
There was a problem hiding this comment.
It's CommandHealth, as that is the shared mueEd and legacy command.
There was a problem hiding this comment.
a comment clarifying that would be helpful thanks
There was a problem hiding this comment.
Renamed the command instead.
…h function naming and improved clarity
Problem
Migrate chat to use Shimmy
Solution
This is one part of a multi-repo upgrade.