Skip to content

Draft Artifact State doesn't behave as expected #6079

@wolfchimneyrock

Description

@wolfchimneyrock

We expected to be able to use the new Draft state introduced in #5330 in order to provide a mutable "dev" registry for our users, however as implemented this won't work for us:

Actual behavior

  1. draft artifacts are assigned a fake random content hash, so that hash-based lookups don't work
  2. GET /ids/... calls are explicitly blocked
  3. content rules are explcitly not evaluated

this prevents us from exposing draft-mode to our users who may want to test deployments of their application without quickly burning through artifact version numbers:

  1. producer applications that register their schema at runtime always register a new version content when using draft mode, even if a version with the same content already exists in the registry, due to the mangled contentHash. With distributed systems this quickly leads to a id# explosion, and breaks many users expectations that the newest version registered is actually the most recently updated schema.
  2. consumer applications that fetch by contentId fail to see the version since the contentId lookup is explicitly blocked.

Expected behavior

  • Draft versions should be created with their actual content and canonical sha256 hashes so that lookups by hash succeed and ifExists=FIND_OR_CREATE_VERSION returns the existing version instead of creating infinite new versions with the same content.
  • I see there is a unique constraint on the content table contentHash. attempts to update a version's content to some content that already exists elsewhere would fail in order to maintain that uniqueness.
  • GET /ids/... should successfully return draft state contents
  • if the latest version of an artifact is in draft state, then any calls to create the artifact with ifExists=FIND_OR_CREATE_VERSION with some before unseen content could just mutate that latest draft version's content instead of creating a new version
  • content rules should be evaluated when trying to create draft versions

maybe this different behavior could be behind a config? though I don't see any potential use with Draft mode as-is with fake hashes, since you can't actually run applications against it.

Description

Registry
Version
: 3.0.6
Persistence type: postgresql

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions