feat(glossary): version glossary terms and keep the latest visible version current
Merged
MA
1mo ago+4316+4316+0123456789012345678901234567890123456789-119-119-012345678901234567890123456789
Summary
Glossary terms can now be versioned, and the latest version of a versioned entity stays a visible one.
- Glossary term versioning:
glossaryTermgets theversionPropertiesaspect, andGlossaryTermimplementsSupportsVersions. GlossaryTerm.statusis 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:
LifecycleVersionSideEffectruns onStatuswrites. When the latest version enters a stage withhideInSearch, 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.VersionPropertiesSideEffectno 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.yamlv3). They are written withCREATEandIf-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
- #20630 Authorize and validate
setLifecycleStage - #20631 Glossary term versioning and default glossary stages š this PR
- #20632 UI: change stage, new version, badges
- #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-coreandmetadata-service/factoriestest 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
- The PR conforms to DataHub's Contributing Guideline (particularly PR Title Format)
- Tests for the changes have been added/updated
- Docs: Updating DataHub entries; the user guide is in the last PR of the stack
š¤ Generated with Claude Code