Skip to content

Conversation

@gyakami
Copy link
Contributor

@gyakami gyakami commented Oct 10, 2025

Description

This PR adds the missing autoDeleteTenantAssumeRoleAssertions field handling to the domain metadata API interface.

In PR #3027 , we added the autoDeleteTenantAssumeRoleAssertions field to DomainMeta to support automatic cleanup functionality for delegated roles. However, the API interface implementation was inadvertently omitted from that PR.

Contribution Checklist:

  • The pull request does not introduce any breaking changes
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Attach Screenshots (Optional)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @gyakami, 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 completes the implementation for the autoDeleteTenantAssumeRoleAssertions field, which was previously introduced to support automatic cleanup functionality for delegated roles but lacked full API interface handling. The changes ensure that this critical field is now correctly processed, stored, and retrieved within the domain metadata system, enhancing the system's ability to manage delegated role assertions effectively.

Highlights

  • API Interface Update: The autoDeleteTenantAssumeRoleAssertions field has been integrated into the domain metadata API interface, specifically within the DBService class, to ensure it's properly handled during domain metadata updates.
  • Data Persistence Logic: Logic has been added to DBService.java to correctly set and update the autoDeleteTenantAssumeRoleAssertions value on Domain objects based on the provided DomainMeta.
  • Test Coverage: New assertions and field assignments have been added to DBServiceTest.java to validate the correct handling and persistence of the autoDeleteTenantAssumeRoleAssertions field during domain metadata operations.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gyakami gyakami changed the title add autoDeleteTenantAssumeRoleAssertions field to domain metadata Add autoDeleteTenantAssumeRoleAssertions field handling to domain metadata API Oct 10, 2025
Copy link
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 correctly adds the missing autoDeleteTenantAssumeRoleAssertions field handling to the domain metadata API. The changes in DBService.java are consistent with how other domain metadata fields are handled. The test cases in DBServiceTest.java have been updated to cover this new field. I've added a few suggestions to improve the test coverage and robustness for this new boolean field.

assertEquals(resDom3.getBusinessService(), "service1");
assertEquals(resDom3.getSlackChannel(), "athenz");
assertEquals(resDom3.getOnCall(), "athenz-oncall");
assertTrue(resDom3.getAutoDeleteTenantAssumeRoleAssertions());
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

For robustness and to avoid a potential NullPointerException if the getter returns null, it's safer to use assertEquals(Boolean.TRUE, ...) instead of assertTrue(...) for Boolean objects.

Suggested change
assertTrue(resDom3.getAutoDeleteTenantAssumeRoleAssertions());
assertEquals(Boolean.TRUE, resDom3.getAutoDeleteTenantAssumeRoleAssertions());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm using assertTrue to be consistent with the other existing code.

assertTrue(resDom3.getEnabled());

.setSignAlgorithm("ec").setServiceExpiryDays(20).setGroupExpiryDays(25)
.setBusinessService("service2").setMemberPurgeExpiryDays(120)
.setSlackChannel("coretech").setOnCall("athenz-oncall");
.setSlackChannel("coretech").setOnCall("athenz-oncall").setAutoDeleteTenantAssumeRoleAssertions(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To improve test coverage for the new autoDeleteTenantAssumeRoleAssertions field, this part of the test can be updated to check for the false case. Currently, it only tests setting the value to true.

Suggested change
.setSlackChannel("coretech").setOnCall("athenz-oncall").setAutoDeleteTenantAssumeRoleAssertions(true);
.setSlackChannel("coretech").setOnCall("athenz-oncall").setAutoDeleteTenantAssumeRoleAssertions(false);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a test for the false case in 5517e0d

assertEquals(resDom4.getBusinessService(), "service2");
assertEquals(resDom4.getSlackChannel(), "coretech");
assertEquals(resDom4.getOnCall(), "athenz-oncall");
assertTrue(resDom4.getAutoDeleteTenantAssumeRoleAssertions());
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This assertion should be updated to check for false to match the suggested change on line 1674. Also, using assertEquals(Boolean.FALSE, ...) is safer than assertTrue(...) for Boolean objects to prevent a potential NullPointerException.

Suggested change
assertTrue(resDom4.getAutoDeleteTenantAssumeRoleAssertions());
assertEquals(Boolean.FALSE, resDom4.getAutoDeleteTenantAssumeRoleAssertions());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been addressed in the comment above.

@havetisyan havetisyan merged commit 99d7491 into AthenZ:master Oct 10, 2025
3 checks passed
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.

2 participants