Skip to content

Ontology table bindings with roles, keys, joins and row filters, plus shapes, record statements and proposed tests - #39896

Open
harshach wants to merge 235 commits into
mainfrom
harshach/ontology-binding-roles
Open

harshach wants to merge 235 commits into
mainfrom
harshach/ontology-binding-roles

Conversation

@harshach

@harshach harshach commented Dec 6, 2026

Copy link
Copy Markdown
Collaborator

Describe your changes:

An ontology class could already be bound to tables, but nothing said how one row of those tables becomes one record of the class. This PR lets a table binding say it. A binding now carries a role, a subject key, a row filter and, for a relation column, the join it follows. On top of that the server can:

  • Write the SQL that lists, opens, expands and counts the records of a class, with typed values kept out of the statement text.
  • Give exact record and link counts from stored profiles, or the reason it has none.
  • Tell an editor what is still wrong with a mapping.
  • Hold SHACL shapes on an ontology and turn them into data quality tests that a table owner accepts or rejects.
  • Carry bindings and shapes in a change set, and remember the definitions a reviewer declined.
  • Let a suggestion task propose a primary, unique or foreign key on a table.

The server writes statements and never runs them against a bound table. Every read masks what the caller may not view.

How it is split. This is one PR because the parts share the binding model and the 2.2.0 migration. It has no dependency of its own and merges first. Reviewers can read it by area. Start with the schemas and the 2.2.0 migration, then read ontology/ and ontology/sql/ in the service, then the resources, then the UI task tab. Each area has a decision record under docs/decisions/, listed at the end of the design section.

Type of change:

  • New feature
  • Breaking change. No API is removed, but some answers change. See "Behavior changes" below.

High-level design:

Table bindings say how rows become records

  • role is identity or contributing. A class has at most one identity table, and it decides which records exist. A contributing table adds columns to them.
  • subjectKey is an ordered list of 1 to 16 column paths that identifies one record.
  • rowFilter is one {column, operator, value}. The server parses the value as the data type of its column when it renders SQL, and refuses a stored value that no longer parses.
  • A column bound to an OBJECT property carries a join with 1 to 16 column pairs and a status of inferred or confirmed. The target is a table in the same database that the writer may view.
  • An ontology may name one database as its mappingSource. The server stores it as a MAPPED_TO relationship. Once it is set, a binding that a write adds or changes must sit in that database.
  • One step under the ontology lock checks every binding write. Setting or changing a row filter also needs ViewSampleData on the table.
  • A binding written before these fields existed keeps all three empty and reads back as unassigned. The server never fills in a default.
  • A data property can set isDisplayName. A class has at most one such property. The CSV format has no column for it, so a CSV import keeps the stored flag. A Turtle import reads it from om:displayNameIntent.

Generated statements start from the identity table

  • POST /v1/ontologyConcepts/{id}/statements/{find,open,expand,aggregate} each return one SELECT and a column plan. Every statement starts from the identity table and names a record by its subject key, so two readers get the same record id.
  • expand orders by the related key and pages after a given key. aggregate counts the records of a class and the links of a relation.
  • Values never enter the text as concatenated strings. TypedValue and TypedStatement render each value with one escaper per engine family (MySQL, Postgres, Redshift, Trino, Snowflake, BigQuery, Spark, SQL Server and ClickHouse). A statement comes as text to read and as text with :pN parameters to run.
  • A relation label is no longer written into the statement as a SQL comment. Before this change a label such as x */ OR 1=1 /* could close the comment in the copied text. The label now comes back in hops.

Counts, profile facts and mapping health

  • Table assets on a graph page carry rowCount, profiledAt and sampled from the latest stored profile, only for a caller with ViewDataProfile.
  • Record and link counts come from whole-table column metrics only, never from rowCount, because several engines store an estimate there. A count is exact with a value, or a state that says why there is none.
  • GET /v1/ontologies/{id}/mappingHealth pages what an editor still has to fix, such as a class with no identity table, an unconfirmed join, a key whose type does not match, a sensitive key column, or a column whose type cannot hold its property. It reads catalog metadata only.
  • OntologyTableMappings.read returns the table mapping of a whole ontology version in one read, with a count of what the caller may not view.

Shapes and the checks they become

  • ontologyShape is a native entity in the working draft. It targets one class and holds an ordered list of constraints, each with a stable id. The eight supported SHACL constraints are minCount, maxCount, class, datatype, minInclusive, maxInclusive, in and pattern. An import reports every other SHACL construct instead of refusing the file. Shapes are sealed in releases as SHAPE members and export as SHACL.
  • GET /v1/ontologyConcepts/{id}/shapeChecks compiles the shapes of a class against its bindings. Each part of a constraint is checked exactly, or the answer says why it is not offered. It creates nothing.
  • A reconcile job files one suggestion task per check (suggestionType TestCase) on the table the check belongs to. Approving it creates a tableCustomSQLQuery test as the approver and gives the suite a scheduled pipeline. Rejecting it creates nothing. The governance bot files the task, so the person whose change started the run can still resolve it.
  • The reconcile runs after an activation and after a binding change. It updates, restores or deletes generated tests to match the compile, and a second run writes nothing. A generated test refuses edits to its definition, entity link, parameters and generatedBy.

Table constraint suggestions

  • SuggestionPayload.suggestionType gains TableConstraint, with a seeded TableConstraintSuggestion task form. Filing refuses anything but one valid PRIMARY_KEY, UNIQUE or FOREIGN_KEY on existing columns.
  • Approving needs EditAll on the table and adds the constraint as the approver, through the table repository's own validation. The comment that an approval leaves names the constraint added, or says the table already had it. It is posted only after the change returns, and before the task is resolved.
  • If applying a table constraint fails, the task leaves no comment and stays open. A suggestion of another type, or another task type such as a description update, logs a failed apply and resolves with its comment, as before.
  • The task tab sends only the keys the form declares, and the suggestion lists skip a type they have no card for.

Change sets, declined definitions and draft reads

  • A change set can carry UPSERT_BINDING and UPSERT_SHAPE operations, applied with the rest of the draft. Operations and their evidence are returned only to readers of the draft, and evidence names no table the reader may not view. A stored change event holds no operations.
  • POST /v1/ontologies/{id}/declinedDefinitions records the definitions a person declined, keyed by operation type, IRI hash and a canonical content digest. POST .../declinedDefinitions/match tells a client which candidates were declined before. A binding is keyed by its table, role, key and row filter.
  • Narrowing a draft to a subset of its operations checks that every kept operation still applies.

Release members are filtered per reader

GET /v1/ontologyReleases/{id}/members/{kind} returns only the members the reader may view. The cursor and paging.total count viewable members only. Before this change, one hidden member made the whole page a 403. The by-id member read is unchanged. Whole-release reads, such as export, SPARQL, comparison and validation, still refuse a reader denied any member, because a partial release would give a wrong result.

Other changes

  • AbstractNativeApplication#validateConfigForSave checks an app's configuration before POST, PUT and both PATCHes store it. A refused configuration answers 400 and leaves the stored one as it was.
  • The recover step gives a bot user its default role only when the user holds no role, so a role an administrator changed on purpose stays.
  • The MCP entity tools apply the draft read check. The SDK gains OntologyShapeService and OntologyDeclinedDefinitionService. openmetadata.ttl describes the shape class and the new predicates.

Decision records

This PR adds 2026-11-21-a-table-binding-says-how-its-rows-become-records, 2026-11-21-a-class-has-at-most-one-display-name-property, 2026-11-21-graph-table-assets-carry-latest-profile-facts, 2026-11-21-ontology-shapes-hold-the-supported-shacl-constraints, 2026-11-22-a-count-is-exact-or-absent, 2026-11-22-a-declined-definition-is-remembered-by-content, 2026-11-22-an-ontology-change-set-can-carry-table-bindings-and-shapes, 2026-11-22-generated-sql-keeps-typed-values-apart-from-its-text, 2026-11-22-record-statements-start-from-the-identity-table, 2026-11-23-a-shape-check-is-exact-or-it-is-not-offered, 2026-11-26-a-suggestion-task-can-carry-a-table-constraint, 2026-12-01-a-shape-check-reaches-its-table-as-a-proposed-test, 2026-12-01-an-apps-configuration-is-checked-before-the-server-stores-it, 2026-12-04-the-table-mapping-of-a-version-is-one-read and 2026-12-05-the-lookups-of-generated-tests-and-their-tasks-use-an-index. It amends the records on independent entity storage, sealed release members, concept bindings and draft read rights.

Migration (2.2.0)

All steps go in bootstrap/sql/migrations/native/2.2.0/{mysql,postgres}/schemaChanges.sql and the v220 data step. Each one checks before it changes anything, so a second run changes nothing.

  • Creates ontology_shape_entity and ontology_declined_definition.
  • Adds bindingRole, subjectKey and rowFilter to ontology_concept_binding. It backfills nothing.
  • Adds the stored columns test_case.generatedByClassId and task_entity.testCaseClassId, with an index on each, so the lookups of generated tests and their tasks stop scanning both tables. Adding a stored column rewrites each table once at upgrade. On 50,000 rows that took 3.9 s for test_case and 1.2 s for task_entity. Release notes should say so.
  • The Java step OntologyShapePolicyRules adds ontologyShape to the seeded ontology author and reviewer policy rules on an installed catalog. It runs after the two other 2.2.0 steps.

API changes

  • New endpoints are /v1/ontologyShapes (CRUD, versions, restore and POST /import), /v1/ontologyConcepts/{id}/statements/{find,open,expand,aggregate}, GET /v1/ontologyConcepts/{id}/shapeChecks, GET /v1/ontologies/{id}/mappingHealth, and /v1/ontologies/{id}/declinedDefinitions with /match.
  • Concept bindings take and return role, subjectKey, rowFilter and join. Ontologies take mappingSource. Graph pages carry profile facts and counts. Suggestion tasks take TableConstraint and TestCase. App create, update and patch check the configuration first.
  • docs/generated/api-reference.md is regenerated.

Behavior changes

  • A reader denied some members of a release now gets a filtered member list instead of a 403.
  • A PUT of a generated test that names its test definition by id string or in upper case now gets a 400 that says the test comes from a shape, where it got a 404. Nothing is written in either case.
  • A binding change notifies the graph projection after the transaction commits. On the change-set path, that is after the outer transaction.
  • A row filter value is returned to anyone who may view the class and the table, without ViewSampleData, as a view's SQL text is. A reader denied a join's target table still gets the target's id and key column names, but never its name. A reviewer may want to weigh both.

Tests:

Which test layer and why

Rules that need no server are unit tests, such as the binding rules, count rules, shape compile, typed values and statement goldens. Every new or changed endpoint has a Java IT, authorization included. The UI change is the task tab, covered by Jest. No Playwright test is added.

Use cases covered

  • An editor binds a class to an identity table with a key and a row filter, and a reader denied the table's sample data cannot set a filter.
  • A client lists, opens, expands and counts records, and each statement matches its golden text on every engine family.
  • A count is exact when every profile is whole-table, and absent with a reason otherwise.
  • A shape is imported, sealed in a release, compiled into checks, proposed as a test, approved by a table owner and kept in step after a binding change.
  • A key is proposed on a suggestion task, approved with the approver's rights, and refused when invalid.
  • A reviewer declines a binding and a shape, and a later match reports both as declined.
  • A reader denied one class lists the release members they may view, and walks every page.

Unit tests

  • 58 new and 19 changed test files in openmetadata-service, plus about 680 golden statement files across nine engine families (scripts/write-ontology-statement-goldens.sh regenerates them).
  • mvn test -pl openmetadata-service ran 23,870 tests with 0 failures, 0 errors and 75 skipped.
  • mvn test -pl openmetadata-mcp ran 1,128 tests with 0 failures.

Backend integration tests

  • 51 new and 11 changed ITs in openmetadata-integration-tests.
  • On MySQL, every IT class this branch adds or changes, plus the three ontology DAO ITs, ran 1,477 tests. The first run after merging main had 40 failures in four classes, all statement-count pins and one assignee change from main. After the fixes the four classes pass (59 tests) and OntologyShapeCheckReadsIT passes 36 of 36.
  • On PostgreSQL with OpenSearch, the same set ran 919 tests with 0 failures and 114 skipped.
  • The existing ITs of the areas the merge with main touched (tables, tasks, apps and MCP) ran 1,594 tests on each engine, with 1 error on each. The error is TaskEntityTypeResolutionIT.approvedMetadataTaskAppliesToEntity[9], a 409 from two invocations creating one glossary. The class passes alone (13 of 13), and its code is identical to main.
  • OpenSearchRBACConditionEvaluatorTest failed 20 times in one full unit run and did not fail again, alone or in a second full run. Neither side changed that code.

The results above come from the branch's own runner, not make java_affected_run, so the block is empty. Publishing it is pending.

UI checks

  • Jest passed on the changed UI files, 67 of 67 in TaskTabNew.component.test.tsx and 179 of 179 in the API and task form utility suites.
  • tsc reports 53 errors, the same set as on main. None is in a file this PR changes.

Ingestion integration tests

  • Not applicable.

Playwright (UI) tests

  • Not run. The UI change is the task tab for a constraint suggestion. make playwright_affected is pending.

Still pending before merge

  • The full affected Java plan and Playwright run through the repository's runners.
  • A security review of row filters and generated statements.
  • A screen recording of the task tab.
  • spotless:check, check_decision_records.py and the merge with main are clean at the head. Main has moved since, so a fresh merge check is due.

UI screen recording:

Not recorded yet. The only UI behavior change is how the task tab resolves a table constraint suggestion.

Follow-ups after merge

Behavior gaps:

  • PUT and PATCH responses of an ontology still return the mapping source reference to a writer who may not view that database. GET already hides it.
  • Whole-release reads (export, SPARQL, comparison, validation) still refuse a reader denied any member. This is intended, and a filtered variant would need its own design.

Performance:

  • A release member list scans the member kind once per request. Releases are capped at 50,000 members. Cache the viewable ids if this shows up in profiles.
  • The reconcile still loads every generated test and task across ontologies. The new indexes make only the id lookups cheap.

Tests:

  • The statement-count pins in OntologyShapeCheckReadsIT, IndependentOntologyMappingAdviceCountIT and OntologyTableMappingsIT rose after merging main (for example 48 to 53 per draft read). They were re-pinned without naming the new statements. The counts still stay flat across 1, 40 and 80 constraints, which is what the tests guard.

Checklist:

  • I have read CONTRIBUTING.md and the contributor docs.
  • No linked issue. The title is a plain description.
  • For JSON Schema changes, I updated the migration scripts.
  • I have added tests and listed them above.
  • Self-review against REVIEW.md on the final diff. Pending.
  • Decision check. The records are listed above.

Adds isDisplayName to ontologyProperty and createOntologyProperty, absent when
unset so existing release digests do not change. Only a data property may set
it, and a class has at most one such property, refused by the structure check
with DUPLICATE_DISPLAY_NAME. Turtle export writes om:displayNameIntent and the
importer reads it back.
Each table asset gains rowCount, profiledAt and sampled, read in one batched query from
the latest stored profile and returned only to callers holding ViewDataProfile on the table.
A reader who owns one of two profiled tables gets the facts of that table only, on both the page and the graph endpoints. A row sample is compared with the raw row count, equal profile timestamps resolve deterministically, and the pager reads profile facts only for clusters it keeps.
…ings in one query

A CSV import leaves the stored display-name flag as it is, because the format has no
column for it. An explicit false is stored as absent so it seals like an unset flag. The
sibling check reads only the flagged properties whose domain includes the class, in one
query, instead of every reference to the class. The sealed-content test asserts a literal
digest. Integration tests cover setting the flag by PATCH, a second flag by PUT and by
import apply, and restoring a flagged property.
…name flag, and the sibling read is a join

A CSV row keeps the stored display-name flag only while the property stays a
data property. The sibling lookup joins the property and reference tables so
that FOR UPDATE reads and locks both as current reads on MySQL. The put test
sends a real PUT and the false-flag test is named for what it proves.
… as SHACL

Adds the ontologyShape entity with typed constraints, release capture and
validation, SHACL Turtle export and import, and the storage migration.
…y a forged domain change in the display-name test

On MySQL the locking sibling read switched to a scan of every ontology's
property references for a heavily referenced class and locked all of them,
blocking writers to other ontologies. FORCE INDEX keeps the read, and its
locks, inside the ontology. The Postgres statement is unchanged.

The CSV domain test now applies a forged update that adds the domain class
and asserts the refusal.
… readable reports, status and policy upgrade
FORCE INDEX alone left the join order free. Once the target index was cached,
MySQL started from the property table and locked every property row of every
ontology. STRAIGHT_JOIN with the reference table first keeps the locking range
inside one ontology's index entries. The Postgres statement is unchanged.
A table binding says which table holds data about a class. It did not
say how one row becomes one record of the class. The schemas now let a
table binding carry a role, a subject key and a row filter, let a column
bound to an OBJECT property carry a join, and let an ontology name one
database as its mapping source. The mapping health schema describes the
read that lists what an editor still has to fix.

The native 2.2.0 migration adds three nullable columns to
ontology_concept_binding and backfills nothing, so rows written before
it read back with no role, no key and no filter. The statements open
the 2.2.0 folder, because 2.1.0 has shipped. Each one adds the columns
only where they are missing, so the runner can apply it again.

The RDF vocabulary declares the mappingSource predicate. The catalog
projection maps every entity field to a predicate, and its contract
test requires a declaration for each one. Ontology entities stay out
of the catalog graph, so no triple is written for it.

The decision record gives the rules and amends
ADR:2026-10-19-native-concept-bindings-remain-operational-metadata.
The binding DAO reads and writes the three new columns, and the store
gains the reads the checks need: the identity rows of a class, the
table rows of an ontology and the ontology's mapping source. A DAO test
runs the migration over a table that already holds rows, then runs it
a second time, and reads every row back as it was. The test database
of the ontology DAO tests now runs the 2.2.0 statements as well.

One step saves a binding row, under the ontology lock. It now checks
that a role comes with key columns of the bound table, that a class has
at most one identity table, that a row filter names a column of the
table, and that a column bound to an OBJECT property joins to a table
the writer may view in the same database. Once the ontology names a
mapping source, the table must sit in that database. A write that sets
or changes a row filter needs ViewSampleData on the table.

A write that repeats the stored row stays a no-op, so a binding written
before these rules stays valid until someone changes it.

OntologyBindingAccess takes over the entity loading and authorization
that the binding service did inline, so the checks and the service
share it. Two integration tests change with the code they call. One
writes a row through the new DAO signature. The other gives its
relation columns the join they now need.
mappingSource is a reference to one database entity, stored as a
MAPPED_TO relationship row and returned for fields=mappingSource, which
a reader with ViewBasic on the ontology may ask for. A create request
can name it, a PATCH sets, changes or removes it, and a PUT that names
none keeps the stored one. A deleted database is refused only where the
mapping source is set or changed.

A change records no new version of the ontology. A release digest
hashes the version of every member, so a versioned change would alter
the digest of the next capture although the mapping source is not
release content.
GET /v1/ontologies/{id}/mappingHealth pages the table bindings of an
ontology's classes and lists what an editor has to fix: a class with no
identity table, a binding with no role, a relation column with no join,
a join that is not confirmed, a key or a join whose columns do not
pair, and tables outside the mapping source or spread over several
databases.

The read uses catalog metadata only and never queries a bound table. It
names only the classes, tables and properties the caller may view. The
generated API reference lists the endpoint.
Integration tests for the binding API, the ontology mapping source and
the mapping health read, with the authorization of each. A row filter
write needs ViewSampleData on the table. A mapping source change needs
EditAll on the ontology. Mapping health names nothing the caller may
not view. Where a right decides a write, a user who holds it and is
not an admin makes that write. One test proves that a mapping source
change leaves the release digest as it is.
# Conflicts:
#	openmetadata-spec/src/main/resources/json/schema/type/ontologyProfileViolation.json
# Conflicts:
#	bootstrap/sql/migrations/native/2.2.0/mysql/schemaChanges.sql
#	bootstrap/sql/migrations/native/2.2.0/postgres/schemaChanges.sql
#	openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/OntologyTestDatabase.java
The concept statement was built by joining strings, and each dialect
quoted the names. A statement can now compare a column with a value, so
a value needs more care than a name.

A value reaches a statement only as a TypedValue, which TypedValues
parses as the data type of its column. A statement is a TypedStatement:
text the code wrote, names, typed values and search text, each kept
apart. An SqlEngineFamily writes it as finished text or as the form a
driver binds. Nine families write names and strings where six dialects
did, because two engines of one dialect can read a backslash
differently. Every service type keeps its dialect.

What changes in the generated statement:

- The JOIN lines carry no relation label comment. The response already
  returns each label in hops.
- Every colon is written as a backslash and a colon, so a reader of
  :name parameters finds none.
- A name that holds a control character is a 400.
- ClickHouse writes a backtick inside a name with a backslash before it
  and doubles a backslash.
- The statement applies the row filter of each table it reads. No
  caller passes a filter yet.

ADR:2026-11-22-generated-sql-keeps-typed-values-apart-from-its-text
A binding write stored a row filter value as given. Generated SQL now
compares the filter column with that value, so a write that sets or
changes a row filter parses each value as the data type of the filter
column. A value that does not parse is a 400 that names the column, the
data type and what the data type expects. The write answers it before
it checks ViewSampleData, as it already does for a missing column.

A write that sends the stored filter back unchanged does not parse it,
like every other stored part of a binding.
The statement of a concept selected every row of its tables. It now
keeps only the rows that the row filter of each table keeps.

The stored filter is parsed again when the statement is built, because
the filter column can change its data type or leave the table after the
write. A stored filter that no longer parses is a 400 that names the
table.
`ontology/sql-value-cases.json` gives 686 cases. Each case gives a value,
a name or a label as it can arrive, the data type of its column, and
what one engine family must do with it: the exact text, the parameters a
driver binds, or the refusal.

`OntologySqlValueCasesTest` runs each case for the family that it names.
A case for every family runs once per family when its outcome is text or
a bound form. The expected text of a case is the oracle, so no case is
edited to make the test pass.

The test skips 74 runs and gives the reason for each. 68 are constraint
value runs, which belong to the tests generated from shapes. Four are
writes that the authorizer refuses, which need a server. One writes
through a change set, and no change set operation writes a binding. One
is a stored count, which is no part of SQL generation.
`OntologySqlLiteralIT` writes each string of the value cases as the
engine family of the test database writes it, runs `SELECT <literal>`,
and reads the same characters back. On Postgres it does so with
`standard_conforming_strings` on and off. On MySQL with
`NO_BACKSLASH_ESCAPES` each value comes back with its backslashes
doubled and is still one value. A search finds its own text and no text
that only a wildcard would match.

`OntologyRowFilterValueIT` sends every refused value of the cases to
`PUT /v1/ontologyConcepts/{id}/bindings` and gets the 400 that each case
names. It asserts the full message for each data type, reads back a
value of the right type as it was written, and sends the four refused
writes of a caller without `ViewSampleData`. That caller gets a 403 when
setting a filter and when changing one.

`OntologyConceptQueryIT` gains two tests. The statement applies a stored
row filter, and a stored filter whose value no longer parses is a 400
that names the table.

The record now says what a search does on a MySQL server that runs with
`NO_BACKSLASH_ESCAPES`.
A value that arrives as a number was written in plain decimal form
before any length check. A decimal with a large exponent, such as
1E+2000000000, would write one digit for each power of ten. No request
reaches that today, because the JSON reader gives a double, but the
parser is the one entry point for every value.

A number now takes the 1,024 characters that a string takes, and a
decimal whose exponent passes that cap is refused before its digits are
written out.

Every `TypedValue` is now made in `TypedValues`, including the pattern
that a driver binds for a search.
A `TypedValue` held the data type of its column and the parsed value.
It now also holds the text that the value arrived as, so a caller can
return a value as it was written. `-0` parses as zero and keeps `-0`.
A number or a boolean keeps the text that JSON writes for it.

SQL is still written from the parsed value only, and `toString` still
names the data type alone, so a log line shows neither form.
…stream moved the container tests

Upstream removed the service module's OntologyTestDatabase and runs container tests against the suite's database server (#38626). The test now takes the lane's dialect instead of parameterising over both.
Upstream's TaskWorkflowHandler.saveChange calls patch without the impersonatedBy argument, which the repository now reads from ImpersonationContext. The test verified the six-argument form.
Upstream's RdfOntologyDescriptionContractTest requires every projected class and stored predicate to carry a comment and every shared predicate to list each class it is used on. The shape class, the shape fields, mappingSource and isDisplayName now satisfy it.
…nding

The binding DAO's upsert takes a StoredBinding that carries the role, subject key and row filter; the IT upstream added called the five-argument form.
…le reads

Upstream's suggestion task workflow now assigns platform admins when no owner resolves, and its table reads run three to six more statements that do not grow with the data. The ITs pin both.
Upstream's test mocks the edit form as a comment field, and this branch's test mocks it as a button that submits a filled payload. The later jest.mock replaced the earlier one, so upstream's comment test lost its field. One mock now serves both.
@harshach
harshach requested review from a team as code owners December 6, 2026 15:24
@harshach
harshach requested review from harsh-vador and mohityadav766 and removed request for a team December 6, 2026 15:24
@github-actions

github-actions Bot commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

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

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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

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

harshach and others added 6 commits December 6, 2026 09:15
The suggestion-type condition computes its result in one return, and the list endpoint validates suggestionType with validateCsvAgainstEnum, which now compares each enum's API form (toString) so generated enums whose constant names differ from their schema values pass.
… added

Two schemas gained enums that share a property name with an existing one, so
the TypeScript generator prefixed both and renamed Kind to PropertyKind and
State to ColumnState. Title the new enums EvidenceKind and RecordsState so the
existing ones keep Kind and State. Java types are unchanged: each enum has an
explicit javaType.
@gitar-bot

gitar-bot Bot commented Dec 6, 2026

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

Approving table-constraint suggestions can add primary, unique, or foreign-key constraints to existing tables, changing write acceptance and enforcing stored-data integrity.

Adds ontology table bindings with roles, subject keys, row filters and joins, plus record statements, shape checks and table constraint suggestions. Three issues from this session were resolved: paging.total no longer shrinks the next fetch limit and hides suggestions, the new suggestion-type condition no longer uses an early return against the ADR, and the validSuggestionTypes insertion no longer sits below another method's Javadoc. No open findings remain.

✅ 3 closed
✅ Bug: Adjusted paging.total shrinks the next fetch limit, hiding suggestions

📄 openmetadata-ui/src/main/resources/ui/src/rest/suggestionsAPI.ts:155-169 📄 openmetadata-ui/src/main/resources/ui/src/rest/suggestionsAPI.ts:186 📄 openmetadata-ui/src/main/resources/ui/src/rest/suggestionsAPI.ts:206
toShowableSuggestions subtracts only the TableConstraint tasks on the current page from paging.total. SuggestionsProvider.fetchSuggestions then feeds that number back as the next request's limit (setSuggestionLimit(paging.total)). The server keeps counting the constraint tasks inside that window, so each refetch comes back with fewer showable suggestions than it was sized for.

Example: an entity has 2 constraint tasks ordered first and 8 description suggestions. The first fetch shows 8, reports total = 8 and sets limit = 8. The next refetch with limit 8 returns the 2 constraint tasks plus 6 descriptions. Two description suggestions are never loaded, and the pending count stays at a non-zero value that "load more" cannot clear.

The total is also wrong whenever constraint tasks sit on pages that were not fetched. The fix is to filter Suggestion tasks server-side by suggestionType, or to keep the server's raw total for paging and limits and use the filtered length only for display.

✅ Quality: New suggestion-type condition uses an early return, against the ADR

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/ListFilter.java:503-514
getTaskSuggestionTypeCondition starts with a guard clause (if (nullOrEmpty(suggestionTypes)) { return ""; }) and then has a second return at the end. The Accepted record ADR:2026-11-20-a-method-returns-once says a value-returning method computes its result through a conditional and returns once, as its last statement, with no guard clauses. Because this method is new in this commit, it contradicts the record. Either restructure the method so it has a single return, or add a record that supersedes the ADR.

✅ Quality: validSuggestionTypes inserted below another method's Javadoc

📄 openmetadata-service/src/main/java/org/openmetadata/service/resources/tasks/TaskResource.java:2175-2189
The new validSuggestionTypes method sits between validateCsvAgainstEnum and that method's existing Javadoc, which explains that a CSV value outside a recognized Enum gets a clear error. The Javadoc now attaches to validSuggestionTypes, and validateCsvAgainstEnum is left with no documentation. Move the new method above the Javadoc block.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

Compact
gitar display:verbose         

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

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant