World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.
Design: Business Glossary
| Version | Author | Date | Status |
|---|---|---|---|
| 0.7 | Qi Yu | 2026-11-13 | Draft |
Background
Gravitino knows where data lives: catalogs, schemas and tables. With Domains (apache/gravitino#13867), it also knows the business area of the data. But it does not know what a business word means. Words like "Active Customer" or "Net Revenue" are defined in wikis and BI tools. Each user and each agent maps the word to tables and metrics in its own way. Nobody owns the definition.
A business glossary solves this. It is a managed list of terms. Each term has a definition, synonyms, an owner and a status. Terms are grouped by domain and by a parent-child hierarchy. A term is linked to the columns, tables and metrics behind it. An agent can look up a word from a question, find the approved term, and follow its links to the data.
The glossary is built in two steps. Step 1 is this design: terms, relations, bindings, status, privileges on the metalake, APIs and agent lookup. Step 2 adds review of changes, version history and grants on domains. Implementation Steps lists what each step contains.
Goals
- Term object: a
GlossaryTermunder the metalake. It has a name, definition, synonyms, owner, status, domains, documentation links, properties and an optional source reference. There is no glossary container. Domains and the term hierarchy group the terms. Terms can carry tags through the existing tag APIs. - Hierarchy: a term can have several broader (parent) terms, in any domain. Narrower (child)
terms come from the other side.
RELATEDlinks two terms both ways. The server rejects cycles. - Bindings: a term can be linked to catalogs, schemas, tables, views, columns, filesets, topics and models (where the data is), and to semantic-model metrics (what is computed from it). Column bindings in Step 1 support table columns only; views themselves can be bound. A term lists its objects, and an object lists its terms. A binding never gives access to data.
- Domains: a term belongs to zero or more domains. A domain is optional when a term is created. In Step 1, domains group and filter terms. Read and content-edit access still depend on metalake definition privileges and term ownership. Domain administrators control membership.
- Status:
DRAFT,APPROVEDorDEPRECATED. New terms areAPPROVED. Anyone who can edit a term can set its status, in the create or update call. There are no transition rules. Glossary queries for agents return only readableAPPROVEDterms. Step 1 has no approval decision;APPROVEDmeans available for agent use. - Privileges:
VIEW_DEFINITION,CREATE_DEFINITIONandMANAGE_DEFINITIONS, granted on the metalake. CREATE permits creation and maintenance of own terms; MANAGE permits reading, editing and deleting any term, without an approval role in Step 1. Drafts are visible only to their owner with CREATE and to MANAGE. Deny wins over allow. REST and MCP use the same rules. - Revisions: every content change increases the revision number of the term, and is audited. There are no content snapshots and no history API in Step 1.
- APIs: REST, Java and Python clients, read-only MCP tools, events and audit. A normal term view or question lookup needs one or two REST calls. Larger binding lists use bounded pages, and an agent can continue reading them without treating an incomplete list as complete.
Non-Goals
- Approval workflow, version history and grants on domains: these come in Step 2 (see
Implementation Steps). In Step 1, edits take effect at once. Step 2 plugs in through
TermChangeHandler(see Status and versions). - CSV import/export in Step 1, external connectors and SKOS export: Step 1 provides APIs and a source reference for future importers. CSV is retained as Step 2 task S2.6, not dropped from the feature plan. External connectors and SKOS export remain later work.
- Ranked, fuzzy or semantic lookup in Step 1: Step 1 only matches names and synonyms exactly
(ignoring case and extra spaces). This is enough for words that the glossary defines. Better
matching can come later without an API change:
matchedBycan get new values (for exampleFUZZYorSEMANTIC) and a score, andresolve_business_termkeeps the same input and output. - Access through terms: a term or a binding never gives or blocks access to data. Terms have no policies.
- Agent writes and the UI itself: the new glossary MCP tools are read-only. The UI uses the REST API. Web UI support lists the calls for each part of the page.
Delivery Scope and Tracking
This is a design PR. T1–T19 describe future implementation work, not runtime functionality delivered by merging this document. Issue #14238 also lists design requirements assigned to Step 2, including CSV import/export. The scope is:
| Requirement in #14238 | Step 1 design | Later work and tracking |
|---|---|---|
| Terms, explicit domain membership, hierarchy, asset/metric bindings, REST, clients and exact MCP lookup | Covered by this document and T1–T19; membership uses selected Option A | Step 2 extends the same identities and live store |
| Definition grants on domains | Metalake grants only | S2.3: domain grants and inherited authorization |
| Version snapshots and history | Revision and audit only; no snapshots | S2.2: approved snapshots, history and diffs |
| Independent review and no self-approval | No review; default APPROVED and immediate edits | S2.1: proposed changes, reviewer authorization and no self-approval |
| CSV import/export | No CSV endpoint or format; APIs and source references are prerequisites only | S2.6: a separate CSV design and implementation task |
Until the remaining design requirements are accepted or explicitly split into linked follow-up
issues, #14238 remains open. The PR description should use Related to #14238, rather than
Fixes #14238. The S2 task IDs below track the deferred scope locally; they are not GitHub issue
numbers. Filing the follow-up issues and linking them from #14238 is still a separate step.
CSV remains planned, with its scope tracked in S2.6.
Usage Scenario
An admin with
MANAGE_DEFINITIONSon the metalake andMANAGE_DOMAINon Sales creates termCustomerin Sales. New terms areAPPROVED, so users withVIEW_DEFINITIONcan see it at once.An analyst with
CREATE_DEFINITIONon the metalake createsActive Customerwith statusDRAFT, so agents do not use it yet. Its broader term isCustomerand its synonym isactive user. The analyst links it to columndw.sales.customers.is_active(Implemented by).When the definition is ready, the analyst sets
Active CustomertoAPPROVED. The analyst owns this term, so the analyst can edit it and set its status. The analyst cannot editCustomer.The owner of semantic model
dw.sales.sales_modellinks its metricactive_customerstoActive Customer. The term now shows the metric under Used by.A user asks an agent for "net revenue from VIP active users last month". The agent picks the business words and calls
resolve_business_term(["net revenue", "VIP", "active user"])once:active userreturnsActive Customer(matched by synonym), with its column and metric.net revenuereturnsNet revenue, with its metric. The result only contains what the user can read.VIPhas no match. The agent asks the user what VIP means. It does not guess a column.
Then the agent loads the table or the semantic model with the existing tools. The full flow is in Agent integration.
Later the term is replaced. The owner or the admin can set it to
DEPRECATED, and agents stop seeing it. The admin can delete it in any status; deprecation is optional before deletion.
Design
Data model
GlossaryTerm { id, name, definition, synonyms[], status: DRAFT | APPROVED | DEPRECATED,
links[{label, url}], sourceRef?, properties, currentVersion, audit_info }
// tags: the existing tag relation tables
TermRelation { fromTermId, toTermId, type: BROADER | RELATED, audit_info }
TermDomain { termId, domainId, audit_info } // Option A in Domain membership
TermBinding { termId, targetId, targetType, audit_info }
TermVersion { termId, version, state, snapshot, audit_info } // Step 2 only; schema defined then
| Table | Unique key | Other index |
|---|---|---|
glossary_term_meta |
(metalake_id, name_key, deleted_at), (metalake_id, source_ref, deleted_at) |
|
glossary_term_synonym |
(term_id, synonym_key, deleted_at) |
(metalake_id, synonym_key, deleted_at) |
glossary_term_rel |
(from_term_id, to_term_id, rel_type, deleted_at) |
(to_term_id, rel_type) |
domain_member_rel |
(member_type, member_id, domain_id, deleted_at) |
(domain_id, deleted_at, member_type, member_id), (metalake_id, deleted_at) |
glossary_term_binding |
(term_id, target_type, target_id, deleted_at) |
(target_type, target_id) |
- The tables are added to the H2, MySQL and PostgreSQL schemas and to the
upgrade-1.3.0-to-2.0.0scripts. - Normalized key:
key(s)trimss, turns each run of spaces into one space, and lower-cases it (Locale.ROOT). Names, synonyms and lookups all usekey(), so they compare the same way. - Names are unique in a metalake by
name_key = key(name). SoChurnandchurnare the same name on every database. Responses return the name as the user typed it. Names follow the tag and domain rules: up to 128 Unicode code points, and.and/are allowed (/URL-encoded in paths). AddGLOSSARY_TERMtoMetadataObjects' single-level name types, soa.bremains one term name in the owner and tag APIs rather than becoming parentaand nameb. - Synonyms are stored one per row, with
synonym_key = key(synonym). Two terms can share a synonym. A synonym cannot be the name of another term. The server checks this in both directions: when a synonym is added, and when a term is created or renamed (400). Create, rename and synonym changes take the same per-metalake hierarchy lock before checking (see Locking). - Documentation links (a label and a URL) are shown on the term page. URLs must be absolute
httporhttpsURLs with a host, with the scheme compared without regard to case. Reject malformed URLs and other schemes, includingjavascript:,data:andfile:, with 400. Validate the parsed URI rather than a text prefix, on create andupdateLinks; the UI also escapes labels and URL attributes when rendering. Links are stored in a JSON column ofglossary_term_meta; no query reads inside them. - Source reference is optional. When set, it is unique in the metalake. It records where an
imported term came from, in the form
<system>:<id>, for exampledatahub:urn:li:glossaryTerm:Customer. A new import can then update the term instead of creating a copy. A term without a source reference was created in Gravitino. - Input bounds: a synonym has at most 128 Unicode code points and a term has at most 100
synonyms. A definition has at most 16,384 UTF-8 bytes. A non-null
sourceRefhas at most 128 Unicode code points. Reject over-limit values with 400 before writing; never truncate them. Apply the same bounds to create, alter and future imports. Storesource_refas nullableVARCHAR(128)with exact, case-sensitive comparison. Under utf8mb4 its maximum key payload is 512 bytes; with two BIGINT key columns the composite payload is 528 bytes, avoiding a prefix index or a dependency on the 3072-byte MySQL index limit. MetadataObject.Type.GLOSSARY_TERMis added for owners, tags, events and audit. Privileges cannot be granted on a single term: the role APIs reject them.- Terms, relations and bindings are not cached. Owner-based glossary authorization resolves the
current term ID, owner and IDs of the authenticated principal's groups from the store for each
request; it does not reuse shared name-to-ID or owner caches for that decision. Group membership
comes from the authenticated principal, following the platform's credential freshness rules;
Gravitino does not store user-to-group membership. Request-local deduplication is allowed.
Other role/grant checks retain the platform's existing consistency. The same uncached ownership
decision applies to generic owner-transfer authorization for
GLOSSARY_TERM; a former owner cannot regain ownership through a stale owner cache on that route.
Relations
BROADERis stored on the child. A → B means "A is a kind of B". Narrower terms are not stored; the server finds them from theBROADERrows.RELATEDis stored once per pair (withfrom_term_id < to_term_id) and shows on both terms.- Setting the broader or related term of A only changes A. The caller needs the edit privilege on A and read access to the other term, including its draft visibility check (see Access control).
- Cycle check: adding A → B fails with 400 if B already reaches A through
BROADERlinks. The server walks up from B, level by level, under the hierarchy lock (see Locking). A term cannot be its own parent. - Depth limit: a
BROADERchain has at mostLlinks, whereLis the release depth-limit constant inGlossaryManager. A new link that makes a chain longer fails with 400. This bounds the cycle check and the hierarchy read. 20 is the provisional value; T18 in Testing selects the final release value. Boundary tests use the loaded limit, not the provisional number. - No overlap: two terms cannot be
RELATEDif one is an ancestor of the other. Adding such aRELATEDlink, or aBROADERlink that creates such a pair, fails with 400. This follows the SKOS rule. For a newRELATEDpair, check ancestry in both directions. Before adding A → B, collect A and all its descendants, and B and all its ancestors. Reject the link if anyRELATEDpair crosses these two sets, regardless of how that pair is stored. For example, X → A, B → Y and XRELATEDY make A → B invalid. Walking only upward from B misses X. Both walks and the pair check run under the hierarchy lock, with visited IDs deduplicated across each walk. An alter validates its complete proposed relation graph before committing. - No recursive SQL: the walk runs in code, with one batched query per level. The backend still
supports MySQL 5.7, which has no
WITH RECURSIVE. - A hierarchy read returns all ancestors or all descendants of a term. There are no cycles, so the walk always ends.
- Deprecating a term does not change its children. Deleting a term removes its links. Each child
that loses a parent, and each surviving term that loses a
RELATEDlink, gets one revision increment and its own audit record in the cleanup transaction (see Status and versions). The child keeps its other parents, or becomes a top-level term.
How other systems store term relations:
| System | Where relations are stored | Parents per term | Cycle check |
|---|---|---|---|
| DataHub | a list of outgoing links on the source term | one term group | not documented |
| OpenMetadata | one shared relation table for all entities | one | tree, so not needed |
| Apache Atlas | edges in a graph database | many (isA) |
self-link only |
| Gravitino Domain | DomainRel { parentId, childId } edge table |
one, one level | not needed |
| This design | glossary_term_rel edge table, like DomainRel |
many, any depth | yes, under a lock |
All of them store one direction and derive the other. The only new part here is many parents at any depth. That is why this design needs the cycle check and the hierarchy lock.
Domain membership
A term belongs to zero or more domains. In Step 1 the definition privileges are granted on the metalake only, so a domain groups and filters terms but does not change who can see or manage them. In Step 2, domains also become the scope of grants (see Implementation Steps). Then membership decides who manages a term. Decision: Option A, explicit relations, decided in review. Step 1 and Step 2 use this single membership source. Backing tags (Option B) are retained under Alternatives Considered, not as an implementation prerequisite.
Selected design: explicit relation (Option A)
- Use the shared
domain_member_reltable for explicit membership. Rows storeid,metalake_id,domain_id,member_typeandmember_id, plus common store metadata. Each row references a real Domain and a member in the same metalake. Glossary usesGLOSSARY_TERMand the stable term ID. Term reads, writes and cleanup match both member type and ID. - The term API changes memberships through
domainson create,addDomain,removeDomainand the Domain detach endpoint. All changes go throughTermChangeHandler. - Creating a term with Domains or changing membership in an alter requires the usual term
create or edit authority and effective
MANAGE_DOMAINon each changed Domain. In Step 2, adding a membership also requiresCREATE_DEFINITIONon the destination Domain. - In Step 1, a Domain administrator with effective
MANAGE_DOMAINmay explicitly detach a named Term without term edit permission. The operation changes only the named membership. An effective detach advances the term revision once and records the actor. A missing membership is a no-op. In Step 2, the review workflow applies before any detach takes effect. - Terms of a domain (
GET /terms?domain=) use the same scope as the Domain design: terms in the domain, and terms in its subdomains that the caller can see. - Domains in a response: every
TermDTO.domainscontains only domains the caller can see through the ordinary domain-read check (USE_DOMAIN). Apply this to direct gets, list and lookup results, nested terms, and create/alter responses. A readable term remains readable even if some or all of its domains are hidden; its returned domain list can be empty. Filtering a response never changes stored membership or reveals a hidden-domain count. DomainManager#deleteDomainchecks authorization and requires aDRAFTDomain with no subdomains. An authorized drop of aPUBLISHEDDomain returns400and asks the caller to unpublish it. After the existing checks pass, check the shared table under the same Domain lock. A remaining live member of any type causes409 NonEmptyDomainException.- Clearing a non-empty domain: the
409response tells the administrator to detach the remaining members explicitly. It reveals that at least one member exists without returning names or counts. With effectiveMANAGE_DOMAIN, the administrator can use the sharedGET /domains/{domain}/definition-memberslist to find direct members. The list includes hidden drafts and returns onlytypeand the currentnameper live member. Term content reads use the Glossary definition permissions. An absent Term or membership gets the same success response as an effective detach. In Step 2, proposed detachments must be approved before the Domain can be dropped. - Descriptive tags on terms use the existing tag APIs and
APPLY_TAG. A tag on a term never changes its domains, even when the tag backs a domain.
Rationale for Option A. Most reasons are about Step 2:
- In Step 2, the domain decides who can read and manage a term. For an asset, being in a domain
gives nobody any permission. That is why the Domain design lets anyone with
APPLY_TAGadd an asset. It is also why the Domain design does not allow access grants on domains. Terms are the opposite case: in Step 2, the grants on a term's domains decide who can see, edit and approve it. With Option B, adding a tag would change these permissions. - Tag permissions go to other people. In the Domain design, admins give
APPLY_TAGon a domain's tag to the owners of the tables in that domain. With Option B in Step 2, any of these table owners could move a term into the domain. The domain admins would then control the term. Or the term would be hidden from a role that the domain denies. One tag cannot allow this for tables and forbid it for terms. - The benefits of tags do not apply to terms. The Domain design uses tags for three things:
inheritance from catalogs and schemas, tag-based policies, and the existing tag checks. Terms
are not under a catalog or schema. Terms have no policies. And in Step 2 terms need stricter
checks than
APPLY_TAG. - Permissions do not change by accident. With Option B, replacing or deleting a domain's tag silently removes its terms. In Step 2, who can see or edit them changes, but nobody edited a term. With Option A, membership changes only through the term API. It is checked and audited like any other term edit, and in Step 2 it is reviewed.
- Smaller change to the Domain design. Option A adds one check when a domain is dropped. Option B makes terms taggable, adds a member type, and adds term-only rules to the shared tag code.
The cost: the terms of a domain are listed by GET /terms?domain=, not by
GET /domains/{domain}/objects. Both use the same rules: a term can be in several domains, and a
domain includes its subdomains.
Bindings
A binding links a term to the data behind it. A term page shows two kinds of bindings. An object page shows the terms linked to the object.
| Kind | Meaning | Targets | Example |
|---|---|---|---|
| Implemented by | The object stores or computes the term | CATALOG, SCHEMA, TABLE, VIEW, COLUMN, FILESET, TOPIC, MODEL |
Customer is implemented by table sales.public.customers and column customers.customer_id |
| Used by | A semantic-model metric is built from the term | METRIC, identified by its existing metric_id |
metric net_revenue uses Net revenue and Order |
Column scope in Step 1: COLUMN means a table column. Resolve its identity as
catalog.schema.table.column, using the table and column IDs, and authorize through that table.
The endpoint fence is metalake -> catalog -> schema -> table, followed by the existing column
identity check. Table alteration fences column changes and cleans up removed-column bindings;
renames retain bindings when the platform retains the registered IDs. External-table column
identity has an existing concurrent load/alter limitation: a stale catalog snapshot can turn a
rename into drop/add and lose the column ID and its bindings, as with column tags. This is tracked
by #14279; binding endpoint fences alone do
not solve it. Step 1 inherits this limitation rather than adding a separate column-identity
protocol. Until that fix is available, avoid concurrent loads/alters during column rename and
verify bindings afterwards. A COLUMN lookup whose parent resolves only as a view returns 404;
do not reinterpret a view as a table. View-column bindings are outside Step 1. Binding a view
itself remains supported, but children=true on a view returns 400.
Both kinds are stored in glossary_term_binding, using the target's own stable ID:
target_typeidentifies one of the eight Implemented by asset types, orMETRICfor Used by. This is a binding-specific type; it does not addMETRICtoMetadataObject.Type.target_idis the asset's ID, the stable column ID forCOLUMN(not a version-row ID), or the existingsemantic_model_metric_meta.metric_idforMETRIC. It is never the containing semantic-model ID for a metric binding. The containing table or semantic model is resolved from the target identity for authorization, endpoint locking and cleanup.- All columns of
(term_id, target_type, target_id, deleted_at)areNOT NULL, withdeleted_at = 0for a live row. This key prevents duplicate bindings on H2, MySQL and PostgreSQL without nullable fields, empty-string markers or metric names in the key. - REST and client inputs still identify a metric by semantic model and exact metric name. The
server resolves that input to a live metric ID before binding. Responses resolve the ID back
to its current model/name; the existing
TermBindingDTOand MCP argument shapes are unchanged.
A binding is direct only: binding a table does not bind its columns. glossary_term_rel stores
term-to-term relations; glossary_term_binding stores term-to-asset and term-to-metric bindings.
- There is no semantic view type in Gravitino. A semantic view from another system (for example Snowflake) is stored as a semantic model, so its metrics use Used by.
One write endpoint, two ways to be allowed
Bindings are written on the object, the same as tags and policies:
POST /objects/{type}/{fullName}/terms, or POST /objects/semantic_model/{fullName}/metrics/{metric}/terms
for a metric. Two kinds of people know about a binding:
- the object admin knows what the object means;
- the term owner knows which data implements the term.
Both can write bindings. The server checks each term in the request separately:
| Caller | Needs | Terms allowed |
|---|---|---|
| Object admin | Admin privilege on the object, and VIEW_DEFINITION on the term |
APPROVED only |
| Term editor | Edit privilege on the term, and read access to the object | Any status, so a draft can get its bindings early |
- Admin privilege on an object:
- tables and columns: the existing
MODIFY_TABLE_AUTHORIZATION_EXPRESSION(owner of the table or of a parent, orMODIFY_TABLEwithUSE_CATALOGandUSE_SCHEMA); - views: the existing
VIEW_OWNER_AUTHORIZATION_EXPRESSION(owner of the view or of a parent); - metrics:
MODIFY_SEMANTIC_MODEL_AUTHORIZATION_EXPRESSION; - other types have no modify privilege, so the caller must own the object or one of its parents (metalake, catalog, schema).
- tables and columns: the existing
- The endpoint checks the object once, and then checks each term in the request body in code.
A missing or hidden term returns 404 before checking its status. For a visible term, allow the
term-editor path in any status, even when the caller is also an object admin. Otherwise, an
object admin can use only
APPROVEDterms; another status returns 400. A caller satisfying neither authorization path gets 403. Failure on any term rejects the whole request and changes nothing. Removing a binding uses the same checks as adding it. - Each changed term gets a new revision and goes through
TermChangeHandler. So the Step 2 workflow can hold a binding change, like any other term change. - Binding a missing object or metric fails with 404. Binding any other object type fails with 400. The status restriction on the object-admin path applies only after term visibility is checked and only when the term-editor path does not allow the operation.
- When a term is deprecated later, it keeps its bindings. It no longer shows in lookups or glossary MCP results.
Reads
GET /terms/{term}/objects?kind=IMPLEMENTED_BY|USED_BY&types=lists the bindings of a term. It first checks read access to the root term, then returns only objects and metrics the caller can access (filterMetadataObject). A table column requires read access to its table. A metric requires read access to its semantic model.GET /objects/{type}/{fullName}/termsandGET /objects/semantic_model/{fullName}/metrics/{metric}/termsfirst authorize reading the target using its ordinary metadata-read expression, then list only terms the caller can see. For COLUMN, authorize its table; for a metric, authorize its semantic model and verify the metric exists. Glossary VIEW or MANAGE never replaces target access. Insufficient target read access returns 403, and a missing target returns 404, with no terms, child names or counts in the error. Check target access before enumerating children or reading their bindings. ReuseLOAD_TABLE_AUTHORIZATION_EXPRESSIONfor tables and table columns,LOAD_VIEW_AUTHORIZATION_EXPRESSIONfor views,LOAD_SEMANTIC_MODEL_AUTHORIZATION_EXPRESSIONfor models' metrics, and the existing load expression for each other supported type.?children=trueon a table or semantic model also returns the terms of each table column or metric that has readable terms. A schema tab or a metric table then loads in one call, not one call per column. On the server it is one query onglossary_term_binding, by the table and its column IDs. For a semantic model, resolve its live metric IDs in a batch and query bindings withtarget_type = METRICand those IDs; do not query one metric at a time. Other types, including VIEW, rejectchildren=truewith 400. Views still support listing their own terms with no children.
Cleanup
- Dropping an object soft-deletes its bindings. This happens in the same places that clean up
tag_relation_meta(by object, schema, catalog and metalake). Renames keep bindings when their registered IDs are preserved, subject to the external column-identity limitation above. - Removing a registered column, whether through
alterTableor a later load's local column reconciliation, soft-deletes its bindings in that local store transaction. - Metrics already have internal IDs. When a semantic model is altered, clean up bindings by
target_type = METRICand the retired metric IDs. Reuse the existing metric identity lifecycle: content edits and semantic-model renames preserve a metric ID; removing a metric retires its ID. A metric rename is currently removal of the old name and addition of the new name, with a new ID: its old bindings are removed and must be linked again. Reintroducing a removed name also gets a new ID and must not revive old bindings. The cleanup writes one audit record per affected term, listing its ID and name, the semantic-model ID and name, the retired metric IDs and names, the triggering alter operation and the resulting term revision. This also applies to metric removal without a rename; bindings are never silently transferred to a new identity. - Every surviving term that loses bindings gets one revision increment in the same transaction as the local registered-object change and binding cleanup, even if it loses several bindings. Unaffected terms do not change. The transaction locks affected term rows in ID order before deleting bindings (see Locking). Failure rolls back local object/column state, bindings, revisions and successful cleanup audit records together. Managed metric changes are local store changes and use this atomic boundary.
- External catalog boundary: Hive/JDBC and other external DDL can finish before the local store update. A failed local cleanup cannot undo that external change. Keep the platform's existing DDL response conventions, including best-effort local updates where already used; do not add a distributed transaction or a new partial-response protocol for glossary. Record a failed cleanup with the operation, registered target identity and cause, without a false cleanup-success record. Neither an external DDL success nor an error proves that the local bindings were cleaned up; callers must reload/inspect state before deciding what to do next, and must not blindly replay non-idempotent DDL. Loading an existing external table can reconcile removed columns and run the local cleanup, but this is not guaranteed recovery: a failed local table drop followed by a false external drop can leave a stale registration. External systems without a persistent source identity can also make same-name recreation indistinguishable from the old registration. These are existing catalog recovery/identity limits; Step 1 adds no general automatic repair service. Such cases require operator verification and repair. Never restore lost bindings by guessing names; when an identity is retired, cleanup uses that ID and a new identity needs explicit binds.
Status and versions
The following status table and immediate-update rules describe Step 1. Step 2 publication and pending-content rules are specified separately below.
| Status | Who can see it | Who can delete it |
|---|---|---|
DRAFT |
owner with CREATE_DEFINITION, or MANAGE_DEFINITIONS; not MCP |
MANAGE_DEFINITIONS |
APPROVED (default) |
VIEW_DEFINITION; MCP also requires this privilege |
MANAGE_DEFINITIONS |
DEPRECATED |
VIEW_DEFINITION; not MCP |
MANAGE_DEFINITIONS |
- Status is an ordinary field in Step 1. It is set in the create request (default
APPROVED) or withsetStatusin the update request. Anyone who can edit the term can set it: the owner withCREATE_DEFINITION, orMANAGE_DEFINITIONS. There are no transition rules and no separate status endpoint. - What
APPROVEDmeans in Step 1: the term can be used by agents. It does not mean that a reviewer accepted it. Creation defaults to this status and makes the term immediately visible to callers with read access. Content edits to anAPPROVEDterm also take effect immediately. An owner with CREATE can explicitly create a draft, or set any status on an existing own term; MANAGE can do the same for any term. Neither action is an approval decision or requires a reviewer in Step 1. Step 2 introduces review separately. - Delete requires
MANAGE_DEFINITIONSin every status, includingAPPROVED. Being the owner with CREATE never permits deletion, even after changing a term back toDRAFT. Deprecation before deletion is optional. MANAGE is an administration privilege in Step 1, not an approval privilege. - Why three states: each term is used on its own.
DRAFTkeeps a term out of approved-only glossary queries while it is written. Bindings and people keep using a term after it is replaced, soDEPRECATEDkeeps it readable, which a delete cannot do. In Step 2,APPROVEDalso records that a reviewer accepted the term. A domain or an ontology (#14310) is published as a whole and has no review per item, soDRAFT/PUBLISHEDis enough there. - Term reads apply the same definition authorization (REST, clients, MCP); the new glossary
MCP tools additionally exclude non-
APPROVEDterms. Ordinary Term lists omit hidden terms, and direct gets return404. Nested results also omit hidden terms, includingbroader,narrowerandrelatedterms and the terms of an object or Domain. - Known leaks: hiding a term does not make it secret. A user can still find out that it exists
through a same-name create (409), a synonym equal to its name (400), or dropping a draft Domain
that contains hidden member terms (409). The drop response discloses only non-emptiness.
For membership cleanup,
GET /domains/{domain}/definition-membersreturns the type and name of direct members, including hidden draft Terms, to callers withMANAGE_DOMAIN. Reading the Term itself still requires the usual Glossary permissions. Lookup-work errors expose a coarse cost limit being reached, but return no exact candidate or hidden counts. Binding-page continuation also reveals that a scan may have more work, not that another authorized binding exists. This is not a claim that errors, cursors or timing reveal nothing about query complexity. - Revision: each change to the name, definition, synonyms, links, properties, relations,
domains, bindings or status increases
current_versionby one, in the same transaction. Responses return it asversion, so a client can see that a term changed after it read it. They also return an opaquerevisionTokenidentifying the metalake, term ID and revision for conditional editing. A newly created term has a new token even if its name and revision equal those of a deleted term. Owner and tag changes are only audited. - No effective change: a successful alter, bind/unbind or cleanup that leaves the effective
term state unchanged does not increase its revision and does not emit a change-success event
claiming a new revision. Compare persisted field values and normalized synonym keys, treating
relation/membership sets and property maps without regard to order. A rename also compares its
stored display name: a case-only display change is effective even when
name_keyis unchanged. Documentation-link order is preserved. A mixed alter with effective changes increments once; repeated add/remove operations and setting a field to its current value increment zero. - Cleanup revisions: deleting a term, object, column or metric also increments each surviving
term that loses a broader relation, a
RELATEDrelation or a binding. Each affected term gets exactly one increment per cleanup transaction, regardless of the number of removed rows, and an audit record of the losses with its resulting revision. A change to a derivednarrowerlist alone does not increment the parent, just as adding or removing a broader relation only changes the child. Terms deleted in the same transaction need no increment. No-op cleanup changes no revisions; failed cleanup commits neither losses nor revision increments. These are required cleanup effects, applied with the endpoint deletion rather than left pending for review in Step 2. - No snapshots in Step 1: the audit log holds the change record. There is no history API.
Do not create
glossary_term_version_infoin Step 1. Step 2 designs its snapshot format and creates it through that release's upgrade scripts. A revision is not an approved version. - Workflow hook:
GlossaryManagersends every change to aTermChangeHandler: content, status, relations, domains, and both binding paths. The default handler applies the change at once. In Step 2, a review handler keeps the proposed change apart from the live tables until it is approved. - Step 2 publication: new terms default to
DRAFT; a create request specifying another initial status is rejected. A create request or ordinary update, includingsetStatus(APPROVED), cannot publish a term without review. This applies to CREATE, MANAGE and the metalake owner; publication requires an explicit approval decision on a submitted proposal by another principal. A request that tries to publish directly is rejected, rather than silently treated as approved. No initial-status setting may bypass this rule. - Step 2 live and pending content: an edit to an approved term creates proposed content; its existing approved version and bindings remain live for ordinary readers and agents until approval. Pending content is visible only to the current owner with effective CREATE, or to an authorized MANAGE reviewer. Being a former owner or the submitter does not independently grant continued read access. Proposal status is separate from the live term's status. Rejection leaves the approved version unchanged; approval replaces it.
- Dropping a term soft-deletes its synonyms, relations, domain links and bindings in the same
transaction; Step 2 also cleans up its version rows once that storage exists. Dropping a
metalake soft-deletes all its glossary rows in
MetalakeMetaService#deleteMetalake, next to the tag cleanup.
Access control
In Step 1, the three privileges are granted on the metalake:
| Action | VIEW_DEFINITION |
CREATE_DEFINITION |
MANAGE_DEFINITIONS |
|---|---|---|---|
Read APPROVED and DEPRECATED terms; look up words |
✓ | ✓ | ✓ |
| Create a term (the creator becomes the owner) | ✓ | ✓ | |
See own DRAFT terms |
✓ | ✓ | |
See other users' DRAFT terms |
✓ | ||
| Edit, bind and set the status of own terms, in any status | ✓ | ✓ | |
| Edit, bind and set the status of any term | ✓ | ||
| Delete any term, in any status | ✓ |
MANAGE_DEFINITIONSincludesCREATE_DEFINITION, andCREATE_DEFINITIONincludesVIEW_DEFINITION. The names are general, so other business-definition objects can use them too.- Owner versus any term:
CREATE_DEFINITIONlets a user write and maintain their own terms.MANAGE_DEFINITIONSlets an admin read, edit, bind, set the status of and delete any term, including other users' drafts. It is not limited to list and delete. Ordinary VIEW callers can also list terms, subject to visibility; MANAGE additionally exposes all statuses in its authorized scope. Ownership means the current owner, including group members, not necessarily the original creator. Changing status is an ordinary edit in Step 1; CREATE and MANAGE have no separate approval capability. Step 2 adds submission and review, including reviewer authorization and no self-approval. - Ownership transfer: new requests that begin after an owner transfer commits must use the new owner on every server. The glossary owner path bypasses shared ownership/name caches and reads current ownership and resolves the principal's user/group names to current store IDs. Writes recheck that ownership in their write transaction. A request already authorized before the transfer commits may complete. External group-membership changes take effect when reflected in the authenticated principal; an otherwise valid token retaining an old group claim may still authorize its holder until credential refresh or expiry. Bypassing owner caches does not revoke such credentials or change unrelated platform role/grant cache consistency.
- Read privilege on a term:
VIEW_DEFINITIONforAPPROVEDandDEPRECATED; forDRAFT,MANAGE_DEFINITIONS, or being the owner withCREATE_DEFINITION. CREATE alone gives no access to another owner's draft. Apply this rule to direct gets, lists and every nested term result. - Edit privilege on a term, used by Relations, Domain membership and Bindings:
MANAGE_DEFINITIONS, or being the owner withCREATE_DEFINITION. - Delete privilege on a term:
MANAGE_DEFINITIONSonly, independent of status or ownership. - Registration: three new
Privilege.Namevalues. In Step 1 theircanBindToacceptsMETALAKEonly. The role APIs return 400 when these privileges are granted on any other object, or when anything is granted onGLOSSARY_TERM. Step 2 addsDOMAIN. - Deny works as for other privileges. Expand grant implications and apply explicit denies to each required capability. Ordinary Term operations require effective VIEW. Creating requires effective CREATE; editing uses effective MANAGE or the owner-with-effective-CREATE path; deleting requires effective MANAGE. A deny on MANAGE removes the all-term path, but leaves effective CREATE usable on own terms. The metalake owner always passes these privilege checks; Step 2 workflow conditions still apply.
- Domain management: the Domain definition member list and Step 1 detach use only the
Domain management check. Both require effective
MANAGE_DOMAINon the requested Domain. - Bindings are written on the object, by the object admin (
APPROVEDterms only) or by the term editor. See Bindings. - Owner (a user or a group), set through
/owners/glossary_term/{term}. When a group owns a term, all its members count as the owner. Transfers retain the existing owner API's current-owner or metalake-owner checks. MANAGE_DEFINITIONS and MANAGE_GRANTS do not replace that check. For glossary terms, resolve ownership from the store rather than shared owner/name caches. - Create needs
CREATE_DEFINITIONon the metalake, andMANAGE_DOMAINon each Domain in the request. The creator becomes the owner. - Implementation: add shared glossary authorization checks for effective VIEW, CREATE and
MANAGE on the metalake, and for reading, editing and deleting a term using the rules above.
REST endpoints and request-body checks use these same checks. Do not use
JcasbinAuthorizer#hasMetadataPrivilegePermissionas the term-edit check: it controls managing grants and ownership, not glossary content. Owner-transfer and role-grant APIs retain their existing authorization; MANAGE does not grantMANAGE_GRANTS. In Step 2, aTermScopeResolveradds the domains of a term, and their parents, as more levels of the glossary checks.
Step 2: MANAGE retains administration and adds review
The three privilege names and their implications are retained. CREATE remains the contributor capability; MANAGE remains the administrator capability and additionally authorizes approval and rejection. MANAGE does not become an approval-only privilege.
| Privilege | Step 1 | Step 2 |
|---|---|---|
VIEW_DEFINITION |
Read visible published terms; no draft access | Read authorized APPROVED/DEPRECATED live terms; no draft or proposal access |
CREATE_DEFINITION |
Create and maintain own terms; changes take effect immediately | Create drafts, maintain own content and submit changes; cannot approve |
MANAGE_DEFINITIONS |
Read all statuses, create, edit, bind, set status and delete any term | Retain management, inspect pending changes, and approve or reject another principal's submission |
- Scope: Step 1 grants are metalake-wide. In Step 2, all-term administration and review mean all terms in the caller's effective authorized scope. A domain grant does not confer metalake-wide rights; S2.3 defines domain inheritance and deny handling. Glossary MANAGE still grants neither access to bound assets nor permission to administer role grants.
- No workflow bypass: ordinary edits, binding changes and requested deletion follow the Step 2 review workflow, even when submitted by MANAGE. Required cleanup after endpoint deletion remains the exception described in Cleanup revisions. Ownership, domain ownership and metalake ownership do not waive the workflow or the no-self-approval rule.
- No self-approval: the approval endpoint checks effective MANAGE for the proposal's scope and rejects approval by the authenticated principal that submitted it. Owner/group membership or an additional role does not turn that principal into a different reviewer. A MANAGE user's own submission needs another authorized MANAGE reviewer; an installation with only one such user cannot approve that user's submissions. Editing submitted content requires a new submission with its own recorded submitter and content revision; approval refers to that submitted revision, not mutable content attributed to an earlier submitter.
- PRD alignment: the enterprise prototype separates
MODIFY_GLOSSARYandAPPROVE_GLOSSARY; neither implies the other. This design deliberately combines all-term administration and review in MANAGE while keeping own-term contribution in CREATE. It does not offer an independent all-term editor without approval rights, or an approval-only role. Those roles would require a later privilege split rather than being claimed as supported by these three privileges.
Locking
Before writing, plan the locks for the whole request, including every update in an alter and every relation and domain in a create. Acquire their union using the existing store tools, always in this order:
- the live-endpoint fence (
LiveEndpointService.lockLiveEndpoint, shared): the metalake, plus the chain of the bound object when binding; - the per-metalake hierarchy lock, if needed;
- term rows, in ID order (exclusive);
- domain rows (shared).
Each row is locked only once, in its final mode. Do not process updates one by one and acquire a hierarchy lock after a term lock. Once locked, reread and validate the current state, apply all updates in one transaction, and hold the locks until commit or rollback. If a reread shows that the plan needs an earlier lock or an additional term row that would break ID order, roll back and rebuild the plan before writing.
In Step 1, Term creation with Domains, addDomain, removeDomain and explicit detach all
recheck MANAGE_DOMAIN in the write transaction for each affected Domain after locking it.
Use each Domain's current parent relationship to evaluate inherited privileges, as in existing
Domain mutations. Apply changes only after all checks pass and hold the locks through commit.
| Operation | Locks | Conflict it prevents |
|---|---|---|
| Create, including initial relations and domains | metalake (shared) -> hierarchy lock -> referenced terms (exclusive, ID order) -> domains (shared) | name/synonym conflict; invalid relations; endpoint drop |
| Rename or change synonyms | metalake (shared) -> hierarchy lock -> term (exclusive) | name/synonym conflict; concurrent edits |
| Edit content or status, or change Domain membership | metalake (shared) -> term (exclusive) -> changed Domains (shared) | concurrent edits; endpoint drop |
| Add or remove a relation | metalake (shared) -> hierarchy lock -> all referenced terms (exclusive, ID order) -> changed Domains (shared), if any | a cycle or overlap; endpoint drop; mixed alters |
| Bind / unbind | object chain (lockLiveEndpoint, shared) -> terms (exclusive, ID order) |
object drop; concurrent term edits |
| Delete a term | metalake (shared) -> hierarchy lock -> deleted and affected surviving terms (exclusive, ID order) | new links; lost cleanup revisions |
| Object, column or metric cleanup | endpoint locks in the deleting or altering operation's final mode -> affected surviving terms (exclusive, ID order) | new bindings; lost cleanup revisions |
For an alter that combines rows of this table, use the union of locks in the global order. For
example, rename plus addBroader plus addDomain takes the metalake fence, hierarchy lock, the
edited and referenced terms in ID order, then the added domain rows. Create with relations locks
the existing referenced terms before inserting the new term and its relations. Relation cleanup
finds the affected surviving terms after taking the hierarchy lock; binding cleanup finds them
after taking the endpoint deletion or alteration locks, which must exclude concurrent binding
writes. A metalake drop deletes all its terms, so there are no surviving terms to increment.
- The hierarchy lock is a
SELECT … FOR UPDATEon one row per metalake inglossary_hierarchy_lock. The row is inserted on first use. Locking only the two terms is not enough. Example: A → B and C → D are added at the same time, then B → C and D → A. Each link passes its own check, but together they form a cycle. Every relation change and term delete takes this lock. Every create, rename and synonym change also takes it, so checking names inglossary_term_metaand synonyms inglossary_term_synonymcannot race. These writes run one at a time per metalake; other content edits do not take this lock. - Throughput trade-off: creates, renames and synonym changes serialize per metalake even when they concern unrelated names. Step 1 accepts this simple invariant-preserving protocol. S2.6 imports must use bounded batches rather than assuming parallel creates scale within one metalake. T18 measures contention as well as hierarchy checks. A per-key lock is deferred; introducing it would need a common ordering across every affected old/new name and synonym.
- Name/synonym checks and hierarchy walks run after the lock is taken and read the latest committed state, including a transaction that committed while this request waited for the lock. They must not reuse an earlier transaction snapshot or a MyBatis cached result. If a term was deleted before the lock was taken, the server sees that when it locks the term row, and returns 404.
- For operations by name, the server finds the row by name, locks it, and then checks the name and
deleted_atagain. If they changed, it returns 404. The unique key on the name protects concurrent creates (409).
REST API
All paths are under /api/metalakes/{metalake}. They follow the Tag, Policy and Domain APIs:
- a top-level
/termscollection (there is no glossary container, so no/glossarylevel); ?details=on lists;PUTwith a list of updates to alter, including the status;DropResponseon Term deletion;- bindings are written on the object.
| Operation | Endpoint | Request -> response |
|---|---|---|
| List, filter, match | GET /terms?details=&domain=&status=&nameContains=&match=&bindings= |
-> NameListResponse / TermListResponse |
| Create | POST /terms |
TermCreateRequest -> TermResponse |
| Get | GET /terms/{term}?status= |
-> TermResponse |
| Alter | PUT /terms/{term} |
TermUpdatesRequest -> TermResponse |
| Drop | DELETE /terms/{term} |
-> DropResponse |
| Detach from a Domain | DELETE /terms/{term}/domains/{domain} |
No body -> 200 with code: 0 |
| List Domain members | GET /domains/{domain}/definition-members |
limit, offset -> members, hasMore |
| Hierarchy | GET /terms/{term}/hierarchy?direction=BROADER|NARROWER&status= |
-> TermTreeResponse |
| Bindings of a term | GET /terms/{term}/objects?kind=&types=&status=&pageSize=&pageToken= |
-> TermBindingListResponse |
| Terms of an object | GET /objects/{type}/{fullName}/terms?details=&children=&status= |
-> NameListResponse / ObjectTermsResponse |
| Bind / unbind | POST /objects/{type}/{fullName}/terms |
TermsAssociateRequest{termsToAdd, termsToRemove} -> NameListResponse |
| Terms of a metric | GET /objects/semantic_model/{fullName}/metrics/{metric}/terms?details=&status= |
-> NameListResponse / TermListResponse |
| Bind / unbind a metric | POST /objects/semantic_model/{fullName}/metrics/{metric}/terms |
TermsAssociateRequest -> NameListResponse |
| Owner | existing /owners/glossary_term/{term} |
|
| Tags | existing /objects/glossary_term/{term}/tags |
The Domain asset browser (GET /domains/{domain}/objects?types=) applies Domain visibility
and asset-read checks. The definition member list uses a separate route because its Domain
management check permits returning the type and name of hidden draft members for cleanup.
On a Domain page, clients can use /domains/{domain}/objects?types=TABLE to show readable
tables and /domains/{domain}/definition-members in the administrator's membership view to
find direct Term and Article members to detach.
For the Domain definition member list and Step 1 detach, resolve the Domain and check
MANAGE_DOMAIN before looking up members. A successful detach, missing Term or absent
membership all return HTTP 200 with {"code":0}.
The Domain definition member list uses limit=20 and offset=0 by default, with limits
from 1 to 1,000 and nonnegative offsets. Resolve live names from domain_member_rel by member
type and ID, and page by (member_type, member_id) after excluding retired members.
TermCreateRequest { name, definition, synonyms, status?, domains, broader, related, links,
sourceRef, properties }
TermUpdatesRequest { expectedRevision?, updates: [rename, updateDefinition, setStatus, addSynonym, removeSynonym,
addDomain, removeDomain, addBroader, removeBroader, addRelated,
removeRelated, updateLinks, setSourceRef, setProperty, removeProperty] }
TermDTO { name, definition, synonyms, status, domains, broader, narrower, related,
links, owner, sourceRef, properties, version, revisionToken, audit,
matchedBy?: [{word, field: NAME | SYNONYM}],
bindings?: [TermBindingDTO], bindingsTruncated? }
TermBindingListResponse { bindings: [TermBindingDTO], nextPageToken? }
TermBindingDTO { kind: IMPLEMENTED_BY | USED_BY, object: MetadataObjectDTO, metric? }
ObjectTermsResponse { terms: [TermDTO], children: [{ name, terms: [TermDTO] }] }
TermsAssociateRequest { termsToAdd: [name], termsToRemove: [name] }
- Status filtering on reads:
statusis optional on the term collection, get, hierarchy, term-binding and reverse object/metric GET endpoints. With no filter, return any term the caller is allowed to read. With a filter, apply both authorization and that status to all terms: roots, list items,broader,narrower,related, hierarchy nodes and terms inside object/metric responses. A named root that is hidden, missing or in another status returns 404, including on/terms/{term}/objects, even though that response contains only bindings. A list omits nonmatching terms; a hierarchy stops at each nonmatching or hidden node and does not traverse through it. An invalid status returns 400. Read root status and response data from one consistent database snapshot, using one query or a read transaction for multiple queries. Do not check status in a separate request and then fetch unguarded bindings or relations. This requires no write locks; each response reflects its read snapshot, and later requests can observe subsequent status changes. - Domain filtering on responses: every occurrence of a term uses the domain visibility rule in Domain membership, including terms embedded by hierarchy, object and metric endpoints.
- List is used both to browse and to look up words:
domainreturns the terms of the domain and of the subdomains the caller can see.nameContainsfinds names that contain the text, ignoring case. It is for search boxes.matchlooks up business words: onematchper word, up to 20. Each word is looked up on its own, and a term is returned when it matches any word (OR). The server compareskey(word)withname_keyandsynonym_key. Each returned term hasmatchedBy. Withstatus=APPROVED, a word that only matchesDEPRECATEDterms returns nothing.bindings=trueadds at most 20 authorized bindings per term. Apply target-read authorization before the limit: collect up to 21 visible bindings, return the first 20, and setbindingsTruncatedonly when a 21st visible binding exists. Hidden bindings do not consume the result limit or affect the flag. Candidate scanning is nevertheless bounded: examine at most 1,000 binding candidates per term and 10,000 authorization candidates across a lookup request, including matched terms and their projected relations/domains/bindings. Fetch in bounded batches. Hidden candidates consume this work budget, but no response exposes their count. If the budget ends before proving exhaustion or finding 21 visible bindings, fail the request with 400LookupTooBroadException; return no partial success or fabricatedbindingsTruncatedvalue. The error contains no scanned/hidden counts, term name or target identity and suggests omitting embedded bindings or narrowing the query. Within the budget, continue past hidden rows rather than treating a candidate batch as the visible limit.bindings=truerequiresmatchanddetails=true; withbindings=false, return matched definitions and omit the optional binding fields. A normal lookup needs one REST call.- Why not a separate path like
/terms/resolve? It would clash with a term namedresolve. So lookup is a filter of the list.
- Alter applies all updates in one transaction and increases the revision once only if the
effective state changes.
narroweris computed and cannot be set.versionis the current revision.updateLinksreplaces the whole link list.statusdefaults toAPPROVEDon create. - Terms of an object:
children=trueworks ontableandsemantic_modelafter target-read authorization. It adds one entry tochildrenfor each table column or metric with terms passing the authorization and optional status filter. A semantic model itself has no terms; only its metrics do. A view supports its own terms, withoutchildren=true. - Binding pages:
GET /terms/{term}/objectsacceptspageSize(default 100, range 1–100) and an optionalpageToken. Each page examines at most 1,000 candidates afterkind/typesfiltering, returning at mostpageSizeauthorized bindings. Use keyset order on(target_type, target_id), fetching bounded batches. Advance past examined hidden candidates, so a page can have no bindings and still havenextPageToken. Omit that token only when the scan is exhausted; a nonempty token means continue scanning, not that more visible bindings exist. Thus even 1,001 bindings of the same kind/type remain readable without an unbounded call. Recheck root status, term visibility and target access on every page; a cursor grants no access. The opaque, tamper-resistant cursor binds the metalake/term identity, revision,kind/types/statusfilters and scan position without exposing hidden target IDs or counts. Invalid cursors or changed filters return 400; a changed term identity/revision returns 409TermVersionConflictExceptionafter root authorization. Restart explicitly from the first page after a conflict; do not merge revisions. Each page uses the read snapshot described above. Target/credential changes can affect later pages, so paging does not freeze authorization. UI, clients and MCP expose the continuation; none silently drains all pages in a single unbounded call or labels a page as a complete list. - Bind / unbind use the same request format as tag association. The response is the object's terms after the change.
- Errors:
- 404:
NoSuchTermException(missing, hidden, or a named root excluded by the status filter),NoSuchMetadataObjectException; - 409:
TermAlreadyExistsException(same name or same source reference),NonEmptyDomainException,TermVersionConflictException(an authorized conditional edit or binding cursor refers to a different term identity/revision); - 400: a cycle, a term as its own parent, binding an unsupported object type, a synonym equal to
another term's name, an object admin binding a visible non-
APPROVEDterm without the term-editor path, invalidstatus,children=trueon an unsupported type, or more than 20matchvalues, invalid links, exceeded input bounds, invalid page sizes/cursors or changed cursor filters;LookupTooBroadExceptionfor the explicit lookup-work limits; - 403:
ForbiddenException.
- 404:
- Concurrency:
expectedRevisionis an optional opaque token onPUT /terms/{term}, copied from the last read'srevisionToken. Keep numericversionfor display; it alone is not a safe conditional guard because a same-name replacement starts again at version 1. If the token is omitted, apply changes to the current state with last-write-wins behavior. Otherwise authorize the caller, lock the term, and compare both identity and revision before any update or no-op detection. A mismatch returns 409TermVersionConflictExceptionwith no changes, increment or success event; malformed tokens return 400. A hidden or missing root still returns 404 before any token comparison or disclosure. Clients reload, reconcile and explicitly resubmit rather than blindly retrying a stale replacement list. A matching no-op succeeds without changing either version or token. Java/Python clients expose conditional-alter overloads; unsupported implementations fail before writes rather than ignoring the condition. Tokens are concurrency guards, not credentials. Step 2 proposals likewise record their base term identity and revision, but this optional Step 1 condition does not implement approval. - Error consumers: REST uses the existing
ErrorResponsecode/type/message shape. Java and Python clients preserve the two new typed errors; MCP reports a lookup-work failure as a tool error, never asunmatchedor an empty binding list. No client automatically retries the same expensive or conflicting request. Core/REST/client tasks add the exception mappings and tests. - Paging scope: term-binding reads use the bounded pages above because arbitrary binding fanout must remain retrievable. Other list APIs retain the existing unpaged convention; broader list/hierarchy paging is outside Step 1. Inline lookup expansion retains its separate all-or-error work budget; a lookup error is not a binding-page continuation.
- Encoding: a term name can contain
/. In{term}it must be URL-encoded as%2F, the same as domain and tag names. - Clients (Java, Python):
GlossaryOperationsonGravitinoMetalake:listTerms,listTermsInfo,getTerm,createTerm,alterTerm(also sets the status), its optional-expected-revision-token overload,dropTerm,detachTermDomain, andmatchTerms(words, domain)with an optionalincludeBindingsvariant. Lookup returns approved terms with bindings by default; callers can request definitions without binding expansion. It is also usable by agents that do not use MCP.- On a
Term:broader(),narrower(),listBindings(kind, pageSize, pageToken)returning aTermBindingPagecontaining bindings and continuation. A first-page convenience overload must return the same page type, not a plain list that silently discards the continuation. SupportsTerms(listTerms(),associateTerms(add, remove)) on catalogs, schemas, tables, views, table columns, filesets, topics and models. Tables also havelistColumnTerms(); views do not support column-term operations in Step 1.SemanticModelhaslistMetricTermsandassociateMetricTerms.
Web UI support
The table shows the REST calls behind each part of the glossary page, and of the other pages that
show terms. A term comes with its name, domains, status, version, owner, relations and links. So
the term page does not need a call per field. Binding sections load bounded pages. Edit forms
send the last read's revisionToken as expectedRevision; on conflict they reload and ask the
user to reconcile instead of silently overwriting another edit.
| Page | Part | Calls |
|---|---|---|
| Glossary | Term tree (domain › subdomain › term, narrower terms nested, No visible domain) | GET /terms?details=true and GET /domains?details=true; the tree is built from domains and broader |
| Glossary | Search terms | GET /terms?nameContains= |
| Glossary, term | Header, Definition, Details, Related terms | GET /terms/{term}; the source label is the sourceRef system, or "Gravitino" if empty |
| Glossary, term | Implemented by, Used by | GET /terms/{term}/objects?kind=IMPLEMENTED_BY, ?kind=USED_BY; follow page tokens |
| Glossary, term | Set status (immediate in Step 1; no approval decision) | PUT /terms/{term} with setStatus |
| Glossary, term | Delete term (counts only authorized relations and asset links) | DELETE /terms/{term}; binding counts require all pages, with no count shown while incomplete |
| Glossary, Add or Edit term | Name, Definition, Synonyms, Domain, Broader, Related, Documentation | POST /terms or PUT /terms/{term} with the changed fields; pickers use /domains and /terms |
| Glossary, Add term | Owner other than the creator | POST /terms, then PUT /owners/glossary_term/{term} (allowed, because the creator is the owner) |
| Explore, table | Terms N, Update terms drawer, column chips and the term filter | GET /objects/table/{fullName}/terms?details=true&children=true; POST .../terms per change |
| Explore, view | Terms N, Update terms drawer and the term filter; no view-column chips | GET /objects/view/{fullName}/terms?details=true; POST .../terms per change |
| Explore, Update terms drawer | Term picker (approved, grouped by domain) | GET /terms?details=true&status=APPROVED&nameContains= |
| Semantic model | Glossary terms of each metric | GET /objects/semantic_model/{fullName}/terms?details=true&children=true |
| Metric editor | Terms (approved only) | the picker call above; POST /objects/semantic_model/{fullName}/metrics/{metric}/terms |
| Domain, Definitions tab | Terms of the domain and its subdomains, name search | GET /terms?details=true&domain=&nameContains= |
| Define, Overview | Terms by domain, terms by status | counted from GET /terms?details=true |
This design does not cover the parts below. They need another source, or the page hides them:
- Step 2 parts: Submit for review, Reject, In review, the version diff and History, and the domain create options "Readable by all users" and "Glossary editors", which grant on a domain.
- Counts that need an aggregate query: terms without bindings, and assets without a glossary term. Also the "N restricted terms" count on an object, because it would show that hidden terms exist.
- Undefined lookups, Import, KB articles and the managing group label.
- Buttons by privilege: Gravitino has no API that tells which actions a caller can take on an object. So the page cannot disable a button in advance. It shows the 403 message instead.
Agent integration
The mcp-server/ gets a read-only glossary tool tag, added to SUPPORTED_TOOL_TAGS. All glossary
tools use GravitinoContext.rest_client() and its existing identity selection:
| Mode | Identity used for the Gravitino request |
|---|---|
HTTP with a non-empty Authorization header |
Forward that header verbatim, ahead of any configured service credential. Authentication failure does not trigger service fallback. |
| HTTP without a header, with a service identity and fallback enabled | Use the configured static --token, or OAuth client-credentials when no token is set. |
HTTP without a header, with a service identity and --no-service-identity-fallback |
Reject the tool call with ServiceIdentityFallbackDisabled before issuing a Gravitino request. |
| HTTP without a header and without a service identity | Send no authorization credential; Gravitino applies its anonymous/unauthenticated behavior. |
| stdio | Use the configured service identity, or send no credential if none is configured. The HTTP-only fallback flag does not apply. |
Authorization applies to that effective principal, with an additional APPROVED-only restriction for glossary tools. User credentials therefore limit results to the user's authorized approved terms; service-identity modes limit results to the service principal's authorized approved terms. Do not claim end-user impersonation in service or unauthenticated modes. Reuse the existing audit attribution and client isolation by identity and metalake.
The APPROVED-only restriction applies to the glossary semantic queries defined below, not to
every existing MCP tool. For example, generic list_metadata_by_tag can enumerate a DRAFT or
DEPRECATED term's name/type when ordinary term-read authorization permits it. Such discovery
does not make that term a published business definition. An agent must resolve/get it through
the glossary tools before using its definition or bindings; those tools still reject an
unapproved root. Generic tag APIs retain their existing authorization and response shapes.
End-to-end flow
Example question: "net revenue from VIP active users last month".
User question
│
▼
1 Agent (LLM) picks the business words ──▶ ["net revenue", "VIP", "active user"]
│
▼
2 resolve_business_term(words) (MCP tool)
│
▼
3 GET /terms?match=net%20revenue&match=VIP&match=active%20user
&status=APPROVED&details=true&bindings=true (Gravitino server)
│
▼
4 Result per word ──▶ "net revenue": term Net revenue, metric dw.sales.sales_model/net_revenue
│ "active user": term Active Customer, column dw.sales.customers.is_active,
│ metric dw.sales.sales_model/active_customers
│ unmatched: ["VIP"]
▼
5 Agent decides per word
├── column or table ──▶ get_table_metadata_details ──▶ write SQL
├── metric ───────────▶ load_semantic_model ─────────▶ metric query
├── other object ─────▶ the tool for that object type (for example a fileset or a model)
└── unmatched ────────▶ ask the user: "What do you mean by VIP?"
6 Agent reads data through tools with their own access checks and answers
| Step | Who | What happens |
|---|---|---|
| 1. Pick business words | Agent (LLM) | Gravitino does not parse the question; the agent does. The tool description tells it how: keep a phrase whole ("active user", not "active" and "user"); use the singular form; leave out time ranges, numbers and query words ("last month", "total", "top 10"). A question usually gives 1 to 5 words. |
| 2. Call the tool | Agent -> MCP server | One call with all the words. Add domain when the user or the context names one. |
| 3. Look up | MCP server -> Gravitino | One REST call, with one match per word. The server compares key(word) with term names and synonyms, and keeps only APPROVED terms the caller can see (and in domain, if given). It adds the bindings of each term. |
| 4. Group | MCP server | Groups the terms by the word they matched (matchedBy), and lists the words with no match in unmatched. |
| 5. Decide | Agent | One term for a word: use it. Several terms: pick one by domain, or ask the user. No term: ask the user, and do not guess a column. Then follow the bindings with the existing tools. |
| 6. Read data and answer | Agent -> existing tools | Data-access tools authenticate and authorize their own effective principals. Glossary bindings grant no additional access. The answer names the terms and definitions it used. |
How match works
- One
matchper word. One word gives onematch, three words give three. The number is not fixed. - OR, not AND. A term is returned when it matches any of the words. Each word is looked up on its own. The server never combines words: "VIP" and "active user" are two lookups, and combining their meanings in the query is the agent's job.
matchedBysays which word matched which field (NAMEorSYNONYM). So the MCP tool can put each term under the right word. If one term matches two words, it is returned once, with twomatchedByentries.- At most 20 words per call. If the agent passes more than 20 words, the MCP tool splits them into calls of 20 and merges the results, so the agent never sees the limit. A direct REST caller gets 400 and must split the words itself.
- Exact match only (ignoring case and extra spaces). "customers" does not find
Customer. That is why step 1 uses the singular form, and why admins write names and synonyms in the singular form.
resolve_business_term
- Input:
words(the business phrases from step 1), an optionaldomain, andinclude_bindings(default true). False still uses approved-only matching but skips binding expansion and omits binding fields from the result. This provides a definition-only fallback when a broad lookup exceeds its work budget, without expanding bindings in that lookup. - Output for the example above:
{
"results": [
{
"word": "net revenue",
"matches": [
{
"term": "Net revenue",
"definition": "Revenue after refunds and discounts.",
"matched_by": "NAME",
"domains": ["Sales"],
"broader": ["Revenue"],
"related": ["Order"],
"bindings": [
{"kind": "USED_BY", "type": "SEMANTIC_MODEL", "catalog": "dw", "schema": "sales",
"name": "sales_model", "metric": "net_revenue"}
],
"bindings_truncated": false
}
]
},
{
"word": "active user",
"matches": [
{
"term": "Active Customer",
"definition": "A customer with at least one order in the last 90 days.",
"matched_by": "SYNONYM",
"domains": ["Sales"],
"broader": ["Customer"],
"related": [],
"bindings": [
{"kind": "IMPLEMENTED_BY", "type": "COLUMN", "catalog": "dw", "schema": "sales",
"name": "customers", "column": "is_active"},
{"kind": "USED_BY", "type": "SEMANTIC_MODEL", "catalog": "dw", "schema": "sales",
"name": "sales_model", "metric": "active_customers"}
],
"bindings_truncated": false
}
]
}
],
"unmatched": ["VIP"]
}
- The binding fields are the same arguments that
get_table_metadata_detailsandload_semantic_modeltake. The agent can make the next call directly, with no parsing and no extra lookup. - If
bindings_truncatedis true, calllist_metadata_by_term, which accepts optionalkind,types,page_sizeandpage_tokenand returnsbindingsandnext_page_token. Continue with the same filters until the token is absent. An empty page with a token is not an empty complete result. The tool returns one page per call; it does not drain an arbitrary number of pages. If the agent stops early, it reports an incomplete list. A revision conflict requires an explicit restart, without combining pages from different term revisions. - A lookup-work error is not a successful partial result or an unmatched word. The agent may
retry with
include_bindings=falseto identify terms, then use the paged binding read, optionally filtering kind/types. With bindings disabled, omitted fields mean not requested, not that the term has no bindings. This reduces binding work but still enforces the overall lookup budget; if term/relation projection alone exceeds it, report the tool error and ask for a narrower query rather than repeating it. No fallback drops identity, domain or APPROVED filtering.
Rules in the tool descriptions, so all agents use the result the same way:
- Pass each business phrase whole and in the singular form. Leave out time ranges, numbers and query words.
- These glossary tools return only
APPROVEDterms. Discovery through a generic metadata tool does not establish that a term is published; resolve/get it here before using it. A word inunmatchedhas no authorized approved exact match in this query. Ask for clarification rather than asserting no business meaning exists. A lookup error is notunmatched; follow the definition-only/narrowed-query fallback above. - If a word matches several terms, use the domains to pick one, or ask the user.
- A binding shows where a meaning is stored. It never gives access. Reading the data still needs the normal privileges.
| Tool | REST calls | Use |
|---|---|---|
resolve_business_term |
GET /terms?match=&status=APPROVED&details=true&bindings={include_bindings} |
Map the words of a question to terms and their data |
get_term |
GET /terms/{term}?status=APPROVED |
Definition, synonyms, authorized domains and approved relations |
list_terms |
GET /terms?details=true&status=APPROVED (+ domain, name_contains) |
Browse the terms of a domain |
get_term_hierarchy |
GET /terms/{term}/hierarchy?status=APPROVED |
Find approved wider or narrower terms |
list_metadata_by_term |
GET /terms/{term}/objects?status=APPROVED&kind=&types=&pageSize=&pageToken= |
One bounded page of authorized bindings, with continuation |
list_terms_for_metadata |
GET /objects/{type}/{fullName}/terms?details=true&status=APPROVED; add children=true only for table or semantic model |
Explain an authorized object, its table columns or model metrics |
Every tool passes status=APPROVED to the server. The server applies the read contract in REST
API to the root and every nested term, including name-only relations. A direct draft or deprecated
name passed to get_term, get_term_hierarchy or list_metadata_by_term returns 404 with no term
details or bindings, even for MANAGE. Hierarchy traversal stops at an unapproved or unauthorized
node. The bindings endpoint checks root status in the same read snapshot as its payload, so a
separate preflight get followed by an unfiltered bindings request is not sufficient. Object
results enforce target-read authorization, omit filtered terms and empty children, and never
return hidden domains. The MCP server must not retry a rejected filtered request without the
status filter. With the domain tools of #13867, an agent can go from a domain to its terms, and
then to the data.
Events and audit
- Every operation sends pre, success and failure events through a
GlossaryEventDispatcher, and is written to the audit log: create, alter, status, bind and unbind, drop. When a term is dropped, each surviving term that loses a parent or aRELATEDlink also gets its own audit entry with its new revision. Object, column and metric cleanup similarly records lost bindings per surviving term. A metric rename records the old metric names and affected terms as specified in Bindings. Successful cleanup records are committed with the cleanup; rollback must not leave a record claiming that bindings or relations were removed. - A successful no-op may record an operation outcome with its unchanged revision, but must not report a new content change or a fabricated revision. Failed version checks emit no change success. This applies equally to alter, binding writes and cleanup.
Alternatives Considered
- A glossary container (
metalake.glossary.term). It adds a second way to group terms, next to domains. Then it is unclear which one controls privileges. Domains plus the term hierarchy are enough. - Domain membership through backing tags (Option B, not selected): see the alternative below.
- Terms as tags on assets.
APPLY_TAGis a different privilege from the definition privileges. Tags have no definition, relations or status. Tags can carry policies, but a binding must never change access.
Domain membership through backing tags (Option B, not selected)
How the Domain design puts a table into a domain: each domain has a tag, called its backing tag.
For example, domain Finance has tag finance. A table with tag finance is in Finance. There is
no member table: the tag alone decides it.
Option B uses the same rule for terms. Term Revenue gets tag finance, so it is in Finance.
Terms then also show in GET /domains/{domain}/objects. There is no relation table.
In Step 1 this is safe, because grants are on the metalake. The problem comes in Step 2: tags are
added with APPLY_TAG, and the Domain design gives APPLY_TAG to many table owners, so they can
put their tables into a domain. For a table this is safe, because the domain does not change who
can read the table. For a term in Step 2 it is not safe, because the domain decides who can see,
edit and approve the term:
| What happens | Result |
|---|---|
A table owner with APPLY_TAG on finance adds finance to the Sales term Customer |
The Finance admins now also manage Customer. Nobody in Sales agreed |
Someone deletes tag finance, or gives Finance another backing tag |
All Finance terms leave Finance, and who manages them changes. Nobody edited a term |
To block the first case, the tag code needs special rules only for terms: besides APPLY_TAG, the
caller also needs the edit privilege on the term and CREATE_DEFINITION on the domain behind the
tag. The second case cannot be blocked without changing how tags work.
Prior Art
- DataHub: a glossary term has a definition, owners and a source reference. Terms are grouped
in nested term groups. They have typed relations (Inherits From, Contains), and are attached to
datasets and columns. In this design, term groups become domains and parent terms. Contains
becomes
RELATED, and Inherits From becomesBROADER. - Unity Catalog: a page defines a term inside a domain. It has draft and published states, and related assets. Access comes from the domain; nobody grants access on a single page. This design never grants on a single term either. Grants are on the metalake in Step 1, and also on domains in Step 2. Unlike a page, a term can have no domain: a term used by several areas does not have to pick one.
Open Questions and Decisions
- Domain membership (decided): use explicit
domain_member_relrelations (Option A). Glossary T7 introduces the shared schema and mapper for other definition types to reuse. - Draft visibility (decided): only the owner with
CREATE_DEFINITION, or a caller withMANAGE_DEFINITIONS, can read a draft. This is fixed for Step 1 (see Access control). - Default read access: everyone should be able to read terms by default. But Gravitino has no
built-in role for all users. Should we add one (for example
PUBLIC) withVIEW_DEFINITIONon the metalake, or should admins grant it? - Two-step governance (decided): Step 1 defaults to APPROVED with immediate changes and no review. Step 2 defaults to DRAFT and adds approval/rejection to MANAGE's existing administration rights, with no self-approval or direct-publication bypass. Combining administration and review is a deliberate simplification of the PRD's independent modify and approve privileges.
Testing
This chapter defines the acceptance cases for Step 1, their invariants and release checks. General contributor workflow and test-execution policies remain in the project guidelines.
- A task is done when every case listed for it has a test, all of them pass, and the rules below hold.
- If the code and this chapter disagree, fix the code, or change this chapter in the same PR and say why in the PR description. Never change a test only to make it match the code.
- Each case has an ID, like
T5.4: the task number and the case number. Case IDs do not change. New cases get new numbers.
Rules for every test
- Trace each case. The Javadoc (or docstring) of a test names the cases it covers, for
example
Covers T5.4, T5.5.Each case ID of the task must appear in the test code. The PR checks this withgrep. - Check the exact failure. A negative test checks the exception class, or the HTTP code and the error type. "Something failed" is not enough.
- Check that nothing changed locally. After a failed glossary/store transaction, read the
term again. Its fields,
version, relations, domains and bindings must be unchanged, with no change-success event. For external DDL, separately assert its actual result and the local failure diagnostics; do not assume a database rollback undoes an external change. - Check the invariants. Every database test of the glossary calls
GlossaryInvariants.assertHolds(metalake)in@AfterEach(see Invariants). - Prove that guards work. Some cases are marked (guard). For each one, the author removes the check from the code, runs the test, sees it fail, and puts the check back. The PR description lists each guard, the check that was removed and the test that failed.
- No flaky tricks. No
@Disabled, no retries, and noThread.sleepto order threads. UseCountDownLatchorCyclicBarrier. Wrap every concurrent test inassertTimeoutPreemptively, so a hang fails the test instead of the build. Run each race at least 20 rounds. - Keep old tests. Do not change an existing test to make new code pass. If one must change, the PR description says why.
- Fixed data. Use fixed names and values. A test must not depend on the time zone, the
locale or the test order. Tests of
key()also run with the default locale set to Turkish (tr-TR), where"I".toLowerCase()is not"i". - All three databases. Database tests extend
TestJDBCBackend(@CoreBackend.All) and pass on H2, MySQL and PostgreSQL. Integration tests pass with-PjdbcBackend=h2,mysqlandpostgresql.
Invariants
GlossaryInvariants is a test helper in core/src/test. T2 adds it, and T3, T7 and T11 extend it.
For one metalake, it reads the glossary tables directly and checks the live rows
(deleted_at = 0):
- Every
name_keyequalskey(name), and everysynonym_keyequalskey(synonym). No two terms have the samename_key. - No synonym equals the
name_keyof another term. - No synonym, relation, domain link or binding points to a deleted or missing term, domain or object.
- The
BROADERlinks have no cycle. The longest chain has at most the depth limit of links. - No
RELATEDpair has one term as an ancestor of the other. EachRELATEDrow hasfrom_term_id < to_term_id. - Every binding has non-NULL
term_id,target_typeandtarget_id, and resolves to a live target of that type.METRICuses the metric's own ID, not the containing model's ID. No two live bindings have the same(term_id, target_type, target_id). glossary_hierarchy_lockhas at most one row for the metalake. Step 1 creates no version table.
Integration tests cannot read the tables. They use the REST form of the helper. It reads all terms and their hierarchies as the metalake owner, and checks rules 2, 4 and 5.
Rules the tests fix
The design does not say these things. The tests use the answers below. If a reviewer wants a different answer, change it here first.
- Order of checks: the Domain definition member list and Step 1 detach check Domain
management before resolving the member. For ordinary Term operations, if the caller cannot
see the term, 404. If the caller can see it but has no privilege for the action, 403. For
example, CREATE dropping its own term gets 403 in every
status, while MANAGE can delete it in every status. If the caller has the privilege but the
change breaks a rule, 400 or 409. Binding uses the two-path checks in Bindings: a hidden draft
gets 404; a visible
DEPRECATEDterm gets 400 through the object-admin-only path, but a term editor with object read access can bind it. - Revision: a new term has
version1. An alter adds exactly 1 only if its final effective state differs, even when it has several updates. A bind or unbind call adds 1 to each term whose bindings changed. Owner and tag changes add nothing. A cleanup transaction adds 1 to each surviving term that loses bindings, broader relations orRELATEDrelations, once per term rather than per removed row. Derivednarrowerchanges alone add nothing. No-op and failed cleanup add nothing. - Repeats are ignored: adding a synonym, link, domain or binding that already exists, or removing one that does not exist, is not an error and adds no revision. Setting a field to its stored value or an alter whose updates cancel out also adds no revision. A changed display name or reordered documentation links is effective; set/map serialization order alone is not.
- Depth is the number of
BROADERlinks on the longest chain. With loaded limitL, a chain ofL + 1terms hasLlinks and is allowed;L + 1links exceed the limit. A link joining two chains counts the links above and below it. - Hidden terms in a hierarchy: the hierarchy read stops at a term that the caller cannot see. It shows neither that term nor the terms behind it.
- Names: the server trims spaces at both ends before it stores a name or a synonym. The case is kept. An empty name, or one longer than 128 characters, fails with 400. A synonym equal to the name of its own term fails with 400.
key()treats every whitespace character (space, tab, new line) as a space.nameContainstreats%,_and\as plain characters.bindings=truewithoutmatchanddetails=truefails with 400. Its 20-binding limit andbindingsTruncatedcount authorized bindings only, after filtering target access. The independent work budget counts examined candidates, including hidden ones. Exhausting it before a complete result is known is a typed error, not a successful truncated or empty result.- The depth limit is a constant in
GlossaryManager. Manager tests can inject a test limit and run boundary cases at 10, 20 and 50. CUJ 6 reads the actual release limit without overriding it. Users cannot configure the limit. - Read status filters apply to roots and nested terms, and stop hierarchy traversal at a nonmatching node. A named nonmatching root returns 404, including on the bindings endpoint.
- Column scope is table columns only. Views have their own term bindings, but no column
operations or
children=truein Step 1.
Where tests go and how to run them
All Gradle commands below take a --tests filter for the new classes. Database and Docker runs
also need -PskipDockerTests=false and a running Docker.
| Layer | Test classes | Command |
|---|---|---|
| Storage | core/.../storage/relational/service/TestGlossaryTerm*MetaService |
./gradlew :core:coreH2Test, then coreMySQLTest, corePostgreSQLTest |
| Schema and upgrade | the existing core/.../storage/TestSQLScripts |
the same three tasks |
| Manager | core/.../glossary/TestGlossaryManager* |
the same three tasks |
| Authorization rules | server-common/.../authorization/jcasbin/TestJcasbinAuthorizer |
./gradlew :server-common:test |
| REST | server/.../web/rest/TestGlossaryOperations, TestMetadataObjectTermOperations |
./gradlew :server:test |
| Java client | clients/client-java/.../client/TestGlossary* (mock server) |
./gradlew :clients:client-java:test -PskipITs |
| Python client | clients/client-python/tests/unittests/test_glossary*.py |
./gradlew :clients:client-python:unitTests |
| MCP server | mcp-server/tests/unit/tools/test_glossary.py |
./gradlew :mcp-server:testPython |
| Integration and CUJs | clients/client-java/.../integration/test/Glossary*IT |
./gradlew :clients:client-java:test -PskipTests -PjdbcBackend=<db> |
| Performance | core/.../glossary/GlossaryHierarchyPerformanceTest |
run by hand; not part of CI |
Cases per task
T1. API
- T1.1 Each new enum, privilege and type has a
fromString/ name round trip. - T1.2
MetadataObject.Type.GLOSSARY_TERMparses names containing.,/and both as a single name with no parent. Includea.bandv1.2/Churn, and exercise the owner/tag path conversions when their REST implementations are added. - T1.3 The three new privileges accept
METALAKEincanBindToand reject every other type. (guard) - T1.4 The existing tests of
PrivilegeandMetadataObjectstill pass without change.
T2. Term storage
- T2.1 Insert, get by name, list and update a term with every field set. All fields read back the same, including links, properties and the source reference.
- T2.2
Churnexists. InsertchurnandCHURN: both fail as a duplicate. The stored name is stillChurn. (guard) - T2.3
Active Customer(three spaces),active customerandActive\tCustomerhave the same key. - T2.4 With the default locale
tr-TR,key("TITLE")istitle. - T2.5
CafeandCaféare two different terms, on all three databases. (This checks the collation of the new tables.) - T2.6 Names with
/, Chinese characters and emoji read back the same on all three databases. - T2.7 A name of 128 characters works on all three databases.
- T2.8 Two terms can have no source reference. Two terms with the same source reference fail as a duplicate.
- T2.9 Two terms can share a synonym. Each synonym is one row.
- T2.10 Soft-delete a term, then create a term with the same name. The new term has a new ID, and the old rows stay soft-deleted.
- T2.11 Drop the metalake. All glossary rows of the metalake are soft-deleted. The terms of a second metalake are not touched.
- T2.12 Garbage collection removes soft-deleted glossary rows after the retention time.
- T2.13
TestSQLScripts: the 2.0.0 schema and the result of theupgrade-1.3.0-to-2.0.0scripts have the same glossary tables, columns and keys. Running the MySQL upgrade script twice works. - T2.14 Fresh and upgraded Step 1 schemas contain no
glossary_term_version_info; ordinary create/read/alter/drop and GC do not query that future table. (guard)
T3. Relation storage
- T3.1 Insert and remove
BROADERandRELATEDlinks. List the broader, narrower and related terms of a term. - T3.2
RELATEDfrom A to B and from B to A is one row, withfrom_term_id < to_term_id. Adding the second one is a duplicate. - T3.3 Diamond: A → B, A → C, B → D, C → D. Walking up from A returns B, C and D, each once.
- T3.4 The walk sends one query per level. For a chain of 5 levels, it sends 5 queries. (Count the calls on the mapper.) (guard: a version with one query per term fails this test.)
- T3.5 The first use of the hierarchy lock inserts its row. A second use does not insert another row. Two threads using it for the first time at the same time both succeed.
T4. Manager
- T4.1 Create with only a name and a definition. Status is
APPROVED,versionis 1, and the owner is the caller. - T4.2 Create with status
DRAFTand withDEPRECATED. The status is stored as given. - T4.3 Each effective update type changes only its field and adds 1 to
version. An alter with three effective updates adds 1 in total. No effective change adds zero. - T4.4 An alter where one update fails (for example, a rename to a taken name) changes nothing. (guard)
- T4.5 B has synonym
client. Creating termClient, or renaming A toclient, fails with 400. (guard) - T4.6 Term
Clientexists. Adding synonymCLIENTto another term fails with 400. (guard) - T4.7 Adding synonym
Customerto termCustomerfails with 400. - T4.8 Empty name, a name of only spaces, and a name of 129 characters fail with 400.
- T4.9
updateLinksreplaces the whole list. A blank URL, malformed/relative URI or scheme other than http/https fails with 400; include mixed-case allowed schemes,javascript:,data:andfile:. A missing label may display the URL. Run the same validation on create. (guard) - T4.10 Rename keeps the ID, synonyms, relations, domains and bindings.
- T4.11 Race: two threads add different synonyms to the same term at the same time. Both synonyms
are stored and
versiongrows by 2. - T4.12
TermChangeHandler: a test handler records each effective change. Every effective write sends exactly one change of the right kind. A no-op creates no proposed content or new revision. A test handler that rejects the change leaves the store unchanged. - T4.13 As MANAGE, drop a
DRAFTterm. Its synonyms, relations, domain links and bindings are soft-deleted in the same transaction. - T4.14 As MANAGE, drop an
APPROVEDterm without first changing its status. It succeeds and cleans up the same rows as T4.13. Repeat with aDEPRECATEDterm. (guard) - T4.15 Race: create
Xwhile adding synonymxto another term. Exactly one succeeds; the other fails with 400, and the name/synonym invariant holds. Use two independent store sessions, hold the winning request after its checks, and assert that the other request waits on the hierarchy lock. Release the winner to commit, then check that the waiter sees its changes. Run with each request winning first, and also with the synonym supplied in a concurrent create. (guard: removing the hierarchy lock from either write lets both checks pass.) - T4.16 Repeat T4.15 with a rename to
Xinstead of a create. A rejected rename keeps the old name and revision. (guard) - T4.17 Create and alter at each input bound and one unit over it: 128-code-point synonyms and source references, 100 synonyms, and a 16,384-byte UTF-8 definition. Include multi-byte and supplementary characters. Over-limit calls return 400 with unchanged rows/revision and no silent truncation. Assert the three-backend source-reference key uses full values. (guard)
- T4.18 Two editors read the same
revisionTokenand replace documentation links with different lists, both usingexpectedRevision. One succeeds; the other getsTermVersionConflictExceptionand cannot overwrite it. Repeat with mixed updates, hidden/missing terms, malformed tokens and a stale request that would otherwise be a no-op. Drop and recreate the same name at version 1, then try the old token as MANAGE: 409 and no change to the replacement. Repeat with rename and name reuse, and with another metalake's token. A matching no-op keeps the token unchanged; omitting it retains unconditional editing. Failed checks change no rows/revisions or success events. Unsupported conditional-alter implementations fail before any write. (guard) - T4.19 Re-add an existing normalized synonym/domain/relation, remove an absent member, set a field to its current value, and apply updates that cancel out. All return the unchanged revision; a case-only display rename and reordered links do increase it. Property-map order alone does not. Mixed effective/no-op updates increase once. Repeat no-op binding and cleanup assertions; none reports a fabricated change revision. (guard)
T5. Relations in the manager
- T5.1 A → A fails with 400. (guard)
- T5.2 A → B exists. B → A fails with 400. (guard)
- T5.3 A → B → C → D exists. D → A fails with 400.
- T5.4 Read the loaded depth limit
L. A chain ofLlinks works; adding one link at either end would createL + 1links and fails with 400, without changing the graph or revisions. Parameterize manager tests with limits 10, 20 and 50. (guard) - T5.5 With loaded limit
L, chain X hasfloor(L / 2)links and chain Y hasL - floor(L / 2)links. Both are valid separately. Join the top of X to the bottom of Y: the resulting longest chain would haveL + 1links, so the write fails with 400 and changes nothing. Run for each limit of T5.4. A check that only walks up from the new parent accepts this invalid link. (guard) - T5.6 C is an ancestor of A. Adding
RELATEDbetween A and C fails with 400, in both directions. (guard) - T5.7 A
RELATEDC exists. Adding A → B, where B → C, fails with 400. (guard) - T5.8 Race: A → B and C → D exist. Two threads add B → C and D → A at the same time. Exactly one succeeds and the other fails with 400, in every round. (guard: without the hierarchy lock, some rounds end with a cycle.)
- T5.9 Race: B is a
DRAFT. One thread adds A → B while another drops B. Either the link is added and then removed by the drop, or the add fails with 404. No live link to B is left. - T5.10 A has parents B and C, and B is
DEPRECATED. Drop B. A keeps C and its revision grows by- The audit has one entry for A losing B, with the new revision. C's derived
narrowerlist and revision are unchanged.
- The audit has one entry for A losing B, with the new revision. C's derived
- T5.11 The hierarchy read of a diamond returns each term once, in both directions.
- T5.12 The hierarchy read stops at a term the caller cannot see.
- T5.13 Setting the broader term of A needs read access to the parent. A
DRAFTparent owned by another user fails with 404 for CREATE, even when that caller can edit A. The parent owner with CREATE, and any caller with MANAGE, can read that parent. - T5.14 Mixed load: 8 threads run 500 random relation adds, relation removes, edits and deletes on 30 terms, on MySQL and PostgreSQL. No deadlock or lock-wait timeout happens, and the invariants hold at the end.
- T5.15 X → A, B → Y and X
RELATEDY exist. Adding A → B fails with 400 and changes nothing. Cover both ID orders of the storedRELATEDpair and an alter that combines content and relation updates. (guard: checking only ancestors of B accepts the invalid link.) - T5.16 Race a mixed alter (content, rename or synonym, and
addBroader) against deleting a referencedDEPRECATEDterm. Also race create with initial relations against that delete. Assert the lock order: endpoint, hierarchy, then all term IDs in order. No deadlock occurs; either the write commits before cleanup or it fails with 404 and writes nothing. Use independent sessions and latches at lock acquisition to exercise both orders. T7.7 extends these cases with domains. - T5.17 A → B, B → C and B
RELATEDD exist, with no broader path between B and D. DropDEPRECATEDB. A and D each get one revision increment and one audit record of their loss. C loses B from its derivednarrowerlist but keeps its revision. Cover either ID order of theRELATEDrow. Inject a failure after cleanup starts: links, revisions and successful cleanup audit records all roll back. (guard)
T6. Authorization
The users for these cases:
| User | Privileges on the metalake |
|---|---|
viewer |
VIEW_DEFINITION |
writer |
CREATE_DEFINITION; owns term Own |
writer2 |
CREATE_DEFINITION; owns nothing |
admin |
MANAGE_DEFINITIONS |
denied |
MANAGE_DEFINITIONS from one role, deny VIEW_DEFINITION from another |
outsider |
none |
owner |
owner of the metalake, no grants |
- T6.1 Matrix: for each user, each status (
DRAFT,APPROVED,DEPRECATED), and the termsOwnandOther(owned byadmin), run get, list, alter, set status and drop. The expected result of each cell comes from the Access control and Status tables, and from "Order of checks". The test keeps the expected results in one table in the test code. (guard: remove the owner check, and thewriter2cells fail.) - T6.2
deniedsees nothing: get returns 404 and list is empty. - T6.3
ownerpasses every check. - T6.4 A group owns a term. A member of the group can edit it. A user outside the group with
CREATE_DEFINITIONcannot. A group member with CREATE, or any caller with MANAGE, can read its draft; other CREATE users cannot. A refreshed principal without that group loses owner-based read/edit access; an unchanged valid group claim follows credential freshness. - T6.5 Granting any definition privilege on a catalog, or anything on
GLOSSARY_TERM, fails with - T6.6
Childhas a hiddenDRAFTparent and a visible parent.viewersees only the visible one inbroader.adminsees both. - T6.7 Known leak:
writerowns DRAFT termHidden;writer2has CREATE and owns nothing. First assert thatwriter2gets 404 forgetTerm("Hidden")and cannot find it in a list. Then creatinghiddenaswriter2fails with 409. Its error contains no definition, owner or domains of the hidden term. Read back aswriter: ID, name, content, owner and revision are unchanged, and no new term or success event was created. (guard) - T6.8 For each status,
writercannot delete its own term (403), whileadmincan delete either its own or another user's term. Also tryAPPROVED→DRAFT→ delete andDEPRECATED→DRAFT→ delete aswriter: status edits succeed, deletion still fails with 403, and the term remains. (guard: deletion must check MANAGE, not ownership or status.) - T6.9 CREATE can explicitly create in each status, with default
APPROVEDwhen omitted, and can edit content and set any status on its own term without a reviewer. An edit to anAPPROVEDterm is visible immediately toviewer; a draft is visible to its owner andadmin, but get returns 404 and lists omit it forviewerandwriter2.admincan edit any term. No approval operation or reviewer privilege is consulted in these Step 1 calls. - T6.10 An allow on CREATE alone gives VIEW; an allow on MANAGE alone gives CREATE and VIEW. A deny on VIEW blocks reads and writes for both, including term owners: get returns 404, list is empty, and create returns 403. A deny on CREATE blocks creation even with an allow on MANAGE, but effective MANAGE still permits editing and deleting existing terms.
- T6.11 Allow MANAGE and deny MANAGE through different roles. The caller cannot use the all-term edit/delete or draft-read paths, but retains effective CREATE from the allowed grant's implications: it can create and maintain its own terms, and read its own drafts. It still cannot delete its own terms. (guard: do not short-circuit on an allow or owner before checking the required denies.)
- T6.12 Transfer a draft from
writertowriter2through the existing owner API.writer2gains owner-based read and edit access;writergets 404 for that draft and cannot edit it. Neither can delete it.adminretains read, edit and delete access throughout. Run with two servers: prewarm server B's generic name/owner caches with the old ownership, hold B's owner invalidation poller with a controllable barrier, transfer on A, wait for commit, then issue fresh get/alter requests on B before releasing the poller. The old owner gets 404; the new owner succeeds. Repeat after renaming and reusing the old name, so a stale name-to-ID mapping cannot authorize the wrong draft. On B's generic owner endpoint, the former owner also cannot transfer the term back using stale ownership. (guard) - T6.13 Repeat owner transfer between groups with non-overlapping members on two servers. Separately keep a user's CREATE grant unchanged and authenticate a refreshed principal without the owner group: draft reads/edits fail on both servers. With an otherwise valid old token still asserting that group, access follows platform credential freshness; the test must not invent a database user-to-group membership relation or claim immediate token revocation.
T7. Domain membership
- T7.1 Create with two Domains the caller can manage. Get returns both.
- T7.2 Use a
PUBLISHEDDomain. The caller has Term create or edit permission and onlyUSE_DOMAINon the target Domain. Verify that creating a Term with this Domain returns403and creates no Term. Verify that an alter combiningupdateDefinitionandaddDomainalso returns403and leaves the Term definition, memberships and revision unchanged. - T7.3
domain=Salesreturns the terms of Sales and of its subdomains that the caller can see. It leaves out the terms of hidden subdomains. - T7.4 An authorized caller drops a
PUBLISHEDDomain with a Term member and no subdomains. Verify400with an instruction to unpublish first. Unpublish the Domain and verify the same drop now fails with409 NonEmptyDomainException. After a Term editor withMANAGE_DOMAINusesremoveDomain, the drop works if no other live member remains. When testing shared membership with another member type, verify its row survives Term removal and still blocks the drop. (guard) - T7.5 Race: one thread adds a Term to a
DRAFTDomain with no subdomains while another drops it. Either the add commits and the drop fails with409, or the drop wins and the add fails with404. - T7.6 Under the selected explicit-relation design, a tag on a term never changes its domains, even if the tag backs a domain.
- T7.7 Extend T5.16 with
addDomainin the mixed alter and domains in the create. Domain rows are locked only after all term rows, and a rejected request leaves membership, content, relations and revisions unchanged. - T7.8 A readable term belongs to Sales and a domain the caller cannot see. Only Sales appears in its returned domains, using the shared domain-filtering check. With both domains hidden, the term stays readable and its domain list is empty. Returned data contains no hidden-domain name, ID or count; stored membership stays intact, and reads do not change the revision. Endpoint wiring is covered by T8.8, T12.8 and T13.12. (guard)
- T7.9 A Domain admin with no Glossary privileges gets
409when dropping aDRAFTDomain with a hidden draft Term. The error returns no Term name or count. Use the same caller to obtain the draft's type and name from the Domain member list and verify a direct Term read returns404. Detach the Term explicitly. Verify200with{"code":0}on success, retry and for an absent Term. Verify the draft, other memberships and bindings remain intact, the revision advances once, and the now-empty Domain can be dropped. The same caller cannot use the ordinary alter to edit or add membership. (guard) - T7.10 Use published Domains Finance, Risk and Trading, with Trading initially under Finance.
Give a Term editor
MANAGE_DOMAINon Finance only. Run the race for an explicit detach from Trading and, with a fresh fixture, for a mixed alter that updates a Term's definition and adds it to Trading. In each case, pause the write after its initial management check. Move Trading under Risk in another session and commit before the write obtains the Domain lock. Verify403and confirm that the definition, membership and Term revision are unchanged. (guard)
T8. REST
- T8.1 Each endpoint returns the response type in the REST API table, and each error in the Errors list maps to its HTTP code.
- T8.2 Term
a/bworks in every path asa%2Fb. - T8.3 A term named
resolveworks with get, alter and drop. - T8.4 An unknown update type, and an empty update list, fail with 400.
- T8.5 Each DTO turns into JSON and back with no loss. Missing optional fields keep their defaults.
- T8.6
./gradlew :docs:buildpasses, and the spec has every endpoint in the REST API table. - T8.7 As MANAGE, an unfiltered get reads a DRAFT or DEPRECATED term, while get and hierarchy
with
status=APPROVEDreturn 404 for the same root. A matching root works; nested terms obey the filter, including name-only lists. An invalid status returns 400. (guard) - T8.8 Exercise T7.8 through direct get, list, hierarchy and alter responses. Every nested
TermDTO.domainsfilters hidden domains; altering content without changing membership does not reveal or remove a hidden domain. Create responses include only authorized domains.
T9. Tags on terms
- T9.1 Tag a term, list its tags, list the terms of a tag, and remove the tag.
- T9.2 Tagging a term does not change its
version. - T9.3 Dropping the term or the metalake removes its tag relations.
T10. Events and audit
- T10.1 Each effective write sends a pre event and a success event with the term name and new
version. A no-op outcome retains the version and does not claim a content change. - T10.2 A failed write sends a pre event and a failure event, and no success event.
- T10.3 Dropping a term with two children writes one audit entry for each child, including its
lost parent and new revision. A surviving
RELATEDneighbor also gets a cleanup entry.
T11. Bindings
- T11.1 Bind and unbind a term on each of the 8 object types and on a metric.
- T11.2 Binding a tag, a role or a term fails with 400. Binding a missing object or metric fails with 404.
- T11.3 An object admin with VIEW but without term edit access binds an
APPROVEDterm: it works. Binding another user'sDRAFTreturns 404; binding a visibleDEPRECATEDterm returns- A visible term with neither authorization path returns 403. Every failure leaves the bindings and revisions unchanged. (guard)
- T11.4 A term editor with only read access to the object binds a
DRAFTterm: it works. Repeat as a caller who is both object admin and term editor: the term-editor path still permits DRAFT and DEPRECATED bindings. MANAGE does not replace the required object read access. - T11.5 One request binds two terms, and the caller passes neither check for the second one. The request fails with 403, and the first term is not bound either. (guard)
- T11.6 Binding the same term to the same object twice keeps one row.
- T11.7 Drop the table. Its bindings and its column bindings are soft-deleted. Dropping the schema, the catalog and the metalake works the same way.
- T11.8 Drop one column with
alterTable. Its bindings are gone. The bindings of the other columns and of the table stay. Each term losing bindings gets one revision increment; terms whose bindings do not change keep their revisions. - T11.9 Rename the table, and rename a column without concurrent load/alter. The bindings stay when their registered IDs are preserved. Concurrent external-column rename preservation is subject to #14279, not proved by this sequential case; retain the documented operational limit until that fix covers the two-server stale-load timing. Do not restore bindings by name.
- T11.10 Alter a semantic model to remove a metric. Its bindings are gone. A renamed metric loses its bindings, with the audit details of T11.15. Each affected term's revision grows by 1, even when several metrics bound to it are removed in one alter. Unaffected terms keep their revisions.
- T11.11 Race: one thread binds a term to a table while another drops the table. No live binding to the dropped table is left.
- T11.12 At the storage layer, insert the same live
(term_id, target_type, target_id)twice: the unique key rejects the second insert. Repeat for TABLE, COLUMN and METRIC, using each target's own ID. Different metric IDs on the same model work. A NULL in any key column fails, and a soft-deleted binding does not block a new live binding to a still-live target. Run on H2, MySQL and PostgreSQL. (guard) - T11.13 Drop a table with several bound columns and a table binding to the same term. That term gets exactly one revision increment and one audit record listing the lost bindings. Repeat for schema and catalog drop. A metalake drop leaves no surviving terms. Inject failure in the local column/metric cleanup transaction: registered object changes, bindings, revisions and successful cleanup audit records roll back. Test external outcomes separately in T11.18; no-op cleanup leaves revisions unchanged. (guard)
- T11.14 Race column or metric removal against binding writes and ordinary term edits. Endpoint locks exclude new bindings before affected terms are collected; all affected term rows are then locked in ID order. No deadlock, dangling binding or lost revision increment occurs.
- T11.15 Rename a metric bound to two terms. Each term gets one audit entry with its ID and name, the semantic-model ID and name, the retired metric ID and name, the triggering alter operation and its new revision. Removing multiple metrics in one alter groups the losses per term. A failed alter leaves no successful cleanup entry.
- T11.16 Bind a term to a view itself: it works. A COLUMN request under a view-only parent name returns 404 and writes nothing. A table-column request resolves table and column IDs and authorizes and locks the table chain. Verify its rename/drop behavior through T11.8 and T11.9; do not resolve a view as a table or create a view-column binding. (guard)
- T11.17 Bind metrics with long names, including two names sharing a long prefix, through their model/name API inputs. Stored bindings use their distinct metric IDs; responses return the correct model/name without truncation. Content edits and a semantic-model rename preserve bindings. Remove a metric and reintroduce the same name: it has a new ID and no old bindings. Explicitly binding it again does not conflict with the retired identity. (guard)
- T11.18 Complete external column/table DDL, then fail its local store cleanup. Assert the external change remains, local rows/revisions roll back, and diagnostics retain the target identity and cause without a cleanup-success record. Preserve existing catalog response conventions and do not automatically replay DDL. Exercise a subsequent load that can reconcile a removed column, plus a failed local table drop whose external retry returns false and keeps a stale registration: do not claim the latter was repaired. Include same-name recreation without a persistent source identity as a recovery limitation, not proof of a new incarnation.
T12. Binding reads
- T12.1
GET /terms/{term}/objectsleaves out objects the caller cannot access. For a metric, the caller needs access to the semantic model; for a column, access to its table. A hidden root term returns 404 before any bindings are returned. - T12.2
GET /objects/.../termsrequires target read access and leaves out terms the caller cannot see. The metric endpoint checks semantic-model read access and metric existence. - T12.3
children=trueon a table with 3 columns, where 2 have terms, returns 2 entries inchildren. Repeat for a semantic model with 3 metrics, where 2 have terms. Each case sends one query toglossary_term_binding; metric IDs are resolved in a batch, not per metric. - T12.4
children=trueon a type other than table or semantic model, including VIEW, fails with 400. A view's own terms can still be listed without children. - T12.5 A glossary viewer guesses a restricted table or model name. Reverse reads, including
children=trueand the metric endpoint, return 403 with no terms, child names or counts. Assert that child enumeration and binding queries are not called before target authorization. Repeat as glossary MANAGE without target read access: MANAGE grants no asset access. (guard) - T12.6 As MANAGE, use
status=APPROVEDon reverse object/metric reads. Only APPROVED terms appear, and table-column/metric children with only DRAFT or DEPRECATED terms are omitted. Without the filter, ordinary term visibility applies. All nested DTOs filter hidden domains. - T12.7 Call
/terms/{term}/objects?status=APPROVEDdirectly as the draft owner and as MANAGE: a DRAFT or DEPRECATED root returns 404 and no bindings. With an APPROVED root, pause the read after its root check while another session changes status and bindings. The response must use one consistent snapshot for both checks and payload; a later request sees the new status. Exercise both commit orders and assert that reads take no write locks. (guard: independent root and payload reads can return bindings from an unapproved state.) - T12.8 Exercise T7.8 through reverse object and metric reads, including table-column and metric children. Each nested term filters its domains, independently of target and term visibility; readable terms remain in the result when all their domains are hidden.
- T12.9 Retrieve 1,001 authorized TABLE / IMPLEMENTED_BY bindings through bounded pages with no duplicates or omissions. Put more than 1,000 hidden candidates before a visible one: an empty first page has a continuation and later pages find the visible binding. Assert candidate and visible page limits, exact boundaries and exhaustion. Cover invalid page sizes, tampered cursors, changed filters, root status/visibility changes, revision conflicts and same-name root replacement; no cursor bypasses authorization or mixes term identities/revisions. (guard)
T13. Lookup
- T13.1
match= ACTIVE userfindsActive Customerby its synonymactive user, withmatchedBySYNONYM. - T13.2
match=customersdoes not findCustomer. - T13.3 One term matches two words. It is returned once, with two
matchedByentries. - T13.4 A word that only matches a
DEPRECATEDterm returns nothing withstatus=APPROVED. - T13.5 20 words work. 21 words fail with 400. (guard)
- T13.6 A term with 21 authorized bindings returns 20, with
bindingsTruncatedtrue. A term with 20 authorized bindings returns 20, withbindingsTruncatedfalse. - T13.7
nameContains=%andnameContains=_return only names that contain those characters. (guard) - T13.8
domainandmatchtogether return only matching terms of the domain and its visible subdomains. - T13.9
bindings=truewithoutmatch, or withoutdetails=true, fails with 400. - T13.10 A term has 20 hidden bindings followed by one visible binding. Return that binding
with
bindingsTruncated=false. With all bindings hidden, return an empty list and false. Hidden rows neither consume the limit nor affect the flag. (guard) - T13.11 Put hidden bindings across candidate-batch boundaries before, between and after visible ones, within the scan budget. With 21 visible bindings return 20 and true; with 20 visible bindings and exhaustion proved within budget return 20 and false. Candidate batches do not act as the visible-result limit.
- T13.12 Exercise T7.8 through lookup and match responses, including embedded bindings. Hidden domains are filtered without removing a readable matching term or changing stored membership.
- T13.13 Exceed the 1,000-candidate per-term work budget with mostly hidden bindings, and the
10,000-candidate request budget across several matches. Each returns 400
LookupTooBroadExceptionand no successful partial result. Assert that scanning stops at the budget; neither errors nor logs returned to clients expose hidden/scanned counts or object identities. The same error type/message is used regardless of the triggering term. (guard) - T13.14 Repeat with
bindings=false: matched definitions remain available without binding expansion and the optional binding fields are absent. Then retrieve bindings using T12.9's bounded pages. Separately exhaust the overall budget with term/relation projection alone: disabling bindings still returns the typed work-limit error, never a false complete result.
T14 and T15. Clients
- T14.1 / T15.1 Each client method sends the expected REST call (checked with a mock server) and reads the response.
- T14.2 / T15.2 Each REST error turns into the matching client exception.
- T14.3 / T15.3
matchTerms/match_termsreturns onlyAPPROVEDterms, with their bindings. - T14.4 / T15.4 View bindings use the view itself, without column operations or
children=true. Table-column operations use the table parent;listColumnTermsis exposed for tables only. - T14.5 / T15.5 Preserve the revision token and conditional-alter parameter end to end. Binding methods return one page with continuation, including empty pages with a token; convenience methods neither discard it nor automatically drain every page.
T16. MCP tools
- T16.1 With the fixture of the example in Agent integration,
resolve_business_termreturns the JSON in that example. The test compares it with a stored JSON file. - T16.2 25 words send two REST calls (20 and 5). The results keep the order of the words.
- T16.3 No successful glossary tool result contains a DRAFT or DEPRECATED term, including root names, name-only relations, hierarchy nodes and reverse object results. Run every glossary tool as MANAGE and as the draft owner, who can read the drafts through unfiltered REST. Direct draft or deprecated roots fail with 404; a hierarchy walk from an APPROVED root through a DRAFT toward another APPROVED node stops before the draft and all nodes reached only through it. Test both traversal directions. Domains and binding targets are authorization-filtered. (guard)
- T16.4 An HTTP call with
Authorizationforwards that exact credential, ahead of configured service credentials. Cover Basic, Bearer and Negotiate headers and assert that failed user authentication is not retried with a service identity. - T16.5 The tool descriptions contain the four rules for agents.
- T16.6 The tools exist only when the
glossarytool tag is enabled. - T16.7 Cover every mode in the identity table: HTTP with credentials, service fallback, fallback disabled, no configured credentials, and stdio with and without a service identity. Check the effective principal, outgoing credentials, rejection before any backend call when applicable, and audit attribution. Concurrent callers with different identities or metalakes do not share authorization state. All successful modes still enforce APPROVED-only.
- T16.8 Capture REST requests for all glossary tools: each term read passes
status=APPROVED, including root-bindings and hierarchy calls. An error never triggers an unfiltered retry.list_terms_for_metadatauseschildren=truefor tables and semantic models, and lists a view's own terms without it. (guard) - T16.9 A lookup-work error is a tool error, not unmatched words or an empty binding list. Retry
explicitly with
include_bindings=false, retaining identity, domain and APPROVED filtering; assert no binding expansion and absent binding fields. Pass kind/types and continuation to paged metadata reads. Empty pages with continuation are not reported as no bindings; stopping early reports incompleteness. A revision conflict is surfaced without automatic restart or merging old/new pages. The tool performs one bounded page per call. (guard) - T16.10 With batched words, one REST batch succeeds and another fails its budget. The tool must not present the first batch as a complete successful lookup or classify unprocessed words as unmatched. Return the typed tool error; a later definition-only request is a new operation.
- T16.11 As MANAGE, discover a readable DRAFT/DEPRECATED term's name/type through the generic tag tool, then pass it to the glossary tools: get/binding reads return 404 and semantic lookup omits it. Generic discovery is not a publication signal and triggers no unfiltered retry.
T17. CUJ integration tests: the cases are the CUJs in Critical user journeys below.
T18. Performance
- T18.1 Measure adding a link and reading the hierarchy, for chains of 10, 20 and 50 links, with 3 parents per term, on MySQL and PostgreSQL. Report p50 and p95 over 100 runs.
- T18.2 The final depth limit is the largest of 10, 20 and 50 whose p95 for adding a link is under 100 ms on both databases for the chain and wide-DAG fixtures of T18.1 and T18.3. The PR description has the result table.
- T18.3 Repeat the measurements on layered DAGs of 10, 20 and 50 links, with 10 and 100 terms
per level and up to 3 parents per term. Include overlapping ancestor and descendant paths,
and
RELATEDpairs that make a proposed link invalid only across its descendant/ancestor sets. Measure both accepted and rejected additions, report node and edge counts and p50/p95, and verify that the walks deduplicate visited IDs and batch queries per level. - T18.4 After choosing the release constant, rerun T5.4, T5.5 and CUJ 6 using that value on
H2, MySQL and PostgreSQL. Record the selected limit and results. The release check must prove
that
Llinks work andL + 1links fail; a fixed 21-link fixture is insufficient. - T18.5 Measure competing creates/renames/synonym changes within one metalake and across two metalakes, and lookup work near both scan limits. Report wait time, throughput and candidate checks as well as latency. Do not claim parallel-create scaling within the serialized scope.
T19. User documentation
- T19.1 Every request and response example in
docs/glossary.mdcomes from a run of the integration tests, not from hand writing. - T19.2
./gradlew :docs:buildpasses.
Critical user journeys
A critical user journey (CUJ) is a main path a user takes through the feature, from start to end. T17 turns each CUJ into one end-to-end test. Step 1 ships only when all of them pass on H2, MySQL and PostgreSQL.
- Fixture: one metalake with the users of T6; domains
Sales(with subdomainRetail) andFinance; the catalogs thatTagITuses (Hive for tables and columns, plus fileset and model catalogs); and a semantic model with metricsnet_revenueandactive_customers. Each CUJ starts from this fixture and creates its own terms. - Clients: each CUJ runs through the Java client. CUJs 1, 2 and 3 also run through the Python client, and CUJ 3 also runs through MCP.
- Checks: after each CUJ, the REST form of
GlossaryInvariantsmust pass.
- Define terms.
admincreatesCustomerinSales.writercreatesActive Customerwith synonymactive user, broader termCustomer, one link and one tag. Expected: both terms areAPPROVED,viewercan read both, and the hierarchy read ofCustomershowsActive Customeras its child. - Link terms to data. Bind
Customerto a table,Active Customerto a column, andActive Customerto metricactive_customers. Expected: Implemented by and Used by list the objects; each object lists its term; the table read withchildren=trueshows the column term. - Agent lookup. Call
resolve_business_term(["net revenue", "active user", "VIP"])asviewer. Expected:active userreturnsActive Customerby synonym, with its column and metric;VIPis inunmatched; aDRAFTterm namedVIPand aDEPRECATEDterm never show. Repeat asadminand the owner of VIP, who can read it through unfiltered REST. All MCP tools still exclude it; a directlist_metadata_by_term(VIP)fails with 404. An approved term belonging to a hidden domain omits that domain, and inaccessible bindings are absent. - Privileges.
viewer,writer2andadmineach try to read, edit, set the status of and dropActive Customer. Expected: the results match the T6.1 table. - Status and delete.
writercreates a term with no status: it isAPPROVED, andviewercan read it immediately. The writer edits its definition, and the viewer sees the edit with no review step. Thenwritersets it toDRAFT,APPROVED,DEPRECATEDandDRAFTagain, trying to delete it in each state: all deletes return 403.writer2andviewercannot read it while it is a draft;writerandadmincan.admincan delete it in any state; use a fresh term for each state. Expected: no status change bypasses the deletion privilege, andversiongrows by 1 on each content or status alter. No approval decision is required. - Bad relations. Read the server's actual release depth limit
L, without a test override. Build a valid chain ofLlinks, then try adding a link that would makeL + 1links. Also try a cycle and aRELATEDlink between a term and its ancestor. Expected: each invalid write fails with 400, leaving data and revisions unchanged. Then two servers add the two links of T5.8 at the same time, 20 rounds: exactly one succeeds each round. - Cleanup. Drop a bound column, a bound table, a
DRAFTDomain that has terms, a term with two parents and one child (asadmin, while it isAPPROVED), and then the metalake. Expected: the bindings go away with the objects; the domain drop fails with 409; the child keeps its other parent; each surviving term losing bindings or its parent gets one revision increment per cleanup transaction and an audit record of its losses. Also rename a bound metric and check that its bindings disappear, the affected term's revision grows by 1, and the audit names the removed metric and term. After the metalake drop, no glossary data of the metalake can be read. - Edit on one server, read on another. Start two servers on the same database. Edit, rename, relate and bind a term on server 1, and read it on server 2 right after each change. Expected: server 2 returns current term data. Also prewarm owner/name caches on server 2 and transfer a draft's ownership on server 1. After commit and before poller refresh, new requests on server 2 deny the old owner and allow the new owner, as in T6.12/T6.13. Already authorized in-flight requests are outside that revocation guarantee. If the test framework can start only one server, T17 adds a way to start a second one. It must not replace this CUJ with a single-server test.
Task Breakdown
Step 1 is split into one issue per PR, under one epic. Each PR adds the tests of its cases in
Testing, and follows the rules there. REST PRs update the OpenAPI spec (./gradlew :docs:build). Tasks in the same group can be done in
parallel once the tasks they depend on are merged.
Prerequisites
- Domain code merged to
main(it is onbranch-domain-devnow). Only T7 needs it. - Decision on Open Question 3 (PUBLIC role) before T8. Domain membership is already decided: T7 implements explicit relations (Option A).
Group A: API and storage
- T1. Add the Glossary API (
api/).GlossaryTermwithStatusandrevisionToken,TermChange,GlossaryOperationson the metalake, the relation and binding types,GLOSSARY_TERMinMetadataObject.Type, the three definition privileges (metalake only), and the exceptions, includingTermVersionConflictExceptionandLookupTooBroadException. Expose optional identity-and-revision-token conditional alter, paged binding results and definition-only lookup without silently ignoring conditions or dropping continuation. Depends on: none. - T2. Add term entity and storage (
core/).EntityType.GLOSSARY_TERM,GlossaryTermEntity, and the tablesglossary_term_metaandglossary_term_synonymon H2, MySQL and PostgreSQL with upgrade scripts. POs, mappers, SQL providers andGlossaryTermMetaService: insert, get, list, update, soft delete, GC, and cleanup on metalake drop. Depends on: T1. - T3. Add term relation storage (
core/).glossary_term_relandglossary_hierarchy_lock; insert and remove links; list broader, narrower and related terms; the per-level batched walk. Depends on: T2.
Group B: Core logic
- T4. Add the Glossary manager (
core/). Create, get, list, alter and drop; conditional alter with term identity and revision checks before writes/no-op detection; name and synonym rules; links, properties and source reference; status; revision;TermChangeHandlerwith the default handler; whole-request lock planning and name/synonym checks under the hierarchy lock. Depends on: T2, T3. - T5. Add term relations to the manager (
core/). Set broader and related terms; cycle check, depth limit and descendant/ancestor no-overlap checks under the hierarchy lock; hierarchy reads with authorization and optional status filtering at every node; cleanup on delete with surviving-term revisions and loss details for audit. Depends on: T3, T4. - T6. Add Glossary authorization (
core/,server/). TheGLOSSARY_TERMcase in shared glossary authorization checks, grant implications and deny precedence; owner checks for CREATE edits and draft reads; MANAGE-only deletion in every status; filtering of hidden terms inside relation lists. No Step 1 approval capability. Depends on: T4. - T7. Add domain membership (
core/,scripts/,server/). Introduce the shareddomain_member_relschema and mapper as a standalone storage change for reuse by Article T2. Add and remove term memberships on create and alter with the Domain management check. Support explicit detach by the Domain administrator. Provide the shared Domain member list and Term name resolution for reuse by Article. Check all live member types on Domain drop. Shared domain filtering on term results and mixed relation/domain lock-order tests. Depends on: T4, T5, T6, prerequisites.
Group C: REST and events
- T8. Add Glossary REST APIs and OpenAPI (
common/,server/). DTOs, requests and responses; endpoints for terms, status, relations, hierarchy and domains; optional read status filters on roots and nested terms; domain filtering on every term DTO; error mapping. Depends on: T5, T6, T7. - T9. Support tags on terms (
core/,server/).GLOSSARY_TERMas a taggable type in the existing tag APIs. Depends on: T8. - T10. Add Glossary events and audit (
core/).GlossaryEventDispatcherwith pre, post and failure events for every write, plus cleanup audit records with lost relations and the resulting term revisions. T11 adds binding-loss records. Depends on: T8.
Group D: Bindings and lookup
- T11. Add term bindings (
core/).glossary_term_bindingstorage; bind and unbind on all supported objects and on metrics, with both privilege paths; COLUMN means table columns only, with table identity, authorization and fencing; binding-specific target types and target IDs, reusing existing metric IDs; non-NULL unique keys and storage-level duplicate tests on all backends; cleanup on object drop, column drop and metric removal, with surviving-term revisions and audit details for metric rename and removal. Include load-triggered local column reconciliation; keep local atomicity separate from external DDL outcomes and record cleanup failures. Reuse the column-identity behavior and #14279 limitation above; unconditional concurrent-rename preservation requires that platform fix, not a second glossary protocol. Depends on: T6, T10. - T12. Add binding REST APIs and reads (
server/). Bind and unbind endpoints; objects of a term with bounded cursor pages and root status guards in a consistent read snapshot; cursor identity/revision/filter validation; target authorization for terms of an object or metric; nested domain and status filtering;children=truefor tables and semantic models only; OpenAPI. Depends on: T8, T11. - T13. Add term lookup filters (
core/,server/).domain,status,nameContainsandmatchon the list endpoint,matchedByin the result, andbindings=truewith the limit and truncation flag computed after authorization. Depends on: T12.
Group E: Clients and agents
- T14. Add Glossary to the Java client, including
matchTerms. Depends on: T13. - T15. Add Glossary to the Python client, including
match_terms. Depends on: T13. - T16. Add Glossary MCP tools (
mcp-server/), with the agent rules in the tool descriptions, APPROVED filtering through every REST read, transport-specific effective identity and fallback behavior, and tests for nested filtering, direct unapproved roots, unmatched and ambiguous words, bounded binding pages and continuation. Depends on: T15.
Group F: Release checks
- T17. Add CUJ integration tests. End-to-end tests for CUJs 1–8 as described in Critical user journeys, on H2, MySQL and PostgreSQL (Docker). Depends on: T14, T16.
- T18. Add a hierarchy performance test and set the final depth limit from it. Depends on: T5.
- T19. Add Glossary user documentation (
docs/), including binding-page continuation, external DDL cleanup/recovery limits and the inherited concurrent-column-rename limitation. Depends on: T14, T15.
Step 1 ships when T1–T19 are merged and all CUJs pass, including the depth-boundary rerun after T18 selects the release limit. This completes Step 1 only, not the later scope of #14238.
Step 2 tasks (not filed yet)
These are tracked here until separate GitHub issues are filed and linked. The local IDs below are not issue numbers, and no follow-up issues have been created by this document update.
- S2.1. Review and no self-approval: proposed-change storage, the review handler for
TermChangeHandler, explicit submit/approve/reject APIs, scoped MANAGE reviewer authorization and rejection of self-approval, including content, status, relations, membership, both binding paths and requested deletion. Ordinary MANAGE writes cannot bypass review; its own submissions need another authorized MANAGE reviewer. - S2.2. Version snapshots and history: design the snapshot format and add
glossary_term_version_infoin the Step 2 upgrade, plus history/diff APIs and atomic commit with the approved live change. Step 1 creates no placeholder version table. - S2.3. Domain grants: grants on domains, inherited by subdomains, with deny handling and revalidation when membership changes.
- S2.4. Creation defaults and upgrade behavior: default new terms to DRAFT and reject direct publication through create/update, including for MANAGE. No initial-status setting bypasses review. Preserve existing term IDs and statuses when enabling Step 2; an existing Step 1 APPROVED term is not relabeled as human-reviewed or given a fabricated decision. Document the changed creation default in the upgrade notes; do not add a compatibility mode, request-contract version or capability-negotiation mechanism for this change.
- S2.5. Web UI: term pages, hierarchy, binding drawers, review queue and history.
- S2.6. CSV import/export: define the CSV schema and validation,
permission-filtered exports, repeat-import identity using
sourceRef, batch failure semantics, and imports through the same review and no-self-approval checks as other writes. This remains planned work, outside Step 1; public APIs alone do not deliver CSV.
Step 2 acceptance requirements (implemented with S2.1, S2.2, S2.3 and S2.4, not Step 1):
- CREATE creates a draft and submits its own changes; it cannot read another owner's draft, decide a proposal or publish by passing APPROVED in create/update.
- MANAGE can inspect drafts and pending changes in its authorized scope, and approve/reject a different principal's submission. MANAGE outside that scope cannot inspect or decide it.
- Two MANAGE users submit separate changes. Neither can approve its own submission, including through another role or group ownership; each can approve the other's authorized submission. Repeat the self-approval and direct-publication rejection as the metalake owner.
- Submit a content or binding change to an approved term. Ordinary reads and MCP continue to return the previous approved state, never pending content. Rejection preserves that state; approval exposes the new state. A requested deletion remains pending until approval.
- Enabling Step 2 preserves existing IDs/statuses and records no invented reviewer decisions; newly created terms default to DRAFT, regardless of the caller's management privileges.
- An existing client omitting status gets a successful create response with
status=DRAFTafter the upgrade. It must not interpret object creation as publication. Verify the response shape remains stable; no extra compatibility parameter or automatic APPROVED setting is used.
Implementation Steps
The glossary is built in two steps. Step 1 is this design. Step 2 adds review, history and grants on domains on top of it. Both steps preserve existing term IDs, relations, bindings and statuses. Step 2 adds its own proposal/version storage through upgrade scripts.
Creation default after upgrade: Step 1 creates APPROVED terms by default; Step 2 creates DRAFT terms by default and publishes only after review. This is the intended behavior change when introducing approval, not a reason to keep automatic publication enabled. Existing terms retain their statuses, and subsequent changes use the review workflow. Creation responses continue to report the actual status: a successful create does not mean the object is published. The upgrade notes explain this change to users of scripts and clients. No compatibility mode, write-contract version or capability negotiation is introduced solely to preserve immediate publication. Public request/response shapes remain reusable; write behavior intentionally changes.
| Area | Step 1 (this design) | Step 2 |
|---|---|---|
| Term model | Terms with definitions, synonyms, owner, links, properties and source reference | Same terms |
| Relations | Several broader terms, related terms, cycle check, cleanup | Relation changes are reviewed |
| Domain membership | Explicit relations (Option A); zero or more domains, optional on create; filters and cleanup | Same membership source; changes are reviewed and domains become the scope of grants |
| Tags | Ordinary tags on terms through the existing tag APIs | Same |
| Bindings | Catalogs, schemas, tables, views, table columns, filesets, topics, models and metrics; both privilege paths | Binding changes are reviewed, on both paths |
| Privileges | Metalake grants; CREATE maintains own terms; MANAGE reads, edits and deletes any term; private drafts, deny and filtering | MANAGE retains scoped administration and adds approval/rejection; grants also on domains |
| Status | Default APPROVED, immediately readable with VIEW; ordinary status edits; no approval decision |
Default DRAFT; explicit approval required, including for MANAGE submissions |
| Changes | Take effect at once; TermChangeHandler is the write hook |
Always reviewed; proposed changes are kept apart; nobody approves their own change |
| Versions and history | Revision number and audit only | A snapshot of each approved change, readable history and diffs |
| APIs and clients | REST, Java and Python clients, OpenAPI | Proposal, decision and history APIs |
| CSV import/export | Not delivered; APIs and source references support future importers | Planned as S2.6, with permissions and review |
| Agent lookup | Exact match on names and synonyms; approved terms only; ambiguous and unmatched words | Same lookup on the current approved state while proposed changes await review |
| Audit and events | Create, edit, status, relation, membership, binding and delete | Submit, approve and reject |
| UI | None; the REST calls behind each page are listed in Web UI support | Term pages, hierarchy, binding drawers, review queue and history |
Storage for Step 2
- Step 2 defines and creates
glossary_term_version_info; its upgrade includes the selected snapshot schema. The table is absent from Step 1. Snapshot identity is per term and approved version; format and indexes are specified with S2.2 rather than frozen in an unused table now. - Step 2 keeps term IDs, relation keys and existing data. It adds storage for proposed changes.
- The write hook covers content, status, relations, membership and both binding paths. So Step 2 can review every change.
- On approval, Step 2 checks effective MANAGE in scope, rejects the submitting principal, checks the term identity and revision the change was based on, and the objects it refers to again. Then it writes the live change, the snapshot and the decision in one transaction. If the snapshot fails, the live change is rolled back.
APPROVEDin Step 1 means "agents can use it", not "a reviewer accepted it". Step 2 history tells a reviewer's approval apart from the default status.