feat(core): migrate registered resources#772
Conversation
# Conflicts: # go.mod # go.sum
…e constraint violation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a crucial migration utility to transition existing registered resources into a namespaced structure. This change enhances the organization and management of resources by assigning them to specific namespaces, aligning with modern policy management practices. The new command provides flexible execution options, allowing users to perform migrations interactively or in a batch, while also emphasizing data safety through a pre-migration backup prompt. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request introduces a new migrate command to the otdfctl CLI, enabling the migration of registered resources to specific namespaces. This functionality includes identifying resources without assigned namespaces, providing interactive or batch modes for selecting target namespaces, re-creating resources and their values under the new namespace while preserving metadata and action-attribute mappings, and subsequently deleting the original resources. The implementation also features a critical backup confirmation step and comprehensive unit tests. A consistent improvement opportunity highlighted in the review comments is to enhance error handling by wrapping returned errors with fmt.Errorf("message: %w", err) across various functions within migrations/registered-resources.go to ensure better debugging context and error traceability.
|
note to self:
|
X-Test Failure Report |
X-Test Failure Report |
elizabethhealy
left a comment
There was a problem hiding this comment.
should this happen on the backend instead?
Lmk if this answers your question: opentdf/platform#3111 (comment) |
c-r33d
left a comment
There was a problem hiding this comment.
I think it looks good, a couple questions I have though:
1.) Is there a better way we can test the interactive mode. Before I used expect, which ended up not being great. (Super flakey tests -- prob user error).
🤖 I have created a release *beep* *boop* --- ## [0.30.0](v0.29.0...v0.30.0) (2026-03-31) ### Features * **core:** Add optional namespace flag for subject mappings and condtion sets ([#779](#779)) ([9e849c4](9e849c4)) * **core:** add scope support for client creds ([#752](#752)) ([9ca9e43](9ca9e43)) * **core:** migrate registered resources ([#772](#772)) ([2b49a7d](2b49a7d)) * **core:** optional namespace in actions commands and re-enable actions/RR tests ([#775](#775)) ([29a2eb1](29a2eb1)) * **core:** support namespaced registered resources ([#767](#767)) ([4d786b5](4d786b5)) ### Bug Fixes * **ci:** Temporarily skip namespaced-actions impacted BATS cases ([#773](#773)) ([633728a](633728a)) * **core:** bump toolchain to go 1.24.13 ([#747](#747)) ([6804b93](6804b93)) * **core:** disable RR E2E tests ([#768](#768)) ([0821b8c](0821b8c)) * **core:** make namespacing registered resources optional ([#785](#785)) ([8e6eb31](8e6eb31)) * **core:** refactor `ListAttributesValues` to use `Get` ([#769](#769)) ([a82f7b7](a82f7b7)) * **core:** unsafe update result output values order ([#759](#759)) ([baeba0f](baeba0f)) --- 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>
This PR adds a migration command and tests for legacy RRs to namespaced RRs.