Skip to content

Feature/chat - #29

Merged
m-messer merged 21 commits into
mainfrom
feature/chat
Aug 5, 2026
Merged

Feature/chat#29
m-messer merged 21 commits into
mainfrom
feature/chat

Conversation

@m-messer

@m-messer m-messer commented Aug 5, 2026

Copy link
Copy Markdown
Member

Problem

Migrate chat to use Shimmy

Solution
This is one part of a multi-repo upgrade.

  • Added muEd-based functionality for chat within shimmy
  • Added tests

m-messer and others added 20 commits May 14, 2026 14:26
…comprehensive tests for `ServeChat` and `ServeChatHealth`.
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.
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.
Comment thread handler/chat_test.go
mockRuntime.AssertExpectations(t)
}

func TestServeChat_Unauthorized(t *testing.T) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does shimmy enforce a authorization header now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No shimmy doesn't enforce auth headers. This test just tests that they are accepted correctly if the header has been set.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, can you confirm whether shimmy enforces x-api-version headers?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They aren't required either. Shimmy uses the yaml of muEd to validate what is and what isn't required.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then why is it mentioned in the PR on reflectiveChat ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update those docs, I've just manually confirmed that the API is optional see

func (h *MuEdHandler) checkMuEdVersion(w http.ResponseWriter, r *http.Request) (string, bool) {

Comment thread runtime/handler_test.go
return args.Get(0).(runtime.EvaluationResponse), args.Error(1)
}

func (m *mockRuntime) Chat(ctx context.Context, req runtime.ChatRequest) (runtime.ChatResponse, error) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so to understand, only /evaluate has tests here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add tests here, but would have to come up with a suitable method for mocking chat functions.

Comment thread runtime/models.go
CommandPreview Command = "preview"

// CommandEvaluate is the command to evaluate the response.
CommandEvaluate Command = "eval"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no CommandEvaluateHealth Command?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's CommandHealth, as that is the shared mueEd and legacy command.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a comment clarifying that would be helpful thanks

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed the command instead.

@neagualexa
neagualexa self-requested a review August 5, 2026 12:39
@m-messer
m-messer merged commit ff2cb7d into main Aug 5, 2026
9 checks passed
@m-messer
m-messer deleted the feature/chat branch August 5, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants