feat: align Core API fields and support response extensions - #14
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved compatibility, cookie-isolation, upload-error, and test-coverage issues remain.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Aligns SDK models and API endpoints with updated Core fields while adding extensible request and response handling.
Changes:
- Updates Core routes and model fields.
- Adds
WithResponsedecoding and request extensions. - Adds documentation and tests while removing obsolete integration tests.
Review findings:
- Critical, 3 votes —
model/token.go: ReplacingAccountNamebreaks downstream compatibility and legacyaccount_namedecoding. - Moderate, 3 votes —
httplib/client.go:WithResponseshould clone the cookie jar to prevent session leakage. - Moderate, 2 votes —
httplib/client.go: Upload error handling should preserve the response body. - Moderate, 1 vote —
httplib/response_test.go: The assertion does not detect decoder regressions.
File summaries
| File | Reviewed change |
|---|---|
storage/es_test.go |
Removes obsolete response test. |
service/url.go |
Updates Core API paths. |
service/request.go |
Adds request-field merging. |
service/register.go |
Adds registration options and extensions. |
service/register_test.go |
Tests registration extensions. |
service/panda/client_test.go |
Removes obsolete manual test. |
service/jms.go |
Adds response-bound services. |
service/jms_token.go |
Adds token options and fields. |
service/jms_token_test.go |
Tests token extensions. |
service/jms_test.go |
Removes environment-dependent tests. |
model/token.go |
Expands token response models. |
model/remote_app.go |
Adds virtual-app provider fields. |
model/platform.go |
Adds protocol fields. |
model/asset.go |
Adds web-login and asset fields. |
model/account.go |
Adds privileged account state. |
httplib/response.go |
Implements dual response decoding. |
httplib/response_test.go |
Tests response decoding. |
httplib/client.go |
Adds response-bound client support. |
httplib/client_test.go |
Tests client isolation and uploads. |
docs/api-fields.md |
Documents extension behavior. |
common/time_test.go |
Strengthens UTC time tests. |
Review details
Suppressed comments (1)
httplib/response_test.go:29
- This assertion never fails for either table row: the first payload intentionally leaves
token.ExpireTimeat zero while settingextra.Future, and the second does the opposite, so&&is false in both cases. Assert the expected successful destination separately for each payload (or parameterize those expectations) so a regression in one decoder is detected.
if token.ExpireTime != 60 && !extra.Future {
t.Fatal("an error in one destination prevented decoding the other")
- Files reviewed: 21/21 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| Value string `json:"value"` | ||
| ExpireTime int `json:"expire_time"` | ||
| Protocol string `json:"protocol"` | ||
| Account string `json:"account,omitempty"` |
Comment on lines
+93
to
+96
| client := *c | ||
| client.cookies = maps.Clone(c.cookies) | ||
| client.headers = maps.Clone(c.headers) | ||
| client.extraResponse = target |
| _, err = buf.ReadFrom(resp.Body) | ||
| return err | ||
| } | ||
| res = c.responseDestination(res) |
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.
No description provided.