Skip to content

Fixes 34974: Define the RDF reasoning protocol and record the serving revision - #34975

Merged
harshach merged 16 commits into
mainfrom
feat/rdf-reasoning-contracts
Oct 10, 2026
Merged

harshach merged 16 commits into
mainfrom
feat/rdf-reasoning-contracts

Conversation

@harshach

@harshach harshach commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes #34974

Stacked on #34970 (phase 0, itself stacked on #34963): this PR's base is that branch, so merge those first.

Phase 2 of docs/plans/2026-10-07-fuseki-native-reasoning.md. It defines the typed protocol between OpenMetadata and the RDF store's reasoning, and records which serving graph a reasoning result read, so a result can always say whether it is still current. Nothing serves reasoning results yet; phases 4 and 7 build on these contracts.

Type of change:

  • New feature

High-level design:

Two commits:

  1. Protocol schemas under api/rdf/:
    • rdfReasoningJobRequest.json: REFRESH, CHECK (consistency, satisfiability, subsumption, entailment over ontologyExpression/rdfStatement) or EXPLAIN, with an idempotency key, the source revision, the ontology selection, OM's digests and a bounded rule bundle. No files, URLs or code.
    • rdfReasoningJob.json: execution state (QUEUED … INTERRUPTED), the answer of a check (ENTAILED, NOT_ENTAILED, INCONSISTENT, INCOMPLETE) and a structured problem, as separate fields.
    • rdfReasoningCapabilities.json: protocol version, readiness, engines, coverage, memory budget and limits.
    • rdfReasoningSnapshot.json: the input a result was computed from (source revision, selection, digests, engines) and its freshness (CURRENT, STALE, UNKNOWN).
    • Example documents under rdf/reasoning/ pin the wire format for the store. The OM-facing fields (requireCurrent, snapshot metadata on SPARQL responses and inference status, reasoning configuration) move to phase 7, which implements them: a flag the server accepted but ignored would let clients believe stale answers were rejected.
  2. Serving revision.
    • Generation. rdf_active_dataset.generation gets a new UUID at every promotion, including promotions back to a reused physical name. Servers assign one on startup to a pointer written before the column existed. The unused setActiveDataset DAO method now assigns one too.
    • Watermarks. RdfLiveWriteStore reports the enqueued watermark (highest queue ID handed out, kept in rdf_projection_health.enqueuedWatermark because processed rows are deleted) and the acknowledged watermark (highest ID below which every write is applied or dead-lettered).
    • Writes outside the queue take the next queue ID without leaving a row to deliver, so servers on an older version still drain the queue normally. The admin SPARQL Update, pipeline-status provenance and in-place reindex runs (before their first write and after their last) record themselves; a write that cannot be recorded marks the projection degraded. Rule output and insights graphs are derived and never captured; OntologyLoader reloads identical content and is covered by the ontology digest.
    • Freshness rule (ReasoningFreshness): UNKNOWN while the projection is degraded, since a refresh cannot repair a graph that is missing writes; otherwise CURRENT only when the generation, the watermark and both digests still match, and STALE when any does not.

Migrations (unreleased 2.1.0, both engines): add rdf_active_dataset.generation and rdf_projection_health.enqueuedWatermark (guarded ALTER on MySQL, IF NOT EXISTS on Postgres).

Alternatives considered:

  • Delivering a no-op marker through the queue for writes outside it: a server on the previous version would fail to read it and dead-letter it, leaving the projection degraded until a full rebuild.
  • Advancing a watermark column when the drainer applies a write: it needs a change on the delivery path and cannot pass IDs that never had a row.

Tests:

Use cases covered

  • Every promotion gets a new generation, also when the physical dataset name repeats; a restarted server sees the same generation; a pointer from before generations gets one that every server shares.
  • The watermark passes a write only once it is applied: a failed attempt leaves it behind, the retry moves it, and a restarted server reads the same value.
  • A write outside the queue takes the next ID and leaves nothing to deliver.
  • A dead-lettered write moves the watermark on and leaves the projection degraded.
  • The admin SPARQL Update, a pipeline run recorded in the graph, and an in-place reindex each move the enqueued watermark.
  • Freshness: current when everything matches; stale after a later write, a promotion, or changed ontologies or rules; unknown while the projection is degraded, ahead of any known change.
  • Protocol: every example satisfies its schema and survives the generated model; the schemas reject a malformed digest, a negative watermark, a missing source revision, an undefined field, too many rules, INCOMPLETE as a state, STALE as an answer, SUCCEEDED as a freshness, a problem without a code, and a non-numeric protocol version.

