Skip to content

Preserve setup principal-role properties - #5281

Open
mattfaltyn wants to merge 3 commits into
apache:mainfrom
mattfaltyn:fix-5280-setup-principal-role-properties
Open

Preserve setup principal-role properties#5281
mattfaltyn wants to merge 3 commits into
apache:mainfrom
mattfaltyn:fix-5280-setup-principal-role-properties

Conversation

@mattfaltyn

@mattfaltyn mattfaltyn commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

polaris setup export currently serializes principal roles as names only, so applying an exported configuration silently recreates roles without their user-defined properties.

This change:

  • exports a principal role as an object with name and properties when properties are present;
  • keeps the existing short string form for roles without properties;
  • accepts both forms during setup apply, preserving backward compatibility with existing setup files;
  • extends the entity-property round-trip regression test, including mixed legacy and object entries, and documents both supported forms.

Fixes #5280

Validation

  • make client-lint
  • make client-unit-test — 184 passed
  • make client-license-check
  • make client-build — sdist and wheel built successfully
  • cd site/it && uv run pytest — 27 passed
  • JAVA_HOME=/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home ./gradlew format compileAll — BUILD SUCCESSFUL
  • Parsed site/content/guides/assets/polaris/reference-setup-config.yaml with yaml.safe_load
  • git diff --check

Checklist

  • 🛡️ No security issue is disclosed
  • 🔗 The need is explained and the related issue is linked: Fixes Python CLI setup export drops principal-role properties #5280
  • 🧪 Tests were updated with round-trip and backward-compatibility coverage
  • 💡 No comments were added because the compatibility branch follows the existing namespace-entry pattern
  • 🧾 Updated CHANGELOG.md
  • 📚 Updated site/content/in-dev/unreleased and the reference setup configuration

AI assistance

This change was prepared with significant AI assistance. I reviewed the implementation end to end and remain responsible for the contribution.


def _export_principal_roles(self, api: PolarisDefaultApi) -> List[str]:
"""Export all principal role names."""
def _export_principal_roles(self, api: PolarisDefaultApi) -> List[Any]:

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.

Should we change to List[Union[str, Dict[str, Any]]] instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call — updated both annotations to List[Union[str, Dict[str, Any]]].

@@ -308,6 +308,7 @@ def test_setup_export(self, mock_isfile: MagicMock, mock_file: MagicMock) -> Non

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.

Should we add test case when no name is set?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks — added coverage confirming nameless role objects are skipped without creating a role.

self.assertEqual(len(exported), 1)
self.assertEqual(
exported[0]["endpoint_internal"], "https://bucket.vpce-1a2b3c4d-5e6f.s3.us-west-2.vpce.amazonaws.com"
exported[0]["endpoint_internal"],

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.

NIT: this is not related to this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed — removed the unrelated formatting change.

@mattfaltyn
mattfaltyn force-pushed the fix-5280-setup-principal-role-properties branch from baeb45b to d3a7264 Compare August 14, 2026 09:12
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.

Python CLI setup export drops principal-role properties

2 participants