Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There are a couple of user-facing validation/error-path issues (misleading “too many params” SSE callback message; overly strict option-type check rejecting aliases) that should be corrected before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new generation mode for SSE routes where Muxt delegates SSE stream wiring to github.com/typelate/sse via a new --wire-typelate-sse flag, enabling cleaner generated handlers and optional forwarding of variadic message options through render callbacks.
Changes:
- Introduces
--wire-typelate-sse(CLI/config/docs) and prevents combining it with--output-datastar. - Extends callback-shape resolution to recognize
func(T, ...O) errorand validatesOagainstsse.MessageOptionduring SSE generation. - Updates SSE handler/codegen to call
sse.New(...)and send frames viastream.Message(...), and adds reference/error goldens for the new behavior.
File summaries
| File | Description |
|---|---|
| internal/muxt/call.go | Records variadic callback option element types and allows func(T, ...O) error callback shapes. |
| internal/generate/sse.go | Wires SSE generation through typelate/sse when enabled; validates callback options type and forwards options into stream.Message. |
| internal/generate/sse_template_data.go | Omits generating SSETemplateData.WriteTo under --wire-typelate-sse. |
| internal/generate/routes.go | Adds WireTypelateSSE to generator configuration. |
| internal/generate/html.go | Rejects callback options on non-SSE (HTML) execute callbacks. |
| internal/cli/commands.go | Adds --wire-typelate-sse flag, config-to-args plumbing, and rejects --wire-typelate-sse with --output-datastar. |
| docs/reference/commands/generate.md | Documents the new --wire-typelate-sse flag and its behavioral implications. |
| cmd/muxt/testdata/reference_wire_typelate_sse.txt | End-to-end reference test that go-gets typelate/sse, generates, and asserts streamed frames (including forwarded id). |
| cmd/muxt/testdata/err_wire_typelate_sse_with_datastar.txt | Golden asserting the mutual-exclusion error for --wire-typelate-sse + --output-datastar. |
| cmd/muxt/testdata/err_callback_options_wrong_type.txt | Golden asserting callback option type must be ...sse.MessageOption. |
| cmd/muxt/testdata/err_callback_options_without_wire.txt | Golden asserting callback options require --wire-typelate-sse. |
Review details
- Files reviewed: 11/11 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Add the first --wire-* flag (decision 00007): --wire-typelate-sse generates SSE handlers that call sse.New and Response.Message instead of the generated wire protocol. sse.New owns the stream headers, flushing, and goroutine safety, so the generated mutex and flusher disappear, the SSETemplateData setters map to MessageOption values, and the WriteTo wire writer is not emitted. Render callbacks may declare a variadic func(T, ...sse.MessageOption) error parameter; resolution records the option element type and the generated closure forwards the options to Message. Generation validates the option type against the wired module and rejects an options parameter without the flag; --output-datastar with the flag is rejected until the patch framing lands. Assisted-by: Claude:claude-fable-5 gofumpt
crhntr
force-pushed
the
feat/wire-typelate-sse
branch
from
September 3, 2026 23:30
245514b to
0c016ae
Compare
Unalias the callback option element type before the named-type check so an alias of sse.MessageOption is accepted; say the supported callback shapes, including the variadic options form, in the too-many-parameters error. The wire reference txtar asserts frames with testify. Assisted-by: Claude:claude-fable-5 gofumpt
crhntr
marked this pull request as draft
September 3, 2026 23:57
A reviewable example of --wire-typelate-sse generated output: an SSE clock whose execute callback forwards ...sse.MessageOption per frame. Reverted in the next commit so muxt keeps no dependency on github.com/typelate/sse; browse this revision to read the code. Assisted-by: Claude:claude-fable-5 gofumpt
This reverts commit 4e9eb28.
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.
Implements the first
--wire-*flag from decision 00007:--wire-typelate-ssegenerates SSE handlers that wire the protocol through github.com/typelate/sse instead of generating it.With the flag, the handler calls
sse.New(response, request, http.StatusOK)— which owns the stream headers, flushing, and goroutine safety — so the generatedhttp.Flusherassertion, header block, andsync.Mutexdisappear, andSSETemplateDataloses itsWriteTowire writer. Each render callback maps the template-set metadata to options (.ID→sse.WithID,.Event→sse.WithEvent,.Retry→sse.WithRetry) and sends the rendered frame withstream.Message.Render callbacks may declare a variadic option parameter:
Resolution accepts
func(T, ...O) errorand records the option element type; generation validatesOis the wired library'sMessageOptionand the closure forwards the options toMessage(receiver options are appended after the template-derived ones, so they win). An options parameter without the flag, a wrong option type, and the not-yet-supported--output-datastarcombination are each rejected with byte-exacterr_*goldens.The reference txtar
go gets the module, generates, checks, and executes both routes against a live mux, asserting the frames — including the forwardedid: n7.🤖 Generated with Claude Code
https://claude.ai/code/session_018Phdz9o5BUZMnd643Am5Ef