Fix setup export policy name collisions - #5216
Conversation
There was a problem hiding this comment.
Thanks for the fix. Somehow I was under impression policy name is global unique when I added this one. But looking at the code, the parent can be a catalog or a namespace which means policy name doesn't need to be global unique as resolving is based on the resolvedParent.
I think there are couple things which I think we should also fix:
- policy can be catalog level. For the export to include all, we would need to include case where namespace is
""(we should updatecommand-line-interface.mdas well). - We should update
reference-setup-config.yamlto reflect this change as well
Another thing is if we have something likes following:
compaction-policy:
namespace: dev_namespace
...
content: {
...
}
compaction-policy:
namespace: dev_namespace2
...
content: {
...
}
The current code would still only loaded the second one only.
The backward-compatible path via Union[Dict, List] only help us here when we don't have overlap key name for policy. Maybe worth bring a breaking change here or update doc to mention about this limitation when using the dict route?
You can assign a policy to a catalog, but a policy is always hosted within a namespace, . |
Summary
nameandnamespacefields so namespace-scoped identities cannot collidesetup applycompatible with existing policy mappings keyed by nameRationale
Policy names are unique only within a namespace. The previous catalog-wide mapping used policy name as its sole key, so a later namespace silently replaced an earlier same-named policy and made setup backups incomplete.
Fixes #5215
Validation
client/python/.venv/bin/pytest client/python/tests/test_setup_command.py -q(18 passed, 3 subtests passed).venv/bin/pytest tests/fromclient/python(171 passed)./gradlew format compileAll(BUILD SUCCESSFUL, 992 tasks)uv build --clearfromclient/python(source distribution and wheel built successfully)./gradlew rat --rerun-tasks(BUILD SUCCESSFUL)AI disclosure
This change was developed with Codex assistance. I reviewed the implementation, tests, documentation, and generated diff and take responsibility for the contribution.
Checklist
Fixes #5215CHANGELOG.mdsite/content/in-dev/unreleased