Hi Alex, +1 on (1) without reservation. The three meanings are genuinely confusing, and the javadocs make it worse rather than better.
On (2), I agree the parameter on PolarisMetaStoreManager.rotatePrincipalSecrets() is dead, and the service layer carries the same dead plumbing: rotateOrResetCredentialsHelper() takes a shouldReset flag that only ever receives false, since rotateCredentials() passes the literal and resetCredentials() goes through resetCredentialsHelper(), which never calls rotatePrincipalSecrets() at all. Your third paragraph covers the case I wanted to raise, so just to make the split explicit, since "the unreachable branch in managers" could be read either way: there are two reset-gated constructs in the managers. AtomicOperationMetaStoreManager and TransactionalMetaStoreManagerImpl both compute boolean doReset = reset || internalProps.get(PRINCIPAL_CREDENTIAL_ROTATION_REQUIRED_STATE) != null; and pass doReset to the persistence layer (IntegrationPersistence.rotatePrincipalSecrets() and rotatePrincipalSecretsInCurrentTxn() respectively); NoSqlMetaStoreManager does the same inline, with reset || principal.credentialRotationRequired(). That one stays live after the parameter goes, because the stored flag still feeds it: it is the path behind the behaviour in your third paragraph. The flag-setting logic is the one that becomes unreachable. So concretely: - Dropping the parameter from PolarisMetaStoreManager.rotatePrincipalSecrets() and from the service helper: +1. - Deleting the flag-setting logic, i.e. if (reset && !<flag already set>) in the two core managers and the equivalent expression in NoSqlMetaStoreManager: +1. - As part of (1), renaming the persistence-level parameter (IntegrationPersistence.rotatePrincipalSecrets() and its in-transaction counterpart) to say what it actually does, e.g. discardPreviousSecret. That is the one place the flag genuinely means "do not retain the old main secret as the secondary". With the manager parameter gone, doReset collapses to the stored-flag check, and a rotation always clears the requirement, which is already the behaviour today. -Ayush On Thu, 26 Nov 2026 at 17:10, Alex Dutra via dev <[email protected]> wrote: > > Hi all, > > While working on credentials rotation recently, I noticed that "reset" > means two different things, which is confusing: > > 1. The reset API (POST /principals/{name}/reset). > PolarisAdminService.resetCredentials() deletes the principal's secrets > and calls PolarisMetaStoreManager.resetPrincipalSecrets(). > > 2. A reset flag on rotation: > PolarisMetaStoreManager.rotatePrincipalSecrets() has a "reset" > parameter. When true, the previous main secret is not kept as the > secondary secret, and the principal gets marked as requiring a > credential rotation. > > Only the first path is used today. Polaris always passes reset=false > to rotatePrincipalSecrets(), and the branch where reset=true is > unreachable outside tests. > > But there is more: when a principal created with > credentialRotationRequired rotates for the first time, the persistence > layer drops its initial secret instead of keeping it as the secondary. > That's also controlled by a parameter named "reset" in > IntegrationPersistence.rotatePrincipalSecrets(). This also adds to the > confusion. > > Here is what I propose: > > 1. Clarify things: rename badly-named methods and parameters, remove > unused parameters in the service layer, document how rotate and reset > differ, fix stale javadocs. This is uncontroversial imho. > > 2. Change the SPI: since the reset=true branch is not exercised in > production, remove the unused parameter from > PolarisMetaStoreManager.rotatePrincipalSecrets() and delete the > unreachable branch in managers who implemented it. This requires > consensus, which is why I'm writing this message. > > Please let me know your thoughts. > > Thanks, > Alex
