feat(glossary): version glossary terms and keep the latest visible version current

Merged
MA
1mo ago
+4316-119

Summary

Glossary terms can now be versioned, and the latest version of a versioned entity stays a visible one.

  • Glossary term versioning: glossaryTerm gets the versionProperties aspect, and GlossaryTerm implements SupportsVersions.
  • GlossaryTerm.status is now mapped in GraphQL. The field was declared but never set, so a term's lifecycle stage was always null.
  • createGlossaryTermVersion (wired when entity versioning is on) creates a new term and links it to the previous term's version set, creating the set when the previous term is not versioned yet. By default it copies the previous version's metadata. When a DRAFT stage applies to glossary terms, the new version starts in DRAFT, so the previous version stays the latest until the new one is published.
  • Effective latest: LifecycleVersionSideEffect runs on Status writes. When the latest version enters a stage with hideInSearch, it is demoted and the newest visible sibling is promoted. A version that returns to a visible stage is re-promoted when it is the newest visible one. It exits without extra reads unless the stage changed. VersionPropertiesSideEffect no longer re-promotes a version in a hidden stage.
  • Deleting a version first unlinks it from its version set, so "latest" moves to the next version. Before, the set kept pointing at the deleted term and the remaining versions stayed hidden from search.
  • Version search scopes to the version set's entity type when the caller gives no types.
  • Default glossary stages: bootstraps Published, Draft, In Review, Rejected, Deprecated, and Archived for glossary terms (lifecycle-stages.yaml v3). They are written with CREATE and If-None-Match: *, so a stage that already exists under the same URN (for example one created from the previous commented-out examples) is left as is.

Stack

  1. #20630 Authorize and validate setLifecycleStage
  2. #20631 Glossary term versioning and default glossary stages šŸ‘ˆ this PR
  3. #20632 UI: change stage, new version, badges
  4. #20633 Business Glossary guide

Origin

Ported from DataHub Cloud: acryldata/datahub-fork#9192 (glossary term versioning, LifecycleVersionSideEffect), acryldata/datahub-fork#13510 (createGlossaryTermVersion), acryldata/datahub-fork#13480 (unlink on delete), and the glossary stages from the Cloud lifecycle-stages.yaml. Left out: versioning for glossary nodes (nothing uses it), stages for Cloud-only entity types, and the Cloud-only aspects in the not-copied list.

Testing

  • CreateGlossaryTermVersionResolverTest, LifecycleVersionSideEffectTest, VersionPropertiesSideEffectTest, EntityVersioningServiceTest (glossary cases), BootstrapMCPUtilTest (stages are create-only).
  • Full datahub-graphql-core and metadata-service/factories test suites pass.
  • Smoke: test_glossary_lifecycle_stages (bootstrapped stages, search visibility, review and rejection paths), test_glossary_versioning, test_effective_latest_versioning, test_glossary_term_new_version.

Checklist

šŸ¤– Generated with Claude Code