laserninja opened a new pull request, #12900:
URL: https://github.com/apache/gravitino/pull/12900

   ### What changes were proposed in this pull request?
   
   Surface schema-scoped Semantic Models in `web-v2`, alongside tables and 
logical views:
   
   - **Tree and list** — semantic models appear as schema children in the 
catalog tree, and in a new "Semantic Models" tab on the schema page with search 
and tag association.
   - **Detail page** — header with comment, owner, audit, tags and properties, 
plus tabs for Datasets (fields expandable per dataset), Relationships, Metrics, 
and the raw Definition with copy-to-clipboard.
   - **Create, edit and drop** — a dialog for name, comment, properties and the 
definition, and the same typed-name delete confirmation used elsewhere in the 
UI.
   
   The definition is authored as JSON. `src/lib/utils/semanticModel.js` checks 
the structural rules before the request is sent: datasets non-empty and 
uniquely named, `source.namespace` exactly `[catalog, schema]`, unique field 
names within a dataset, relationship endpoints resolving to declared datasets 
with matching column counts, and unique metric names. The server remains the 
authority, since it additionally resolves every dataset source and its columns 
against the catalog.
   
   Alters are built by diffing the loaded model against the edited one and 
emitted as a single ordered batch (`rename`, `updateComment`, `removeProperty`, 
`setProperty`, `replaceDefinition`), so editing only a comment does not emit 
`replaceDefinition` and does not make the server revalidate the definition's 
sources.
   
   The wire format follows the Semantic Model definition DTOs merged in #12624 
(camelCase: `aiContext`, `primaryKey`, `fromColumns`, `customExtensions`, 
`isTime`).
   
   Listing degrades silently on 404 and 405, so schema pages keep working 
against a server that does not expose the endpoint.
   
   ### Why are the changes needed?
   
   #12209 adds semantic metadata management to Gravitino, but the entities are 
not discoverable from the Web UI. This makes Semantic Models browsable and 
manageable next to the tables and views they are defined over.
   
   Fix: #12616
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, in `web-v2` only:
   
   - A new "Semantic Models" tab on relational schema pages, with create, edit, 
delete and tag association.
   - New semantic model nodes in the catalog tree.
   - A new semantic model detail page at `?...&semanticModel=<name>`.
   
   No API changes and no property keys added or removed.
   
   ### How was this patch tested?
   
   - **Unit tests** — 31 new tests in `src/lib/utils/semanticModel.test.js` 
covering the definition validator (each contract rule, and that all problems 
are reported rather than only the first) and the alter-diff builder (per-change 
emission, update ordering, comment clearing, and that a deeply equal definition 
emits no `replaceDefinition`). `pnpm test`: 74 passing.
   - **CI gates** — `pnpm lint`, `pnpm prettier:check` and `NODE_ENV=production 
pnpm dist` all pass locally.
   - **Manual, end-to-end in a browser** — against a stub server implementing 
the wire contract from #12624, since the REST endpoints (#12607, #12608) are 
not merged yet:
     - Tree nodes, list tab and detail page render; dataset rows expand to 
their fields; relationships, metrics and the raw definition display correctly.
     - An invalid definition is rejected client-side with all problems listed, 
and no request is sent.
     - Create issues `POST .../semantic-models` with `{name, comment, 
definition, properties}`.
     - Editing only the comment issues exactly `[{"@type":"updateComment", 
...}]` — no `replaceDefinition`.
     - Rename issues `[{"@type":"rename", ...}]`, and the tree and list follow 
the new name.
     - Delete issues `DELETE .../semantic-models/<name>` and removes the entry 
from both the list and the tree.
     - With the endpoint returning 404, the schema page still renders with an 
empty tab and no error toast.
   
   Once #12607 and #12608 land I will re-verify against a real server and 
report back on this PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to