Unit tests

  • I added unit tests for the new/changed logic.
  • Added: RdfReasoningContractTest (34), ReasoningFreshnessTest (7).
  • Run locally with the ITs below: RdfReasoningContractTest 34, ReasoningFreshnessTest 7, RdfSparqlServiceTest 11, RdfUpdaterTest 11, RdfLiveWriterTest 5, RdfProjectionHealthTest 3, MigrationWorkflowReprocessingTest 23, RdfIndexAppTest (nested), 130 tests in all, 0 failures.
  • RdfRebuildStore has no unit test: it is SQL against MySQL and Postgres, and RdfBlueGreenRebuildIT exercises it on both.
  • Not covered by any test: RdfUpdater.recordUntrackedWrite marking the projection degraded when the write cannot be recorded. It comes with the next change to this PR.

Backend integration tests

  • Added RdfSourceRevisionIT; added generation cases to RdfBlueGreenRebuildIT and watermark cases to RdfLiveWriteRecoveryIT, whose test database now applies the 2.1.0 changes to rdf_active_dataset and rdf_projection_health.
  • Run locally (MySQL + Elasticsearch server; the two store ITs cover MySQL and Postgres each): RdfBlueGreenRebuildIT 34, RdfLiveWriteRecoveryIT 28, RdfSourceRevisionIT 3, 0 failures. With the three recording calls removed, RdfSourceRevisionIT fails 3/3 at its watermark assertions.
  • Flake: MetricResourceIT.rejectMetricUpdateRollsBackPreviousApprovedVersion failed once in the MySQL parallel lane (run 37839247898, attempt 1). The approval workflow did not return the metric to In Review within 5 minutes, after its first approval had taken about 3. It passed locally on this branch, on the re-run of that lane, and in the Postgres run; it does not touch RDF. The planner's full selection runs in CI on this branch and is recorded below once it passes.

Local Java test run: PASSED

  • Commit: 1680d6817348 (base origin/refactor/rdf-inference-correctness)
  • Finished: 2026-10-08 21:57 UTC · 2.6 min
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-service (21 classes) 31 221 0 0 2.6 passed
integration mysql-elasticsearch · parallel passed in CI
integration mysql-elasticsearch · isolated passed in CI
integration mysql-elasticsearch · rdf passed in CI
integration cache-tests · parallel passed in CI
integration postgres-opensearch · parallel passed in CI
integration postgres-opensearch · isolated passed in CI
integration postgres-opensearch · rdf passed in CI

Selected but produced no report: AlertBacklogMigrationIT (mysql-elasticsearch · parallel), AppMarketPlaceResourceIT (mysql-elasticsearch · parallel), AppOperationPermissionsIT (mysql-elasticsearch · parallel), AppRunInterruptionIT (mysql-elasticsearch · parallel), ConfigResourceIT (mysql-elasticsearch · parallel), ContainerResourceIT (mysql-elasticsearch · parallel), ContextMemoryStatusMigrationIT (mysql-elasticsearch · parallel), ContinuousMigrationIT (mysql-elasticsearch · parallel), CreationAuditMigrationIT (mysql-elasticsearch · parallel), CsvAsyncJobResourceIT (mysql-elasticsearch · parallel), DataProductDomainMigrationIT (mysql-elasticsearch · parallel), DataQualityDimensionMigrationIT (mysql-elasticsearch · parallel), DataRetentionAppIT (mysql-elasticsearch · parallel), DatabaseResourceIT (mysql-elasticsearch · parallel), DatabaseSmokeIT (mysql-elasticsearch · parallel), DbTuneIT (mysql-elasticsearch · parallel), EntityCacheInvalidationIT (mysql-elasticsearch · parallel), EntityCacheMemoryIT (mysql-elasticsearch · parallel), EntityCursorOffsetIT (mysql-elasticsearch · parallel), EntityDeleteTaskCleanupIT (mysql-elasticsearch · parallel), EntityHardDeletionAtomicityIT (mysql-elasticsearch · parallel), EntityHistoryPaginationIT (mysql-elasticsearch · parallel), EntityLifecycleStagesIT (mysql-elasticsearch · parallel), EntityNameIndexIT (mysql-elasticsearch · parallel), EntityProfileResourceIT (mysql-elasticsearch · parallel), EntityRelationshipCleanupIT (mysql-elasticsearch · parallel), EntityShapeBaselineIT (mysql-elasticsearch · parallel), EntityStatusWorkflowOwnershipIT (mysql-elasticsearch · parallel), EntitySubtreeAtomicityIT (mysql-elasticsearch · parallel), EntityTransactionBoundaryIT (mysql-elasticsearch · parallel), EntityUpdateLockOrderIT (mysql-elasticsearch · parallel), EntityUtilValidateEntityReferenceIT (mysql-elasticsearch · parallel), GlossaryRdfImportIT (mysql-elasticsearch · parallel), GlossaryTermInheritedReviewerApprovalIT (mysql-elasticsearch · parallel), GlossaryTermMoveApprovalIT (mysql-elasticsearch · parallel), GlossaryTermRealizationIT (mysql-elasticsearch · parallel), GlossaryTermRelationAdvancedIT (mysql-elasticsearch · parallel), GlossaryTermRelationEdgeCasesIT (mysql-elasticsearch · parallel), GlossaryTermRelationEdgeIT (mysql-elasticsearch · parallel), GlossaryTermRelationFixesIT (mysql-elasticsearch · parallel), GlossaryTermRelationIT (mysql-elasticsearch · parallel), GlossaryTermRelationSettingsIT (mysql-elasticsearch · parallel), GlossaryTermRelationSettingsPermissionsIT (mysql-elasticsearch · parallel), GlossaryTermRelationUsageIT (mysql-elasticsearch · parallel), GlossaryTermRelationsIT (mysql-elasticsearch · parallel), GlossaryTermResourceIT (mysql-elasticsearch · parallel), K8sOMJobOperatorIT (mysql-elasticsearch · parallel), LifeCycleCreatedSentinelMigrationIT (mysql-elasticsearch · parallel), MessagingServiceResourceIT (mysql-elasticsearch · parallel), MetricResourceIT (mysql-elasticsearch · parallel), OntologyAiResourceIT (mysql-elasticsearch · parallel), OntologyAxiomResourceIT (mysql-elasticsearch · parallel), OntologyBulkIT (mysql-elasticsearch · parallel), OntologyChangeSetIT (mysql-elasticsearch · parallel), OntologyEditLockResourceIT (mysql-elasticsearch · parallel), OntologyEffectiveAttributesIT (mysql-elasticsearch · parallel), OntologyGovernanceIT (mysql-elasticsearch · parallel), OntologyImpactIT (mysql-elasticsearch · parallel), OntologyModelingIT (mysql-elasticsearch · parallel), OntologyPackResourceIT (mysql-elasticsearch · parallel), OntologyPatternIT (mysql-elasticsearch · parallel), OntologyResourceIT (mysql-elasticsearch · parallel), OntologyStructureIT (mysql-elasticsearch · parallel), OntologySubsetIT (mysql-elasticsearch · parallel), OpenMetadataOperationsIT (mysql-elasticsearch · parallel), OverrideMetadataRestoreMigrationIT (mysql-elasticsearch · parallel), PipelineResourceIT (mysql-elasticsearch · parallel), PipelineServiceResourceIT (mysql-elasticsearch · parallel), PipelineStatusAuthorizationIT (mysql-elasticsearch · parallel), RdfScaleResourcesTest (mysql-elasticsearch · parallel), SampleDataStorageMigrationIT (mysql-elasticsearch · parallel), SavedSparqlQueryResourceIT (mysql-elasticsearch · parallel), SearchIndexFieldLimitIT (mysql-elasticsearch · parallel), SearchIndexImmenseTermIT (mysql-elasticsearch · parallel), SearchIndexPromotionIT (mysql-elasticsearch · parallel), SearchIndexResourceIT (mysql-elasticsearch · parallel), SearchIndexingFieldsParityIT (mysql-elasticsearch · parallel), SearchServiceResourceIT (mysql-elasticsearch · parallel), SeedDataPresenceIT (mysql-elasticsearch · parallel), ServiceLineagePipelineRoutingMigrationIT (mysql-elasticsearch · parallel), SoftDeleteRetentionIT (mysql-elasticsearch · parallel), StorageServiceResourceIT (mysql-elasticsearch · parallel), TableResourceIT (mysql-elasticsearch · parallel), TagResourceIT (mysql-elasticsearch · parallel), TestCaseRelationshipRetentionCleanupIT (mysql-elasticsearch · parallel), TopicResourceIT (mysql-elasticsearch · parallel), UserResourceIT (mysql-elasticsearch · parallel), AppsResourceIT (mysql-elasticsearch · isolated), ConversationSchemaMigrationIT (mysql-elasticsearch · isolated), DataContractValidationAppIT (mysql-elasticsearch · isolated), EntityShapeIT (mysql-elasticsearch · isolated), GlossaryOntologyExportIT (mysql-elasticsearch · isolated), MetricMigrationIT (mysql-elasticsearch · isolated), SearchIndexRetryQueueIT (mysql-elasticsearch · isolated), TagRecognizerFeedbackIT (mysql-elasticsearch · isolated), AgentSparqlResourceIT (mysql-elasticsearch · rdf), LodResourceIT (mysql-elasticsearch · rdf), RdfBatchFieldsIT (mysql-elasticsearch · rdf), RdfBlueGreenRebuildIT (mysql-elasticsearch · rdf), RdfConceptRealizationIT (mysql-elasticsearch · rdf), RdfFusekiAuthorizationIT (mysql-elasticsearch · rdf), RdfGlossaryGraphIT (mysql-elasticsearch · rdf), RdfGovernanceRulesIT (mysql-elasticsearch · rdf), RdfGraphExploreIT (mysql-elasticsearch · rdf), RdfIndexAppScaleIT (mysql-elasticsearch · rdf), RdfIndexRunRecoveryIT (mysql-elasticsearch · rdf), RdfInferenceMaterializationIT (mysql-elasticsearch · rdf), RdfLiveProjectionIT (mysql-elasticsearch · rdf), RdfLiveWriteRecoveryIT (mysql-elasticsearch · rdf), RdfReindexFailuresIT (mysql-elasticsearch · rdf), RdfReindexInsertOnlyIT (mysql-elasticsearch · rdf), RdfReindexRunLockIT (mysql-elasticsearch · rdf), RdfRelationExclusionsIT (mysql-elasticsearch · rdf), RdfResourceIT (mysql-elasticsearch · rdf), RdfRoundTripFidelityIT (mysql-elasticsearch · rdf), RdfSemanticSearchIT (mysql-elasticsearch · rdf), RdfSourceRevisionIT (mysql-elasticsearch · rdf), RdfSqlResourceIT (mysql-elasticsearch · rdf), RdfStorageReadinessIT (mysql-elasticsearch · rdf), RdfTagsTierCertificationIT (mysql-elasticsearch · rdf), BundleWarmupCertificationIT (cache-tests · parallel), ContainerCacheCorrectnessIT (cache-tests · parallel), EntityCacheWriteOrderIT (cache-tests · parallel), TagRenameCacheIT (cache-tests · parallel), AlertBacklogMigrationIT (postgres-opensearch · parallel), ConfigResourceIT (postgres-opensearch · parallel), ContextMemoryStatusMigrationIT (postgres-opensearch · parallel), ContinuousMigrationIT (postgres-opensearch · parallel), CreationAuditMigrationIT (postgres-opensearch · parallel), DataProductDomainMigrationIT (postgres-opensearch · parallel), DataQualityDimensionMigrationIT (postgres-opensearch · parallel), DatabaseSmokeIT (postgres-opensearch · parallel), DbTuneIT (postgres-opensearch · parallel), GlossaryRdfImportIT (postgres-opensearch · parallel), GlossaryTermResourceIT (postgres-opensearch · parallel), LifeCycleCreatedSentinelMigrationIT (postgres-opensearch · parallel), OntologyAiResourceIT (postgres-opensearch · parallel), OntologyAxiomResourceIT (postgres-opensearch · parallel), OntologyBulkIT (postgres-opensearch · parallel), OntologyChangeSetIT (postgres-opensearch · parallel), OntologyEditLockResourceIT (postgres-opensearch · parallel), OntologyEffectiveAttributesIT (postgres-opensearch · parallel), OntologyGovernanceIT (postgres-opensearch · parallel), OntologyImpactIT (postgres-opensearch · parallel), OntologyModelingIT (postgres-opensearch · parallel), OntologyPackResourceIT (postgres-opensearch · parallel), OntologyPatternIT (postgres-opensearch · parallel), OntologyResourceIT (postgres-opensearch · parallel), OntologyStructureIT (postgres-opensearch · parallel), OntologySubsetIT (postgres-opensearch · parallel), OpenMetadataOperationsIT (postgres-opensearch · parallel), OverrideMetadataRestoreMigrationIT (postgres-opensearch · parallel), RdfScaleResourcesTest (postgres-opensearch · parallel), SampleDataStorageMigrationIT (postgres-opensearch · parallel), SavedSparqlQueryResourceIT (postgres-opensearch · parallel), SeedDataPresenceIT (postgres-opensearch · parallel), ServiceLineagePipelineRoutingMigrationIT (postgres-opensearch · parallel), TableResourceIT (postgres-opensearch · parallel), UserResourceIT (postgres-opensearch · parallel), ConversationSchemaMigrationIT (postgres-opensearch · isolated), GlossaryOntologyExportIT (postgres-opensearch · isolated), MetricMigrationIT (postgres-opensearch · isolated), AgentSparqlResourceIT (postgres-opensearch · rdf), LodResourceIT (postgres-opensearch · rdf), RdfBatchFieldsIT (postgres-opensearch · rdf), RdfBlueGreenRebuildIT (postgres-opensearch · rdf), RdfConceptRealizationIT (postgres-opensearch · rdf), RdfFusekiAuthorizationIT (postgres-opensearch · rdf), RdfGlossaryGraphIT (postgres-opensearch · rdf), RdfGovernanceRulesIT (postgres-opensearch · rdf), RdfGraphExploreIT (postgres-opensearch · rdf), RdfIndexAppScaleIT (postgres-opensearch · rdf), RdfIndexRunRecoveryIT (postgres-opensearch · rdf), RdfInferenceMaterializationIT (postgres-opensearch · rdf), RdfLiveProjectionIT (postgres-opensearch · rdf), RdfLiveWriteRecoveryIT (postgres-opensearch · rdf), RdfReindexFailuresIT (postgres-opensearch · rdf), RdfReindexInsertOnlyIT (postgres-opensearch · rdf), RdfReindexRunLockIT (postgres-opensearch · rdf), RdfRelationExclusionsIT (postgres-opensearch · rdf), RdfResourceIT (postgres-opensearch · rdf), RdfRoundTripFidelityIT (postgres-opensearch · rdf), RdfSemanticSearchIT (postgres-opensearch · rdf), RdfSourceRevisionIT (postgres-opensearch · rdf), RdfSqlResourceIT (postgres-opensearch · rdf), RdfStorageReadinessIT (postgres-opensearch · rdf), RdfTagsTierCertificationIT (postgres-opensearch · rdf)

Tests run locally

  • unit · openmetadata-service (21 classes): 31 classes, 221 tests executed (listed below)
  • integration · mysql-elasticsearch · parallel: every lane class, in this CI run
  • integration · mysql-elasticsearch · isolated: every lane class, in this CI run
  • integration · mysql-elasticsearch · rdf: every lane class, in this CI run
  • integration · cache-tests · parallel: every lane class, in this CI run
  • integration · postgres-opensearch · parallel: every lane class, in this CI run
  • integration · postgres-opensearch · isolated: every lane class, in this CI run
  • integration · postgres-opensearch · rdf: every lane class, in this CI run
unit · openmetadata-service (21 classes): 31 classes

AgentSparqlServiceTest (18 passed), CollectionDAOCompositionTest (2 passed), CustomOntologyRepositoryTest (5 passed), InferenceRunLockTest (4 passed), MetricGroupRepositoryTest (16 passed), MigrationWorkflowReprocessingTest (23 passed), OntologyAnnexServiceTest (1 passed), OntologyEditLeasePolicyTest (6 passed), PipelineStatusComparisonTest (4 passed), RdfIndexAppTest (0 passed), RdfIndexAppTest$AdmissionTests (3 passed), RdfIndexAppTest$BlueGreenLifecycleTests (5 passed), RdfIndexAppTest$EntityRelationshipConversionTests (3 passed), RdfIndexAppTest$EntitySelectionTests (5 passed), RdfIndexAppTest$InitializationTests (2 passed), RdfIndexAppTest$PromotionRatioGateTests (4 passed), RdfIndexAppTest$RunLockTests (4 passed), RdfIndexAppTest$RunRecordUpdateTests (7 passed), RdfIndexAppTest$StopFunctionalityTests (2 passed), RdfIndexAppTest$ValidationTests (1 passed), RdfInferenceRuleRowMapperTest (3 passed), RdfLiveWriterTest (5 passed), RdfProjectionHealthTest (3 passed), RdfProjectionStateResolverTest (9 passed), RdfReasoningContractTest (34 passed), RdfReindexResourceTest (11 passed), RdfScheduleMigrationTest (1 passed), RdfSparqlServiceTest (11 passed), RdfUpdaterTest (11 passed), ReasoningFreshnessTest (7 passed), TestCaseRepositoryTest (11 passed)

Why these tests
  • area apps-jobs ← openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/rdf/RdfIndexApp.java
  • area messaging-pipelines-storage ← openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PipelineRepository.java
  • area migrations-seed-data ← bootstrap/sql/migrations/native/2.1.0/mysql/schemaChanges.sql, bootstrap/sql/migrations/native/2.1.0/postgres/schemaChanges.sql
  • area rdf ← openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/rdf/RdfIndexApp.java, openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/RdfInfraDAOs.java, openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfLiveWriteStore.java, openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfSparqlService.java, openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfUpdater.java (+7 more)
  • called from entity Entity ← openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfUpdater.java
  • called from entity GlossaryTerm ← openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfUpdater.java
  • called from entity Pipeline ← openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PipelineRepository.java, openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfUpdater.java
  • called from entity Rdf ← openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfSparqlService.java, openmetadata-service/src/main/java/org/openmetadata/service/rdf/rebuild/RdfDatasetManager.java, openmetadata-service/src/main/java/org/openmetadata/service/rdf/rebuild/RdfRebuildStore.java
  • called from entity Tag ← openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfUpdater.java
  • changed test ← openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/RdfBlueGreenRebuildIT.java, openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/RdfLiveWriteRecoveryIT.java, openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/RdfSourceRevisionIT.java, openmetadata-service/src/test/java/org/openmetadata/service/rdf/RdfReasoningContractTest.java, openmetadata-service/src/test/java/org/openmetadata/service/rdf/reasoning/ReasoningFreshnessTest.java
  • entity Pipeline ← openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PipelineRepository.java
  • smoke ← code other than a test class changed
Impacted, not run locally (4)
  • RdfCatalogScaleIT → only with -DrdfCatalogScale=true, which no CI lane sets
  • OntologyScaleIT → nightly: openmetadata-nightly k8s-java-it (scale-it)
  • EntityLoaderSmokeUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • PipelineOwnerIndexUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
Commands
mvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=AgentSparqlServiceTest,CollectionDAOCompositionTest,CustomOntologyRepositoryTest,InferenceRunLockTest,MetricGroupRepositoryTest,MigrationWorkflowReprocessingTest,OntologyAnnexServiceTest,OntologyEditLeasePolicyTest,PipelineStatusComparisonTest,RdfIndexAppTest,RdfInferenceRuleRowMapperTest,RdfLiveWriterTest,RdfProjectionHealthTest,RdfProjectionStateResolverTest,RdfReasoningContractTest,RdfReindexResourceTest,RdfScheduleMigrationTest,RdfSparqlServiceTest,RdfUpdaterTest,ReasoningFreshnessTest,TestCaseRepositoryTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=<87 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state -Dit.test=AppsResourceIT,ConversationSchemaMigrationIT,DataContractValidationAppIT,EntityShapeIT,GlossaryOntologyExportIT,MetricMigrationIT,SearchIndexRetryQueueIT,TagRecognizerFeedbackIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=rdf -Dit.test=AgentSparqlResourceIT,LodResourceIT,RdfBatchFieldsIT,RdfBlueGreenRebuildIT,RdfConceptRealizationIT,RdfFusekiAuthorizationIT,RdfGlossaryGraphIT,RdfGovernanceRulesIT,RdfGraphExploreIT,RdfIndexAppScaleIT,RdfIndexRunRecoveryIT,RdfInferenceMaterializationIT,RdfLiveProjectionIT,RdfLiveWriteRecoveryIT,RdfReindexFailuresIT,RdfReindexInsertOnlyIT,RdfReindexRunLockIT,RdfRelationExclusionsIT,RdfResourceIT,RdfRoundTripFidelityIT,RdfSemanticSearchIT,RdfSourceRevisionIT,RdfSqlResourceIT,RdfStorageReadinessIT,RdfTagsTierCertificationIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pcache-tests -DintegrationTests.lane=parallel -Dit.test=BundleWarmupCertificationIT,ContainerCacheCorrectnessIT,EntityCacheWriteOrderIT,TagRenameCacheIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=parallel '-Dit.test=<35 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=global-state -Dit.test=ConversationSchemaMigrationIT,GlossaryOntologyExportIT,MetricMigrationIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=rdf -Dit.test=AgentSparqlResourceIT,LodResourceIT,RdfBatchFieldsIT,RdfBlueGreenRebuildIT,RdfConceptRealizationIT,RdfFusekiAuthorizationIT,RdfGlossaryGraphIT,RdfGovernanceRulesIT,RdfGraphExploreIT,RdfIndexAppScaleIT,RdfIndexRunRecoveryIT,RdfInferenceMaterializationIT,RdfLiveProjectionIT,RdfLiveWriteRecoveryIT,RdfReindexFailuresIT,RdfReindexInsertOnlyIT,RdfReindexRunLockIT,RdfRelationExclusionsIT,RdfResourceIT,RdfRoundTripFidelityIT,RdfSemanticSearchIT,RdfSourceRevisionIT,RdfSqlResourceIT,RdfStorageReadinessIT,RdfTagsTierCertificationIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false

Ingestion integration tests

  • Not applicable — no ingestion changes.

Playwright (UI) tests

  • Not applicable — the only UI files are new generated TypeScript types that nothing imports yet.

Manual testing performed

No manual server testing; the behaviour has no API surface until phase 7. On a deployment with RDF enabled, after this PR:

  1. SELECT generation FROM rdf_active_dataset returns a UUID; a blue/green rebuild (recreateIndex and blueGreenRebuild) replaces it.
  2. SELECT enqueuedWatermark FROM rdf_projection_health grows with each entity change and with each admin SPARQL Update.

UI screen recording / screenshots:

Not applicable — no UI behavior changes.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: four new schemas under api/rdf/, with generated TypeScript; the new columns have their migrations above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • I have added a test that covers the exact scenario we are fixing (RdfBlueGreenRebuildIT, RdfLiveWriteRecoveryIT, RdfSourceRevisionIT).

SPARQL inference built a Jena inference model inside the OpenMetadata JVM by
copying the whole Fuseki store into the heap with CONSTRUCT { ?s ?p ?o }. With
rdf.inferenceEnabled set, every internal caller of executeSparqlQuery did the
same. Past maxInMemoryInferenceTriples a request silently returned asserted-only
results, and OWL_LITE/OWL_DL defaults never applied inference at all.

Delete InferenceEngine with the in-memory model, its cache and the triple limit.
Requests for rdfs or owl now fail with 503 and say why; custom reads the rule
graphs materialized in Fuseki and needs materializedInferenceEnabled. Internal
queries, including the complete-lineage endpoint, run against the stored graph.

GET /v1/rdf/status advertises only the levels the server can answer, and the
SPARQL console offers only those. Mark inferenceEnabled, defaultInferenceLevel,
cacheInferredTriples and maxInMemoryInferenceTriples deprecated; the server
ignores them and warns at startup when inferenceEnabled is set.
Describe how OpenMetadata moves all RDF and OWL inference out of its own
JVM into reasoner worker processes inside the openmetadata/fuseki image:
the engines (an owned HermiT build for OWL 2 DL, ELK for EL closures, and
Jena ARQ for governance rules), the memory budget that keeps a worker
out-of-memory away from Fuseki, snapshots and freshness, the HTTP and MCP
contract, and nine implementation phases. The commits that follow
implement phase 0.
The starter inference rules matched nothing on a real graph:

- Column lineage endpoints were FQN string literals, so the PII rule could
  never join them with column tags, and live lineage writes projected no
  column lineage at all. Endpoints now reference the column IRIs the table
  projection mints, keeping the FQN in om:fromColumnFqn and om:toColumnFqn,
  and live UPSTREAM writes project the edge's stored details, as a reindex
  does.
- Entity domains were projected as om:domains while the domain rule reads
  om:belongsToDomain. Domains now use om:belongsToDomain; om:domains is
  deprecated and removed on each entity's next projection.
- Concept realizations were a JSON literal. Each one now names the asset's
  role with om:hasPrimaryStore, om:hasDerivedAsset or om:hasReplica beside
  the om:mappedTo edge, in the live projection as in the ontology export.
- The ontology now matches what the projection writes: om:ColumnLineage is
  declared, om:fromColumn and om:toColumn take it as their domain, and
  om:hasChildColumn is marked as stored.

Existing graphs pick up the new triples on the next write of each entity or
lineage edge, or on a rebuild.
Each rule cleared and refilled its own graph once per run, in priority
order, reading the other rules' output from the previous run. PII spread one
lineage hop per run, a deleted premise kept its conclusions alive, and
markMaterialized cleared the dirty flag even when changes arrived during the
run.

A run now empties every rule graph and applies the enabled rules in passes
until a pass derives nothing new, failing after 64 passes. The dirty flag
clears only if the rule's new dirtyVersion column still holds the value the
run read, so changes made during a run stay pending. A cluster-wide lease
keeps runs from interleaving: a manual run gets 409 and a scheduled run ends
STOPPED. Deleting a rule never waits for a run; the next run empties the
graph of every rule ever stored.

The validator rejects rules that cannot converge (OPTIONAL, MINUS, NOT
EXISTS, BOUND, subqueries, blank nodes, computed head values and
nondeterministic functions), and stored rules that fail it are disabled with
the reason in lastError. transitive-lineage-closure, which stores every
ancestor/descendant pair, now ships disabled. A requested rule name only has
to exist; the whole rule set always runs.
Exercise LET assignments, graph-name variables, three-argument functions and
a triples block built in code, so every branch of FixedPointRuleCheck is
tested.
A blue/green promotion marked every rule dirty without bumping
dirtyVersion, so a materialization run that read the old dataset and
finished after the flip still cleared the flag. The rules looked clean
while the new serving dataset lacked their output until the next write.
Promotion now bumps dirtyVersion like every other invalidation.

The rebuild ITs' database now applies every 2.1.0 statement for
rdf_inference_rule, not only its CREATE TABLE, so it has the
dirtyVersion column the server writes.
Add the typed protocol between OpenMetadata and the RDF store's reasoning
capability: the job request, the durable job state, the capabilities
report, and the published snapshot with the source revision and input
identity it was computed from. Execution state, the answer of a check and
freshness are separate types, so a succeeded check can answer INCOMPLETE
and a succeeded refresh can publish a snapshot that is already stale.

Example documents under rdf/reasoning/ pin the wire format for the store:
each must satisfy its schema and survive the generated model unchanged.

The OM-facing fields (requireCurrent, snapshot metadata on SPARQL
responses and inference status, reasoning configuration) move to phase 7
of the design, which implements them; a requireCurrent flag the server
accepted but ignored would let clients believe stale answers were
rejected.
A reasoning result has to say which graph it was computed from, so that
OpenMetadata can tell whether it still holds:

- rdf_active_dataset.generation gets a new UUID at every promotion,
  including promotions back to a reused physical dataset name. Servers
  assign one on startup to a pointer written before the column existed,
  and the unused setActiveDataset DAO method assigns one too.
- RdfLiveWriteStore reports the enqueued watermark, kept in
  rdf_projection_health because processed rows are deleted, and the
  acknowledged watermark, below which every write has been applied or
  dead-lettered.
- Writes that reach the serving graph without the queue take the next
  queue ID without leaving a row to deliver: the admin SPARQL Update,
  pipeline-status provenance, and in-place reindex runs before their
  first write and after their last. A write that cannot be recorded
  marks the projection degraded. Servers on the previous version keep
  draining the queue, since there is nothing new for them to read.
- ReasoningFreshness encodes the rule: UNKNOWN while the projection is
  degraded, otherwise CURRENT only when the generation, the watermark
  and the ontology and rule digests all still match.

The 2.1.0 migration adds both columns on MySQL and Postgres.
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Oct 8, 2026
@harshach
harshach marked this pull request as ready for review October 9, 2026 20:53
@harshach
harshach requested a review from a team as a code owner October 9, 2026 20:53
@github-actions

github-actions Bot commented Oct 9, 2026 •

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.

…e-correctness

Main squash-merged #34963, the reasoner removal this branch was stacked
on, with review edits to the SPARQL console. Take main's copy of those
UI files; keep this branch's InferenceMaterializer and production-setup
doc, which already hold #34963's change plus the fixed-point work.
A materialization run renews its cluster-wide lock in the background while it
holds it, so one slow update cannot outlive the lock while the run waits on it.
A run that stops waiting for an update at the request timeout keeps the lock
until it expires instead of releasing it: Fuseki may still be applying that
update, and the next run, on any server, must not clear the rule graphs under it.

RdfInferenceMultiServerIT runs two servers' materializers against the real lock
and rule tables and Fuseki: a second server is refused mid-run, a rule edited on
another server during a run stays dirty, and a run that gave up on an update
holds other servers off until its lock expires.
FlowableCharsetMigrationTest requires the ALTER DATABASE statement to end the
file, so Flowable's later schema upgrades inherit the new default. The serving
revision columns went after it.
@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 76%
76.7% (122323/159476) 62.79% (75868/120828) 64.28% (25447/39585)

Each test holds the real materialization lock for its duration, so the
server's scheduled RdfInferenceApp run stops instead of clearing the dirty
flag or the rule graphs between a run and the test's assertions. The two
simulated servers still contend for a lock key of their own.
Base automatically changed from refactor/rdf-inference-correctness to main October 10, 2026 15:21
…ntracts

# Conflicts:
#	docs/index.md
#	docs/plans/2026-10-07-fuseki-native-reasoning.md
#	openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/RdfBlueGreenRebuildIT.java
A write outside the live-write queue takes a queue ID, so it makes earlier
results STALE. UNKNOWN comes only from degraded projection health, which
outranks every other check. The schema still gave the earlier rule, in
which a write the queue did not track made results UNKNOWN.
@gitar-bot

gitar-bot Bot commented Oct 10, 2026

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

🔴 High risk · The RDF generation/watermark migration and write tracking determine snapshot freshness; gaps could let results from outdated serving data appear current.

Defines the typed RDF reasoning protocol schemas and records the serving graph revision (generation and watermarks) so reasoning results can report freshness.

  • Freshness schema text now matches code: UNKNOWN while projection health is degraded, STALE when generation, watermark or digests no longer match.
  • Older servers' enqueues stop counting toward the watermark once drained.

Approved with no open findings.

✅ 2 closed
✅ Edge Case: Older servers' enqueues stop counting toward the watermark once drained

📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfLiveWriteStore.java:92-106
During a rolling upgrade, servers on the previous version insert into rdf_live_write_queue without raising enqueuedWatermark. enqueuedWatermark() counts these rows only through MAX(id) while they are still in the queue. Once the drainer deletes them, the stored watermark falls back below their IDs. A freshness check made after that misses the write: a result captured before it can still be reported CURRENT, and acknowledgedWatermark() also comes out lower than what was really applied. One fix is to raise enqueuedWatermark to GREATEST(enqueuedWatermark, id) in the same transaction as the delete in processHead/deadLetter. This only changes the new code path, so older servers are not affected.

✅ Quality: Freshness schema text says untracked writes give UNKNOWN; code gives STALE

📄 openmetadata-spec/src/main/resources/json/schema/api/rdf/rdfReasoningSnapshot.json:11 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/reasoning/ReasoningFreshness.java:39-52 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfUpdater.java:132-146
The freshness definition says freshness is UNKNOWN after a write the live-write queue did not track. In this PR, though, every untracked write goes through recordUntrackedWrite, which assigns it a queue ID, so ReasoningFreshness.of returns STALE. It only returns UNKNOWN when the projection is degraded. The updated plan doc describes the new rule, but the schema still describes the old one. The schema is the contract the store team builds from, so its description should match ReasoningFreshness.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

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

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
test — 94eb40a9 Deployed Oct 10, 2026 by harshach via RDF Playwright execution #28746
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.

RDF reasoning has no typed protocol and cannot tell which graph a result came from

1 participant