Skip to content

fix(sdk/go): list Go SDK in READMEs and fix two review findings#1767

Merged
sergiofilhowz merged 3 commits into
iii-hq:mainfrom
MarcusElwin:fix/go-sdk-readme-and-bugs
Jun 5, 2026
Merged

fix(sdk/go): list Go SDK in READMEs and fix two review findings#1767
sergiofilhowz merged 3 commits into
iii-hq:mainfrom
MarcusElwin:fix/go-sdk-readme-and-bugs

Conversation

@MarcusElwin

@MarcusElwin MarcusElwin commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Closes #1765
Closes #1766

What

Three changes to the (now-merged) Go SDK:

  1. Docs: update docs in README about GO SDK
  2. Trigger teardown (client.go) fix (which was ignored before)
  3. Integration test precision (tests/worker_metadata_test.go)

Why

The Go SDK shipped in #1739 but was missing from the READMEs, so it was undiscoverable
next to the other SDKs. The other two are correctness fixes from the #1740 review
(CodeRabbit): the teardown gap is a real resource leak for custom trigger types, and the
test could give a false green.

Notes

  • Verified: TestInboundUnregisterTrigger (unit, race-clean) covers the teardown
    dispatch; TestWorkerRegistersWithGoRuntime passes against a live engine with the
    name-correlated assertion. Both README Go snippets compile against the merged SDK.
  • The teardown fix mirrors the reference SDKs exactly: look up the handler by
    trigger_type, call UnregisterTrigger with the instance id (the wire message
    carries only id + optional trigger_type, so the handler keys cleanup off the id).
  • Not addressed here (tracked separately): the per-connection reply-queue race (Go SDK: route connection-scoped replies through a per-connection outbound queue #1749).

Summary by CodeRabbit

  • New Features

    • Go SDK officially added with API parity across SDKs
    • Trigger unregistration supported in the Go SDK
  • Documentation

    • Go SDK install, examples, and usage added across docs
    • SDK reference updated to list Go alongside Node.js, Python, Rust
  • Tests

    • Added tests and integration updates to validate Go trigger unregistration and worker registration behavior

@vercel

vercel Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@MarcusElwin is attempting to deploy a commit to the motia Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e300edf6-a860-4ed4-823a-a3d0dc946370

📥 Commits

Reviewing files that changed from the base of the PR and between cce2e1f and dbfddb7.

📒 Files selected for processing (2)
  • README.md
  • sdk/README.md
✅ Files skipped from review due to trivial changes (2)
  • README.md
  • sdk/README.md

📝 Walkthrough

Walkthrough

This PR adds inbound UnregisterTrigger handling to the Go SDK client, ensures integration tests target a specific worker by name, and updates root and SDK README files to include and document the Go SDK.

Changes

Go SDK Trigger Unregistration and Integration Improvements

Layer / File(s) Summary
Trigger unregistration handler and dispatch
sdk/packages/go/iii/client.go, sdk/packages/go/iii/client_test.go
Client dispatcher now handles MsgUnregisterTrigger and routes it to the matching trigger-type handler's UnregisterTrigger hook with the instance ID. Test stub added unregistered channel and TestInboundUnregisterTrigger verifies the flow.
Integration test worker identity isolation
sdk/packages/go/iii/tests/common_test.go, sdk/packages/go/iii/tests/worker_metadata_test.go
connect helper delegates to connectNamed to support optional iii.WithName; worker metadata test uses a unique name and matches the worker entry by name instead of accepting the first connected Go runtime worker.
SDK documentation updates for Go
README.md, sdk/README.md
Root README adds Go to the SDKs table and repository structure. SDK README adds Go to introductions and package table, includes a Go "Hello World" example, extends the API table with Go entries, and documents that call/callVoid/triggerVoid were removed in favor of trigger() and TriggerAction.Void().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • sergiofilhowz
  • mfpiccolo
  • anthonyiscoding

Poem

🐰 A trigger's final bow,
Unregistered with grace,
The Go client lets it go,
Tests now find the named runner,
Docs welcome Go to the race.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: updating Go SDK documentation in READMEs and fixing two review findings from the prior PR.
Description check ✅ Passed The description covers all three changes (docs, trigger teardown, integration test precision) with clear 'What', 'Why', and 'Notes' sections following the template structure.
Linked Issues check ✅ Passed The PR fully addresses both linked issues: #1765 (dispatch UnregisterTrigger to handler) and #1766 (correlate worker test to specific instance).
Out of Scope Changes check ✅ Passed All changes directly support the stated objectives: README updates for Go SDK visibility, UnregisterTrigger dispatch implementation, and test robustness improvements.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@sdk/README.md`:
- Around line 131-133: The table/text incorrectly claims all SDKs auto-connect
on initialization; update the README to clarify Go requires an explicit Connect
call by changing the "Initialize" cell for Go from "iii.RegisterWorker(url)" to
indicate registration only (e.g., "iii.RegisterWorker(url) — register only; call
Connect(...) to connect") and adjust the summary lines (around the paragraphs
referencing auto-connect) to note that Go does not auto-connect and requires an
explicit iii.Connect or Connect call after iii.RegisterWorker; ensure references
to iii.RegisterWorker and Connect are used so readers can find the Go example
easily.
- Around line 90-127: Remove the inline Go example block in sdk/README.md (the
code that uses RegisterWorker, RegisterFunction, RegisterTrigger and Connect)
and move that exact example into a dedicated docs example file; then replace the
README code block with a short link/reference to the new docs example so the
README points to the canonical example in docs rather than embedding the full
code.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: df1859c0-514d-4b82-848f-a3ccf6bc765f

📥 Commits

Reviewing files that changed from the base of the PR and between cbc21ca and cce2e1f.

📒 Files selected for processing (6)
  • README.md
  • sdk/README.md
  • sdk/packages/go/iii/client.go
  • sdk/packages/go/iii/client_test.go
  • sdk/packages/go/iii/tests/common_test.go
  • sdk/packages/go/iii/tests/worker_metadata_test.go

Comment thread sdk/README.md
Comment on lines +90 to +127
### Go

```go
package main

import (
"context"
"encoding/json"
"log"

iii "github.com/iii-hq/iii/sdk/packages/go/iii"
)

func main() {
client := iii.RegisterWorker("ws://127.0.0.1:49134")

client.RegisterFunction("hello::greet", func(ctx context.Context, data json.RawMessage) (any, error) {
var req struct {
Body struct {
Name string `json:"name"`
} `json:"body"`
}
_ = json.Unmarshal(data, &req)
return map[string]any{
"status_code": 200,
"body": map[string]string{"message": "Hello, " + req.Body.Name + "!"},
}, nil
})

client.RegisterTrigger("hello-http", "http", "hello::greet",
json.RawMessage(`{"api_path":"/greet","http_method":"POST"}`), nil)

if err := client.Connect(context.Background()); err != nil {
log.Fatal(err)
}
defer client.Close()
}
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Move README inline example to docs and link it instead.

This section embeds a full Go example in sdk/README.md. The repository guideline for **/README.md says examples should live in docs/ and READMEs should link to them to avoid drift.

As per coding guidelines, “READMEs should not contain example code that is already in the docs/. READMEs should link these examples in the docs/.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sdk/README.md` around lines 90 - 127, Remove the inline Go example block in
sdk/README.md (the code that uses RegisterWorker, RegisterFunction,
RegisterTrigger and Connect) and move that exact example into a dedicated docs
example file; then replace the README code block with a short link/reference to
the new docs example so the README points to the canonical example in docs
rather than embedding the full code.

Comment thread sdk/README.md
Comment on lines +131 to +133
| Operation | Node.js | Python | Rust | Go | Description |
| ------------------------ | ---------------------------------------------------- | ------------------------------------------- | -------------------------------------------- | ------------------------------------------- | ------------------------------------------------------ |
| Initialize | `registerWorker(url)` | `register_worker(url, options?)` | `register_worker(url, options)` | `iii.RegisterWorker(url)` | Create an SDK instance and auto-connect |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Fix Go initialization semantics in the API table/text.

Line 133 and Line 139 state initialization auto-connects across all SDKs, but this file’s Go example (Line 122) requires explicit Connect(...). Please adjust the table/summary to avoid misleading Go users.

Proposed doc fix
-| Initialize               | `registerWorker(url)`                                | `register_worker(url, options?)`            | `register_worker(url, options)`              | `iii.RegisterWorker(url)`                   | Create an SDK instance and auto-connect                |
+| Initialize               | `registerWorker(url)`                                | `register_worker(url, options?)`            | `register_worker(url, options)`              | `iii.RegisterWorker(url)`                   | Create an SDK instance (Go connects via `Connect(ctx)`) |
-`registerWorker()` / `register_worker()` creates an SDK instance and auto-connects to the engine. It handles WebSocket communication, automatic reconnection, and OpenTelemetry instrumentation. All four SDKs expose the same API surface — register functions and triggers, then invoke them.
+`registerWorker()` / `register_worker()` creates an SDK instance. Node/Python auto-connect; Go connects explicitly via `Connect(ctx)`. SDKs expose the same core API surface — register functions and triggers, then invoke them.

Also applies to: 139-139

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sdk/README.md` around lines 131 - 133, The table/text incorrectly claims all
SDKs auto-connect on initialization; update the README to clarify Go requires an
explicit Connect call by changing the "Initialize" cell for Go from
"iii.RegisterWorker(url)" to indicate registration only (e.g.,
"iii.RegisterWorker(url) — register only; call Connect(...) to connect") and
adjust the summary lines (around the paragraphs referencing auto-connect) to
note that Go does not auto-connect and requires an explicit iii.Connect or
Connect call after iii.RegisterWorker; ensure references to iii.RegisterWorker
and Connect are used so readers can find the Go example easily.

Comment thread sdk/README.md Outdated
Comment thread README.md Outdated
@sergiofilhowz

Copy link
Copy Markdown
Contributor

This looks good, @MarcusElwin. We really appreciate your attention to details. I just added a couple of very small comments

MarcusElwin and others added 2 commits June 5, 2026 17:51
Co-authored-by: Sérgio Marcelino <sergio@filho.org>
Co-authored-by: Sérgio Marcelino <sergio@filho.org>
@MarcusElwin

Copy link
Copy Markdown
Contributor Author

This looks good, @MarcusElwin. We really appreciate your attention to details. I just added a couple of very small comments

Thanks @sergiofilhowz committed your suggestions.

@sergiofilhowz

Copy link
Copy Markdown
Contributor

Thanks again @MarcusElwin!! We're good to merge this one too!

@sergiofilhowz sergiofilhowz merged commit c359d56 into iii-hq:main Jun 5, 2026
32 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants