Skip to content

plan for migration command#784

Draft
elizabethhealy wants to merge 2 commits intomainfrom
dspx-2540-migration-command
Draft

plan for migration command#784
elizabethhealy wants to merge 2 commits intomainfrom
dspx-2540-migration-command

Conversation

@elizabethhealy
Copy link
Copy Markdown
Member

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4f219565-dad5-44b2-9a62-47b82fde7014

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dspx-2540-migration-command

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request outlines a migration plan for namespacing policy items such as actions, subject mappings, and registered resources using a graph-based, create-only approach. The documentation covers namespace determination rules, execution order, and a phased rollout strategy. Feedback was provided regarding inconsistencies in the description of the prune fallback mechanism, the need for better alignment of metadata update steps in the execution plan, and a request for clarification on the specific conditions that trigger an SCS namespace conflict blocker.

otdfctl migrate prune registered-resources --from=migration.json --commit
```

Prune reads the migration manifest (JSON file emitted by `--output`) to know exactly which old unnamespaced items map to which new namespaced copies. If `--from` is not provided, prune falls back to re-deriving matches (by name for actions/RR, by content for SCS, by attribute-value-id+actions+SCS for SM). Items that were never migrated are left untouched and flagged in the output.
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.

medium

The description of the prune fallback mechanism here is inconsistent with the more robust approach described later in the document (line 236). This line suggests a heuristic re-derivation of matches, while line 236 states that the primary mechanism will be filtering for items with the wasMigrated=true label. The label-based approach is much safer and less error-prone. It would be best to update this section to consistently describe the label-based approach as the primary fallback.

Comment on lines +202 to +206
3. If actions in scope: create actions via `handler.CreateAction(name, targetNS, nil)`. For reuse cases, skip creation and record existing action ID.
4. If SCS in scope: create SCS clones via `handler.CreateSubjectConditionSet(subjectSets, metadata, targetNS)`
5. If SM in scope: create new SM in target NS via `handler.CreateNewSubjectMapping(attrValID, rewrittenActions, newSCSID, nil, metadata, targetNS)`. Then update old SM metadata to add `wasMigrated=true`. Old SM is NOT deleted.
6. If RR in scope: create new RR + values in target NS (using existing `commitRegisteredResourceMigration` logic, modified to skip the delete step). Then update old RR metadata to add `wasMigrated=true`. Old RR is NOT deleted.
7. For actions and SCS: after creating namespaced copies, update old items' metadata to add `wasMigrated=true`.
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.

medium

The execution plan for actions (step 3) and SCS (step 4) doesn't mention updating the old item's metadata, while this is explicitly part of the steps for SM (step 5) and RR (step 6). Step 7 then adds this for actions and SCS.

For better clarity and consistency, I suggest incorporating the metadata update directly into steps 3 and 4, and then removing step 7. For example:

  • Step 3: "... After creating the namespaced action, update the old action's metadata to add wasMigrated=true."
  • Step 4: "... After creating the SCS clone, update the old SCS's metadata to add wasMigrated=true."

This would make the execution flow for each resource type symmetrical.

### SM/SCS blockers
- `SM_NAMESPACE_UNDETERMINED` — attribute value has no parseable namespace FQN
- `SM_ACTION_NOT_IN_PLAN` — SM references action not covered by action plan
- `SCS_NAMESPACE_CONFLICT` — SCS clone target can't be determined
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.

medium

The condition for the SCS_NAMESPACE_CONFLICT blocker is unclear. The "Namespace Determination Rules" on line 28 state that if an SCS is referenced by SMs in multiple namespaces, it will be cloned into each namespace. This seems to handle the multi-namespace case. Could you please clarify under what specific circumstances an SCS_NAMESPACE_CONFLICT would occur? For example, does this happen if the referencing SMs themselves have an undetermined namespace?

@github-actions
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant