Skip to content

Fixes 36737: Improve native ontology authoring and publication safeguards - #36738

Merged
harshach merged 10 commits into
mainfrom
agent/i-lost-session-in-capu-worki
Oct 31, 2026
Merged

harshach merged 10 commits into
mainfrom
agent/i-lost-session-in-capu-worki

Conversation

@harshach

@harshach harshach commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #36737

Native Ontology Studio can lose unsaved edits during navigation, accept misleading statement inputs, and show incomplete publication controls in AI mode. This change protects drafts through authoring and navigation, preserves native statement semantics, and makes review configuration and validation status available in both layouts.

  • Add accurate help for all six statement kinds, recursive previews, class/property selection by label or IRI, and validation tied to the current form.
  • Guard concept, property, axiom, settings and new-class drafts across selections, nested workflows, sidebar navigation and browser history. Keep uncertain class submissions locked until reconciliation.
  • Confirm asset unlinking, refresh the selected native model after library installation, and expose reviewer configuration, rejection details and publication stages in the shared AI UI.
  • Fix the owner-reference, class-axiom payload and server-default reconciliation issues exposed by the reported Playwright run, and update the affected browser fixtures and interactions.

Type of change:

  • Improvement

High-level design:

The native SQL entities and immutable release APIs remain authoritative. Forms register dirty state with the page's draft provider; confirmed transitions reuse the existing navigation guard. Programmatic interception is enabled only for ontology drafts, preserving WorkflowBuilder's save behavior. Browser history tests cover saving before Back/Forward and starting another edit session.

Shared classic/AI presentation stays in OpenMetadata; Collate owns AI enablement and integrations. This PR needs no Collate counterpart, schema migration or saved-axiom conversion.

The scope and all 57 gap dispositions and statement-semantics decision explain the native requirements. Prototype styling guides the UI. Multiple inheritance, independent approval, immutable releases and active-release query semantics are preserved. A new reasoner, datatype facets, quick-rule editor and extra lifecycle features remain separate product work.

Review fixes (ae3a918)

  • Added the navigation ownership ADR and cited it beside navigator interception.
  • Exact typed labels resolve to their unique IRI case-insensitively after trimming input whitespace. Duplicate labels still require explicit selection; external IRIs remain supported.
  • Fresh verification of this commit: 7 Jest suites / 56 tests passed, including four regressions that failed before the fix; 3/3 authoring browser cases passed in classic light and AI light/dark with zero retries. The browser cases verify the typed subject's persisted IRI. Production UI build, Playwright types, changed-file lint/format, decision-record and impact-map checks pass.
  • Whole-app types still report the existing RJSF validator mismatch. The broader implementation runs below predate this focused fix.

Tests:

Use cases covered

  • Author native class statements using readable references and previews; preserve empty literals and compatible expressions.
  • Cancel or discard unsaved changes without losing another mounted form's protection.
  • Save workflow edits and follow the original browser destination, including navigation state.
  • Confirm/cancel asset unlinking and verify persistence after reload.
  • Create, import, install, capture, independently review, publish and export native ontologies.
  • Exercise classic light, AI light/dark, keyboard sidebar navigation and the 924px layout.

Unit tests

  • yarn test Ontology useWorkflowNavigationBlock WorkflowBuilder --runInBand --silent --coverage: 154 suites / 1,601 tests passed.
  • Combined line coverage for the 23 selected changed sources: 92.41% (2,132/2,307); branches 87.44%. This is aggregate coverage, not a claim that every file reaches 90%. ExpressionEditor, DefinitionList, AxiomEditor and AxiomWorkspace remain below 90% individually; browser tests exercise their user flows.
  • Added/extended editor, IRI input, draft provider, page integration, change-set, publication and BrowserRouter navigation regressions.

Backend integration tests

Not applicable — no Java, API, schema or migration changes. plan_local_java_tests.py --check-branch passes. The backend distribution builds successfully with Java 21.

Ingestion integration tests

Not applicable — no ingestion changes.

Playwright (UI) tests

All reported runs use zero retries against the local MySQL/Elasticsearch stack.

  • 64/64 passed on runtime 3814a129c7f: native authoring, data/live-data, export, import, library, operations, relations, Studio/tree shell, first run, authoring safeguards, review/review tasks; workflow change-request lifecycle, Git sink token masking, no-op node configuration, recognizer/schema locks, condition negation, execution history and OSS restrictions.
  • Broader Chromium selection: 337 entity cases passed, 1 dashboard case passed after loading its repository sample fixture, and 55 remaining cases passed. 1 HealthCheck case fails because the isolated stack has no Airflow at port 8080.
  • 3/3 recording runs passed against Docker runtime 3814a129c7f.
  • Additional mapped projects passed: Basic 52, DataAssetRulesEnabled 32, DataAssetRulesDisabled 34, SearchRBAC 29, DomainIsolation 16, SystemCertificationTags 3, IntakeForm 20. Search relevance had 3 failures, 1 interrupted and 7 not run because its named sample-data fixtures are absent (API lookups return 404). Overall mapped results: 643 passed, 4 failed, 1 interrupted, 7 not run. The Airflow/sample-data-dependent checks and video upload remain outstanding.
  • The planner selects 48 specs; generated mapping is current and all changed sources have impact-map ownership. RDF/Fuseki and the full merge-queue suite were not run locally.

Other checks: changed-file ESLint/import ordering/Prettier, license headers, i18n sync, Playwright types and production UI build pass. Whole-app TypeScript still reports the existing CustomValidator mismatch at IngestionWorkflowForm.tsx:413. Existing repository-wide token-audit violations remain outside this change.

Manual testing performed

The following flows were driven with Playwright and visually inspected in the recordings:

  1. Open the Docker-served Studio with synthetic Customer/Person classes and an object property.
  2. Edit a class and switch surfaces; Cancel retains the draft, Discard removes it without writing.
  3. Edit and save concept/property/settings descriptions; verify the API response and subsequent navigation.
  4. Select Customer and Person by label, inspect the subclass preview, save and verify their exact persisted IRIs.
  5. Open Review & publish and inspect reviewer selection, approval rule and structural/logical validation status in classic light and AI light/dark.

UI screen recording:

Recorded runtime SHA: 3814a129c7f19ee7ac3cc06121e0cd91507fd080. These clips predate the exact-label fix in ae3a9181b47a7c1757235d5e01652f347651ced0 and need refreshing before upload.

Built the UI and Maven distribution locally, packaged image ontology-single-pr:3814a129c7f, and started it on the isolated ontology-single-pr Docker network with MySQL and Elasticsearch. GET /api/v1/system/version returns the recorded SHA; database, search, JWT and migrations checks pass. Airflow is absent. The stack remains running.

Repository sample data includes ontology_review_sample_data.ecommerce_db.shopify."dim.shop"; synthetic ontology fixtures are created through the API. The dashboard sample fixture also required omitting one invalid quoted nested-column name; no source fixture was changed.

Three original WebM clips at 1920×1080/25fps, approximately 45–48 seconds each. Beginning, changed-state and final frames were inspected for readable controls and unclipped dialogs. GitHub upload is pending; local references below will be replaced with hosted attachments before readiness.

Classic light:

AI light:

AI dark:

Checklist:

  • Read CONTRIBUTING.md and followed the PR template.
  • Title follows Fixes <issue-number>: <short explanation>; linked issue above.
  • Comments explain non-obvious navigation/reconciliation behavior.
  • Schema migrations: not applicable.
  • Verified GitHub-hosted recording embedded; local capture is complete, upload pending.
  • Added tests for changed logic and listed results and limitations.
  • Self-review against REVIEW.md at ae3a9181b47a7c1757235d5e01652f347651ced0; independent review found no unanswered blocking findings.
  • Decision record included for native statement semantics and prototype scope.

@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Oct 31, 2026
@harshach
harshach marked this pull request as ready for review October 31, 2026 01:14
@harshach
harshach requested a review from a team as a code owner October 31, 2026 01:14
@harshach
harshach requested a review from Rohit0301 October 31, 2026 01:14
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

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

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

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

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 3 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 3 warning(s) across 2 changed file(s).

Count Rule
2 openmetadata-imports/review-sequential-api-calls
1 openmetadata-imports/no-api-calls-in-iteration
All findings
Location Rule Message
🟡 src/components/governance/ontology/OntologyGraphView/OntologyGraphView.tsx:585:9 openmetadata-imports/review-sequential-api-calls Review these sequential API requests. If they are independent, start them together with Promise.all/Promise.allSettled; keep sequencing only when data-dependent
🟡 src/hooks/governance/ontology/useOntologyChangeSetApply.ts:191:30 openmetadata-imports/no-api-calls-in-iteration Avoid issuing one API request per item. Fetch at the data owner, use a bulk endpoint, or use useQueries with an intentional concurrency policy.
🟡 src/hooks/governance/ontology/useOntologyChangeSetApply.ts:357:9 openmetadata-imports/review-sequential-api-calls Review these sequential API requests. If they are independent, start them together with Promise.all/Promise.allSettled; keep sequencing only when data-dependent

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@gitar-bot

gitar-bot Bot commented Oct 31, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 2 closed / 2 findings

🔴 High risk · Ontology axiom payload shaping and draft reconciliation affect persisted model statements; incorrect handling could store incomplete or unintended ontology semantics.

Protects native ontology drafts across navigation, nested workflows and browser history, and resolves exact typed class labels to their unique IRI. Navigator interception is now documented in an ADR, and typing an exact class label stores the IRI rather than the label text. No open issues found.

✅ 2 closed
✅ Quality: Navigator interception rule is decided but recorded nowhere

📄 openmetadata-ui/src/main/resources/ui/src/hooks/useWorkflowNavigationBlock.ts:118-132 📄 openmetadata-ui/src/main/resources/ui/src/hooks/useWorkflowNavigationBlock.ts:145-159 📄 openmetadata-ui/src/main/resources/ui/src/hooks/useWorkflowNavigationBlock.ts:228 📄 openmetadata-ui/src/main/resources/ui/src/context/OntologyDraft/OntologyDraftProvider.tsx:54-60
useWorkflowNavigationBlock now replaces the shared navigator.push/replace from UNSAFE_NavigationContext, so it also catches sidebar buttons outside the editor. It only does this when blockProgrammaticNavigation is set, and only OntologyDraftProvider sets it. The popstate listener is now registered in the capture phase and calls stopImmediatePropagation so it runs before React Router's own listener. Correctness depends on ordering you can't see from one file: only one owner may patch the navigator at a time (restores happen in LIFO order), and WorkflowBuilder must keep the flag off. The description states this rule: "programmatic interception is enabled only for ontology drafts so WorkflowBuilder's save behavior is preserved". The plan doc and the new ADR don't mention it. The new ADR only covers statement labels and the 50-option IRI cap. Because the repo squash-merges, this sentence never reaches git log. The missing record would say: "Only the ontology draft provider intercepts programmatic router navigation by patching the shared navigator; at most one interceptor may be active, and WorkflowBuilder relies on link/popstate blocking only so that its save-then-View transition is not intercepted."

✅ Edge Case: Typing a class label exactly stores the label text, not the IRI

📄 openmetadata-ui/src/main/resources/ui/src/components/governance/ontology/OntologyIriInput/OntologyIriInput.tsx:70-83
onInputChange passes the raw text to onChange whenever it differs from the label of the currently selected option. Say a user types a local class's full label (e.g. Customer), or edits a selected label and retypes it. selected is already undefined at that point, so the label string itself is stored as subjectIri/propertyIri/classIri. With allowsCustomValue, the react-aria ComboBox keeps that custom value on blur and does not select the matching item. The field then looks exactly like a resolved selection, but the request carries Customer instead of urn:...:Customer. One fix is to resolve an exact (case-insensitive) label match to its IRI in onInputChange, or to do it on blur.

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

@github-actions

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 80%
80.88% (136715/169019) 67.78% (49057/72371) 70.82% (27620/38999)

@sonarqubecloud

Copy link
Copy Markdown

@harshach
harshach merged commit 3f90835 into main Oct 31, 2026
71 of 73 checks passed
@harshach
harshach deleted the agent/i-lost-session-in-capu-worki branch October 31, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve native Ontology Studio authoring safeguards and publication clarity

1 participant