Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transitioning from DEPRECATED state? #722

Closed
ajborley opened this issue Jul 29, 2020 · 4 comments
Closed

Transitioning from DEPRECATED state? #722

ajborley opened this issue Jul 29, 2020 · 4 comments
Labels

Comments

@ajborley
Copy link
Contributor

ajborley commented Jul 29, 2020

Apicurio restricts the transitions between states via the ArtifactStateExt class (1) but it seems that once an artifact is in DEPRECATED state it can only then transition to DELETED state. Typically, a deprecated resource is still usable, but will eventually become unusable, which I think maps to the DISABLED state in Apicurio.
Additionally, if a user accidentally deprecates an artifact, there is no way to reverse that action at the moment, beyond creating a new artifact.

Is there an expected lifecycle of an artifact version? My guess is something like the following:

ENABLED -> DEPRECATED -> DISABLED -> DELETED

With transitions permitted between any of ENABLED, DEPRECATED and DISABLED, but not from DELETED, which is a final irreversible state.

(1)

transitions = new HashMap<>();
transitions.put(ArtifactState.ENABLED, EnumSet.of(ArtifactState.DISABLED, ArtifactState.DEPRECATED, ArtifactState.DELETED));
transitions.put(ArtifactState.DISABLED, EnumSet.of(ArtifactState.ENABLED, ArtifactState.DEPRECATED, ArtifactState.DELETED));
transitions.put(ArtifactState.DEPRECATED, EnumSet.of(ArtifactState.DELETED));
transitions.put(ArtifactState.DELETED, EnumSet.noneOf(ArtifactState.class));

@EricWittmann
Copy link
Member

This is an interesting question, actually. I can see the reasoning behind the current approach. You can go from DEPRECATED only to DELETED if we assume that "Un-Deprecating" is not a thing that should be allowed. So in that case you can only go to DELETED as the next step because going into DISABLED state allows you to then go back to ENABLED.

In one sense I think the artifact version "state" is actually combining two concepts:

  • Enabled/Disabled
  • Deprecated

But I think what we've done is a reasonable simplification/combination of those concepts. The question becomes what state transitions should be allowed.

I think perhaps we have erred on the side of being too restrictive with our state transitions. As you say, accidentally deprecating something allows for no going back. I think I would argue that we should allow more transitions and trust users to create their own processes to properly utilize the states.

So that was all a long way of saying - yes let's allow DEPRECATED to ENABLED and also DEPRECATED to DISABLED.

@alesj @carlesarnal @jsenko thoughts?

@EricWittmann EricWittmann added the type/enhancement New feature or request label Jul 31, 2020
@carlesarnal
Copy link
Member

carlesarnal commented Jul 31, 2020

I'm not a big fan of allowing this kind of transitions but, if we do so, once we have authentication/authorization I would suggest restricting this kind of transitions (especially the DEPRECATED to ENABLED one) to concrete roles.

@EricWittmann
Copy link
Member

That's a good idea. We should start a document around Registry roles and what those roles have permission to do.

@EricWittmann
Copy link
Member

Fixed by PR #783

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants