Skip to content

Fix Copilot review findings from PR #305 and #308#318

Open
duanemay wants to merge 2 commits into
masterfrom
prev_pr_fixes
Open

Fix Copilot review findings from PR #305 and #308#318
duanemay wants to merge 2 commits into
masterfrom
prev_pr_fixes

Conversation

@duanemay

@duanemay duanemay commented Jul 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Fixes for update-user (PR Add update-user command with documentation and tests #305): require at least one update flag instead of silently no-oping, align flag names (--givenName/--familyName/--email/--phone/--delAttrs) with create-user, and assert PUT request body contents in tests.
  • Fixes for change-client-secret (PR Add change-client-secret command for authenticated client self-service secret updates #308): replace the untyped map[string]interface{} request body with a typed struct, and align the command doc page with the standard command-doc template. (The suggestion to drop the manual X-Identity-Zone-Id header was investigated and not applied — api.Curl() bypasses the go-uaa SDK path where that header is normally injected, so removing it breaks zone-scoped requests.)
  • Updated docs for both commands to match the new flag names/behavior and doc template.

Test plan

  • go build ./...
  • go vet ./...
  • go test ./... (246 specs passing)

🤖 Generated with Claude Code

duanemay and others added 2 commits July 6, 2026 15:48
Require at least one update flag so update-user no longer silently
no-ops, align flag names (--givenName/--familyName/--email/--phone/
--delAttrs) with create-user, and assert PUT request body contents
in tests instead of only status codes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replace the untyped map[string]interface{} request body with a typed
struct, and align the command doc page with the standard command-doc
template (header + command-reference backlinks, Flags/Global Flags
tables, See Also section).

The suggestion to drop the manual X-Identity-Zone-Id header was not
applied: api.Curl() bypasses the go-uaa SDK's structured request path
where WithZoneID's header injection happens, so removing it breaks
zone-scoped requests (confirmed by the existing "supports zone
switching" test failing once the header was removed).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 6, 2026 20:03

Copilot AI 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.

Pull request overview

This PR addresses review feedback from prior PRs by tightening update-user behavior (requiring an actual update), aligning its flag names with create-user, strengthening request-body assertions in tests, and improving change-client-secret by using a typed request payload and bringing its documentation in line with the standard command-doc template.

Changes:

  • update-user: require at least one update flag; rename flags to --givenName/--familyName/--email/--phone/--delAttrs to match create-user.
  • update-user tests: assert PUT request JSON body contents for updated fields and deletion behavior.
  • change-client-secret: replace map[string]interface{} payload with a typed struct; update docs to standard template and add “See Also” links.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/commands/update-user.md Updates docs to the new flag names and documents the “must specify at least one update flag” behavior.
docs/commands/change-client-secret.md Converts doc page to the standard template (flags/global flags/see also) and improves navigation links.
cmd/update_user.go Enforces “at least one update flag” validation and renames flags to camelCase to align with create-user.
cmd/update_user_test.go Adds PUT-body capture + JSON assertions for updated user payload contents (names/emails/phones/deletions).
cmd/change_client_secret.go Uses a typed request struct for the secret-change payload and clarifies why zone header is set manually for api.Curl.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cmd/update_user_test.go
Comment on lines +23 to +28
return func(w http.ResponseWriter, req *http.Request) {
body, err := io.ReadAll(req.Body)
Expect(err).NotTo(HaveOccurred())
*dest = body
req.Body = io.NopCloser(bytes.NewReader(body))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants