Skip to content

Fixes #37818: Glossary terms declare their own typed properties and values - #37819

Open
harshach wants to merge 34 commits into
mainfrom
agent/can-we-come-up-with-a-good-d
Open

harshach wants to merge 34 commits into
mainfrom
agent/can-we-come-up-with-a-good-d

Conversation

@harshach

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #37818

A glossary term can now declare typed properties (text, number, date, boolean, enum, url) and store values for them in its own JSON. Terms below it inherit each property and its value, and can set their own value or an explicit empty one. Custom properties and extension do not change: they extend the glossaryTerm type for every term, while these properties belong to one term and its subtree.

The branch has two commits:

  • docs(glossary): design glossary term properties adds the design doc, the decision record ADR:2026-11-12-glossary-terms-declare-their-own-properties-and-values, and a v2 amendment of ADR:2026-10-17-glossaries-do-not-own-ontology-models. Term properties are governance metadata, not ontology definitions, so the retired attributes fields stay retired.
  • feat(glossary): add properties to glossary terms adds the schema, the server rules, the permission, the UI and the tests.

Type of change:

  • New feature

High-level design:

Design doc: docs/plans/2026-11-12-glossary-term-properties.md (8 diagrams, backward compatibility and the delete and move cases).

Model. glossaryTerm gains propertyDefinitions (at most 50 per term), propertyValues (Map<String, List<String>> of lexical strings, where [] means "no value here") and effectiveProperties, which is computed on read and never stored. It is returned only when fields names it. A term's effective properties are its own definitions, then the inheritable definitions of its ancestors, nearest first. Each carries declaredBy, inherited, values and valuesFrom. A page of terms loads all their ancestors in one query.

Rules (in the pure classes under service/glossary/):

  • Values are checked against the XSD datatype with Jena; enum values must be allowed; url must be absolute http or https.
  • Names are unique ignoring case across a term and its inherited properties, with no shadowing (409).
  • A datatype never changes (400). Removing an enum value that is in use, or narrowing multiValued, returns 409 and names up to 20 terms.
  • Deleting a property or turning its inheritance off removes the values stored below in one set-based statement by fqnHash prefix (MySQL JSON_REMOVE, Postgres #-), soft-deleted terms included, with no version bump on the descendants.
  • A move by PATCH, moveAsync or CSV that would leave a value without its property returns 409 before anything changes.
  • A term's property JSON is capped at 256 KiB.
  • GET /v1/glossaryTerms/{id}/propertyDefinitions/{name}/impact counts the terms that store a value, with a sample of 20, so the UI can warn before a delete.

PUT follows the extension rule: an omitted field keeps the stored value, a sent value replaces it, and a bot PUT merges and never removes. The schemas use "default": null so an omitted field stays null in Java.

Permissions. A new EditGlossaryTermProperties operation covers both fields through mapEntityFieldOperation. It is granted by policy rules, implied by EditAll, and an explicit deny beats EditAll. No default role gets it, so no migration. Approval workflows hold property edits, because both fields are in workflowTriggerFields.json.

Not projected. The search index and the glossary RDF projection leave the three fields out, per ADR:2026-10-17.

UI. The Overview tab gets a Properties section above Synonyms: type icon, value, a source badge ("Defined here", "↳ declaring term", "Overridden here") and actions to edit, reset an override or delete with an impact count. The Add property dialog picks the type from icon cards and locks it after creation. The create-term form lists the inherited properties, lets the user override their values and declare new ones. The terms table gets a Properties column, and the header Add menu gets a Property item.

Backward compatibility. All fields are optional and new. Existing terms, clients and the CSV format are unchanged. A PUT from an older client that omits the fields keeps them.

Alternatives rejected (recorded in the ADR): reusing custom properties or entity_extension, a separate critical-data-element entity, a glossary-level property set, and custom properties scoped to terms.

Tests:

Use cases covered

  • A term declares properties of each type, and its descendants see them with declaredBy and valuesFrom.
  • A child overrides an inherited value, clears it with [], and the grandchild inherits the override.
  • Invalid values, unknown keys, a datatype change and a 256 KiB overflow return 400; a name clash, removing an enum value in use, narrowing multiValued and an invalid move return 409.
  • Deleting a property or turning inheritance off removes the values below, on MySQL and Postgres, including soft-deleted terms.
  • PUT keeps omitted fields, replaces sent ones, and a bot PUT never removes.
  • Permissions: no grant (403), default Data Steward (403), a role with only EditGlossaryTermProperties (allowed, but displayName 403), EditAll (allowed), an explicit deny over EditAll (403 for properties only), no view access (403 on the impact endpoint).
  • An Enforce approval workflow holds a property PATCH and opens one task.
  • CSV export and re-import keep the fields, and a CSV move that breaks the rules fails.
  • Listing 5 and 50 terms with fields=effectiveProperties runs the same number of SQL statements.

Unit tests

  • Unit tests for the new logic: GlossaryTermPropertyValuesTest, GlossaryTermPropertyResolverTest, GlossaryTermPropertyRulesTest, GlossaryTermPropertyChangeTest (77 tests with GlossaryModelBoundaryTest, all pass after merging main).
  • UI Jest: the GlossaryTermProperties components, the utils, useGlossaryTermPropertyPatch and the changed glossary components (44 suites, 543 tests pass after merging main).

Backend integration tests

  • GlossaryTermPropertiesIT, GlossaryTermPropertiesAccessIT, GlossaryTermPropertiesApprovalIT (@Isolated), with fixtures in GlossaryTermPropertyFixtures. Impact-map entries added.

Before merging main: GlossaryTermProperties*IT 42 tests, 0 failures on -Pmysql-elasticsearch and 42 tests, 0 failures on -Ppostgres-opensearch.
After merging main: the backend builds and the 77 unit tests pass. The integration tests were not rerun after the merge, because the local Docker engine is not compatible with Testcontainers. The merge-queue run covers them.

Ingestion integration tests

  • Not applicable (no ingestion changes; Python models regenerate from the schemas).

Playwright (UI) tests

  • playwright/e2e/Pages/GlossaryTermProperties.spec.ts: add, edit, override, reset and delete on the term page; the create form with an inherited override and a new property; keyboard type selection; a user with only EditGlossaryTermProperties versus a view-only user.

13 passed, chromium, against a local MySQL + Elasticsearch stack built from this branch before the merge of main (an earlier run passed 11/11 twice with --repeat-each=2).

Manual testing performed

  1. Built the branch, started MySQL, Elasticsearch and the server under their own compose project, and the UI dev server against it.
  2. Created glossary Applications with Application > Payments > Card authorization and Application > CRM, using every datatype, an inheritable-off property and overrides at two levels.
  3. Checked the resolved properties of Card authorization through the API and on the term page, overrode and reset a value, added a property from the dialog, and created a child term that overrides an inherited value.

UI screen recording:

Pending. This PR stays a draft until the recording is uploaded.

Checklist:

  • I have read the CONTRIBUTING document.

  • My PR title is Fixes <issue-number>: <short explanation>

  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.

  • I have commented on my code, particularly in hard-to-understand areas.

  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. No migration: every new field is optional, and the new operation is in no default role.

  • For a UI feature or feature task: as part of PR creation, I ran the PR build in Docker with sample data and embedded a verified GitHub-hosted recording plus build/health evidence above (or explained why this requirement is not applicable).

  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.

  • Decision check: ADR:2026-11-12-glossary-terms-declare-their-own-properties-and-values records the model, the limits and the PUT and permission rules.

  • The issue properly describes why the new feature is needed, what's the goal, and how we are building it.

  • I have updated the documentation.

  • I have added tests around the new logic.

@harshach harshach added the safe to test Add this label to run secure Github workflows on PRs label Nov 15, 2026
@harshach
harshach marked this pull request as ready for review November 15, 2026 17:43
@harshach
harshach requested review from a team as code owners November 15, 2026 17:43
@harshach
harshach requested review from karanh37 and mohityadav766 and a balanced review from Copilot November 15, 2026 17:43
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 15, 2026 17:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@mohityadav766 mohityadav766 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a lost-update case in the property patch builders that can delete another editor's additions.

@harshach
harshach force-pushed the agent/can-we-come-up-with-a-good-d branch from 2bd14b7 to 17386aa Compare December 4, 2026 21:08
Add the design for glossary term properties. A glossary term declares
typed properties and their values in its own JSON. Child terms inherit
a property and its value unless the term overrides it. Custom properties
and extension do not change.

Deleting a property, or turning its inheritance off, removes the values
stored for it below the declaring term in the same transaction. A
datatype never changes after it is declared. A change to allowed values
that would break a stored value, and a move that would leave a value
without a property, return 409.

Record the decision, and amend
ADR:2026-10-17-glossaries-do-not-own-ontology-models to allow term
properties as governance metadata, not ontology definitions.
A glossary term declares typed properties (text, number, date,
boolean, enum, url) and stores values for them in its own JSON, as
propertyDefinitions and propertyValues. Terms below it inherit each
property and its value, and can set their own value or an explicit
empty one. GET returns the resolved effectiveProperties when fields
asks for them, nearest declaring term first.

The server checks values against the XSD datatype, keeps names unique
across a term's inherited properties, and rejects a datatype change.
Deleting a property or turning its inheritance off removes the values
below in one set-based statement on MySQL and Postgres. A change to
allowed values that would break a stored value, and a move that would
leave a value without a property, return 409. A new impact endpoint
counts the terms that store a value before such a change.

PUT follows the extension rule: an omitted field keeps the stored
value, a sent one replaces it, and a bot PUT never removes. Editing
needs the new EditGlossaryTermProperties operation, granted by policy
rules and implied by EditAll. Approval workflows hold property edits
like other term edits.

The term page shows a Properties section on the Overview tab with type
icons, source badges, overrides and reset. The create form lists the
inherited properties, lets the user override them and declare new ones.
The terms table gains a Properties column.
- The stale-patch retry takes propertyDefinitions and propertyValues
  from the fresh copy. The server omits an emptied list, so spreading
  the fresh copy kept the stale list and the retry failed until the
  budget ran out.
- The header's Add > Property item is gated on the term's deleted
  state, as the Properties section already was.
- The decision record states the client's index-guard protocol and its
  retry budget of 3. The constant's comment named the server as the
  rebuilder; the client rebuilds.
Glossaries declare properties that apply to every term in them, and
term definitions keep the inheritable switch. Definitions inherit;
values do not, so each term shows only its own values. Four generic
operations (CreateProperty, EditProperty, DeleteProperty,
EditPropertyValues) replace EditGlossaryTermProperties. Adds markdown
and entityReference datatypes and required properties enforced on
every write. Domain-scoped tiers, provenance and a Settings-based setup
are deferred.
… change

A same-session edit replays the term update towards the pre-session version and back. The
property purge and required checks ran on every replay, so the replay against the old version
removed values below the term, and a child edited twice in a session was checked against a
version that predates a newly required property. Only the first pass now checks and purges.

The impact endpoint for a term now counts the owning term, which a required value or a deletion
also reaches.
A glossary edited twice in one session no longer wipes the term values of a property the first
edit added: the glossary updater runs the property checks and purge on the first pass only, as the
term updater does, and later passes only record changes, so a property deleted and redeclared in
one session is no longer checked against the pre-session version. The property update runs before
a rename so it reads the terms under the old name.

A patch operation counts as a definition edit by where it writes, so a copy out of a definition
into another field needs that field's operation. Reference values are filtered for the term list
and search, loaded in one batch per page, and createMany needs CreateProperty for declared
definitions. A PUT returning what the caller was shown restores hidden ids in stored order before
authorization, a whole-document replace patch keeps them, and a single-valued value the caller
sets replaces a hidden one. Empty value lists are not stored, change sets leave properties
alone, and deleting a property from the UI no longer sends a value removal.
…ues out of responses

A patch of a glossary or term is authorized for its properties by what it changes in them. The
repository applies the patch to the stored entity and requires CreateProperty, EditProperty and
DeleteProperty for the definitions that differ by name, and EditPropertyValues when the values
differ, on top of the operations of the other locations the patch names. propertyDefinitions and
propertyValues are registered as fields authorized by change, so their locations map to no
operation of their own and a patch that also edits another field needs both sets. REST, MCP and
bulk edits share the check, and a glossary or term created with definitions needs CreateProperty
in the repository as well.

A patch runs on the term as its author was shown it: without the reference values the author may
not view, the change descriptions and the effective properties. The repository stores the
difference between the stored term and the result, with the ids the author was not shown back
where they are stored. An index, a test and a copy then mean what the author saw, a value that is
not a list is a 400, and returning the shown values changes nothing. This replaces the rewriting
of each patch operation.

Change descriptions and stored versions name only the reference values the caller may view, on
get, list, search, PATCH and PUT responses, the version endpoints and the MCP entity tools. A term
that deletes its own property records the value it loses.
…, edit and export as before

A term with no definitions, values or properties in scope now reads with no
effectiveProperties instead of an empty list, so a client that never uses
properties sees the same shape as before the feature.
…es column and the Data Steward role end to end
… its delete test

The delete response now passes through the view filter, which reads the resource's entity class.
The static Entity mock returned null for it.
…hout properties

The UI wrote the first definition or value as the whole propertyDefinitions list or
propertyValues map. JSON Patch add replaces an existing member, so a second editor
working from the same empty copy erased the first editor's property or value, and no
test operation caught it.

The server now patches an absent property container as empty, and the UI always
appends a definition or sets a single value key.
…ole document

A patch at the root, or with no string path, writes the custom property values too, so
it now also needs ViewCustomFields (ADR:2026-12-03-custom-property-values-need-view-custom-fields).
Locations that only resemble a property field still need EditAll alone.
The rebase onto main kept default-value and reset-to-inherited-value in de-de.json after
the branch had removed them from en-us; yarn i18n removes them.
@harshach
harshach force-pushed the agent/can-we-come-up-with-a-good-d branch from 17386aa to 232f8af Compare December 4, 2026 21:38
…ld term label

The term page's Add menu names the item "Child term" with a description line since the
property UI, not "Glossary Term".
@gitar-bot

gitar-bot Bot commented Dec 6, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🔴 High risk 3 closed / 3 findings

Glossary property deletion and inheritance changes purge descendant values, risking stored-data integrity by erasing metadata across a term subtree.

Adds typed properties to glossary terms, with values inherited by descendant terms and a dedicated EditGlossaryTermProperties permission. Three earlier findings were resolved: stale-patch retries no longer drop fields the fresh copy omits, the client retry budget and index-guard protocol are now recorded, and the Add > Property header item is hidden on deleted terms. No issues found.

✅ 3 closed
✅ Bug: Stale-patch retry keeps old fields when fresh copy omits them

📄 openmetadata-ui/src/main/resources/ui/src/hooks/governance/glossary/useGlossaryTermPropertyPatch.ts:75-84
When a guarded patch gets a 400, the hook fetches a fresh copy and merges it with current = { ...current, ...fresh }. The server drops empty property containers: storageJsonNode removes them and normalizeEmptyProperties sets them to null. So if another user deleted the last definition or cleared every value, fresh has no propertyDefinitions/propertyValues key, and the spread keeps the stale lists. The rebuilt patch still points at entries that no longer exist. It fails with 400 again, and the hook repeats this until the retry budget runs out and shows an error toast, even though a correct patch could be built. Assign the two fields from fresh explicitly so a missing field becomes empty.

✅ Quality: Client retry budget and index-guard protocol are not recorded

📄 openmetadata-ui/src/main/resources/ui/src/utils/governance/glossary/GlossaryTermProperties.constants.ts:57-58 📄 openmetadata-ui/src/main/resources/ui/src/hooks/governance/glossary/useGlossaryTermPropertyPatch.ts:39-43 📄 docs/decisions/2026-11-12-glossary-terms-declare-their-own-properties-and-values.md
The UI addresses definitions by index, guards each one with a JSON Patch test on its name, and on a 400 rebuilds the patch from a fresh copy up to PROPERTY_PATCH_MAX_RETRIES = 3 times. This retry budget is a judgment call and a client/server contract, but neither the new ADR nor the plan states it. The plan never mentions retries. The constant's comment is also wrong: it says "The server rebuilds a stale definition-index patch at most this many times", but the client does the rebuilding. The record would assert: "The UI edits term property definitions by index guarded with a test on the name, and on a 400 it rebuilds the patch from a fresh copy at most 3 times." Add that rule to ADR:2026-11-12-glossary-terms-declare-their-own-properties-and-values and correct the comment.

✅ Quality: Header permission flags ignore deleted, so Add > Property shows on deleted terms

📄 openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryHeader/GlossaryHeader.component.tsx:613-614 📄 openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryHeader/GlossaryHeader.component.tsx:715-728
The changed line derives canEditGlossaryTermProperties with getDerivedPermissionFlags(permissions) and does not pass selectedData.deleted. On a soft-deleted term, the header's Add menu therefore still offers "Property", which the properties widget itself hides (it passes glossaryTerm.deleted). The UI permissions rule says to always pass deleted when the entity can be soft-deleted. Pass selectedData.deleted here. If the existing flags must stay ungated for restore, derive a separate gated set.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Glossary terms declare their own typed properties and values

3 participants