Add Topics.Update to rename a thread subject - #220
Open
jeissonneira wants to merge 2 commits into
Open
jeissonneira wants to merge 2 commits into
jeissonneira wants to merge 2 commits into
Conversation
PATCH /topics/{id}.json with {"name":…}; treat 302 as success without following.
There was a problem hiding this comment.
🟡 Changes recommended
The operation must use the model-first pipeline and include cross-SDK and conformance coverage.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds topic renaming through a JSON PATCH endpoint in the Go SDK.
Changes:
- Adds
TopicsService.Update. - Adds request, redirect, and error tests.
[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or rungh pr ready --undo.
Click "Ready for review" or rungh pr readyto reengage.
File summaries
| File | Description |
|---|---|
go/pkg/hey/topics.go |
Implements topic renaming. |
go/pkg/hey/topics_test.go |
Tests the new request behavior. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Balanced (auto)
Note
Copilot is running an experiment and ran this review at Balanced.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // HTML topic URL; the redirect is captured and not followed (same as PatchForm mutations). | ||
| // This is not in the OpenAPI model, so it goes through doBodyRequest rather than a | ||
| // generated client method. | ||
| func (s *TopicsService) Update(ctx context.Context, topicID int64, name string) error { |
| } | ||
| } | ||
|
|
||
| func TestTopicsService_UpdateRenamesViaJSONPatch(t *testing.T) { |
Rename a thread via PATCH /topics/{topicId} with flat {"name":…}.
HEY answers 302; treat it as success and do not follow (heyEmptyOn +
captureRedirects in Rust/Swift/Kotlin generators; Go still sends through
doBodyRequest). Conformance path fixture and runners wired.
Author
|
Addressed the Copilot review on the model-first path:
Go unit tests + full Go conformance: 196/196 green locally. |
This branch has not been deployed
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 gap
HEY lets you rename a thread’s subject in the web UI. The SDK’s
Topicsservice can read and trash topics, but it has no write for that rename — so a CLI command cannot go through the typed SDK the wayWorkflows().Updatedoes.The change
Topics().Update(ctx, topicID, name)PATCHes/topics/{id}.jsonwith{"name":"…"}— the same JSON body the web app sends (field isname, notsubject).Success is HTTP 302 to the HTML topic URL. The redirect is captured and not followed, matching
PatchForm/doBodyRequestmutations (CheckResponsestays 2xx-only; this path does not go through it).Not in OpenAPI, so this is a hand-written wrapper next to
Trash/Move, viadoBodyRequestwithContent-Type: application/json.This is a real JSON endpoint HEY’s own UI calls, not an HTML-form scrape of an undocumented action.
Tests
TestTopicsService_Update*covers PATCH path, JSONname(notsubject), 302 without follow, and error surfacing.GOWORK=off go test ./pkg/hey/green.Follow-up
hey-cli can then add
hey thread rename <id> --name "…"on top of this, mirroringhey workflow update/rename.Summary by cubic
Adds
Topics().Updateso callers can rename a thread subject the same way HEY's web UI does, now modeled in Smithy and regenerated across Go, Kotlin, Rust, Swift, and TypeScript./topics/{topicId}with{"name":"…"}— the field isname, notsubject.Written for commit fa7eb36. Summary will update on new commits.