Hi all,

@Mike: Thanks, that's a very helpful context.

Since we all agree that it's OK to remove dead code in the backend, here is
the next PR:

https://github.com/apache/polaris/pull/6290

Thanks,
Alex


On Wed, Dec 02, 2026 at 3:04 AM, Michael Collado <[email protected]>
wrote:

> Just to chime in with some historical context, the original intention for
> "reset" was to completely wipe out the previous credentials and only
> support the newly fabricated ones going forward. The original use case was
> something like an admin creates a principal with a one-time-use credential
> that is handed to the end user who uses that credential to log in, reset
> and get new credentials the admin never had access to. I think the
> intention was right, though the implementation meandered a bit before
> settling on what we currently have. I think the backend was written to
> support something that never fully materialized in the frontend. I'm fully
> in favor of cutting out dead code and renaming for clarity. A brief glance
> at the PR seems good to me.
>
> Mike
>
> On Tue, Dec 1, 2026 at 8:24 AM Alex Dutra via dev <[email protected]>
> wrote:
>
>> Hi all,
>>
>> Thanks everyone for the feedback. I opened a PR for step 1:
>>
>> https://github.com/apache/polaris/pull/6278
>>
>> As Ayush suggested, it also renames the persistence-level reset
>> parameter to discardPreviousSecret. Since parameter names aren't part
>> of a Java signature, this is source-compatible. No SPI signature or
>> behavior changes.
>>
>> I'll open a separate PR for step 2, removing the unused parameter from
>> PolarisMetaStoreManager.rotatePrincipalSecrets(), once this one is
>> merged.
>>
>> Thanks,
>> Alex
>>
>> On Tue, Dec 1, 2026 at 12:57 AM Yufei Gu <[email protected]> wrote:
>> >
>> > +1 on discardPreviousSecret.
>> > Yufei
>> >
>> >
>> > On Thu, Nov 26, 2026 at 9:29 AM Dmitri Bourlatchkov via dev <
>> > [email protected]> wrote:
>> >
>> > > Hi Ayush, Alex,
>> > >
>> > > +1 to the proposed plan (both points 1 + 2).
>> > >
>> > > Cheers,
>> > > Dmitri.
>> > >
>> > > On Thu, Nov 26, 2026 at 7:08 AM Alex Dutra via dev <
>> [email protected]
>> > > >
>> > > wrote:
>> > >
>> > > > Hi Ayush,
>> > > >
>> > > > +100. Your detailed description matches exactly what I had in mind
>> for
>> > > > part (2).
>> > > >
>> > > > Thanks,
>> > > > Alex
>> > > >
>> > > > On Thu, Nov 26, 2026 at 1:01 PM Ayush Saxena <[email protected]>
>> wrote:
>> > > > >
>> > > > > 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
>> > > >
>> > >
>>
>

Reply via email to