-
Notifications
You must be signed in to change notification settings - Fork 6
feat(core): DSPX-18 clean up Go context usage to follow best practices #558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request updates the codebase to adopt a more consistent usage of Go contexts by passing a context from the Cobra command instead of relying on hardcoded or stored contexts. Key changes include updating handler function signatures and command invocations to accept a context, and refactoring TUI components to leverage context where possible.
- Refactored handler methods in the pkg/handlers package to accept a context argument.
- Updated CLI command implementations (cmd/*) to pass cmd.Context() when invoking handler methods.
- Adjusted TUI components to use a context variable (currently set to context.Background()) in update functions.
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tui/labelUpdate.go | Uses context.Background() for Update, forwarding to handler. |
| tui/labelList.go | Updates context usage to pass a background context. |
| tui/attributeView.go | Refactors InitAttributeView to take a context for GetAttribute. |
| tui/attributeList.go | Updates InitAttributeList to pass context in list retrieval. |
| tui/appMenu.go | Propagates context to attribute list initialization. |
| pkg/handlers/* (multiple files) | Refactors all handler functions to explicitly accept a context. |
| cmd/* | Passes cmd.Context() in commands, ensuring proper context flow. |
🤖 I have created a release *beep* *boop* --- ## [0.21.0](v0.20.0...v0.21.0) (2025-05-29) ### Features * Add initial Dependency Review configuration ([#551](#551)) ([b622666](b622666)) * **core:** Add base key cmds ([#563](#563)) ([edfd6c0](edfd6c0)) * **core:** DSPX-18 clean up Go context usage to follow best practices ([#558](#558)) ([a2c9f8b](a2c9f8b)) * **core:** DSPX-608 - Deprecate public_client_id ([#555](#555)) ([8d396bd](8d396bd)) * **core:** DSPX-608 - require clientID for login ([#553](#553)) ([580172e](580172e)) * **core:** DSPX-896 add registered resources CRUD ([#559](#559)) ([8e7475e](8e7475e)) * **core:** KAS allowlist options ([#539](#539)) ([af7978f](af7978f)) * **core:** key management operations ([#533](#533)) ([d4f6aaa](d4f6aaa)) * **main:** add actions CRUD and e2e tests ([#523](#523)) ([2fb9ec7](2fb9ec7)) * **main:** refactor actions within existing CLI policy object CRUD ([#543](#543)) ([9ab1a58](9ab1a58)) * **core:** Resource mapping groups ([#567](#567)) ([03fa307](03fa307)) * **core:** Update key mgmt flags to consistent format ([#570](#570)) ([#846f96c](846f96c)) * **core:** Rotate Key ([#572](#572)) ([afd0043](afd0043)) ### Bug Fixes * **ci:** ci job should run on changes to GHA ([#530](#530)) ([1d296ca](1d296ca)) * **main:** Pass the full url when building the sdk object ([#544](#544)) ([8b836f0](8b836f0)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com> Co-authored-by: Elizabeth Healy <[email protected]> Co-authored-by: Chris Reed <[email protected]> Co-authored-by: Jake Van Vorhis <[email protected]>
Updates handler struct to use passed-in context from the Cobra
cmdstruct