Skip to content

Fixes #34826: apply a removed policy rule on the next authorization decision - #34940

Merged
mohityadav766 merged 6 commits into
mainfrom
fmcardoso/policy-edit-that-removes-a-rule-does-not-reach-a
Oct 14, 2026
Merged

mohityadav766 merged 6 commits into
mainfrom
fmcardoso/policy-edit-that-removes-a-rule-does-not-reach-a

Conversation

@fmcardoso

@fmcardoso fmcardoso commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #34826

Removing a rule from a policy could leave the removed grant usable after the update response. Four independent causes:

  • PolicyRepository invalidated the authorization caches before the new rules were stored.
  • SubjectCache's invalidator was only registered for the Redis provider, so cacheProvider=none never ran it.
  • MCP tool/prompt callbacks run on Reactor bounded-elastic workers that outlive the call, and kept a thread-local RequestEntityCache that could feed old rules back into the shared per-user policy cache.
  • A policy load already running when the invalidation happened could publish its pre-edit result as a fresh entry (Guava invalidate does not cancel in-flight loads).

Type of change:

  • Bug fix

High-level design:

  • CacheBundle: register SubjectCache.invalidator() for every provider; Redis-specific wiring is unchanged.
  • PolicyRepository: drop the inline SubjectCache.invalidateAll(); the existing post-commit invalidateCachesAfterStore() → CacheBundle.invalidateEntity path now does it, after the entity caches are evicted.
  • McpServer: PerRequestContextCleaner.clear() on entry and in an outer finally of tool and prompt callbacks, on the worker thread that runs them.
  • New RevocableLoadingCache used by SubjectCache for the policy and user-context caches. Invalidation never removes entries from a cache that could still receive an in-flight load; it retires the cache and installs an empty one. Keys are spread over 32 shards (by lower-cased name), so invalidating one user retires one shard, and a global invalidation retires all of them. A reader that starts after the swap cannot join a load that predates the invalidation; a reader already waiting discards its result and retries (bounded, then loads uncached). The configured maximum is split across the shards and never exceeded (below 32 entries some shards hold nothing); TTLs unchanged. TeamHierarchyResolver is invalidated before the swap.
  • SubjectCache loaders (including retries and the uncached fallback) run in a FreshReadScope, excluding both worker-local request state and stale entity L1 loads. Base entities are read from the database on authorization cache misses; hot authorization decisions remain cached. The ordering, reload cost, and alternatives are recorded in docs/decisions/2026-10-13-authorization-caches-retire-generations-after-commit.md.
  • Cache statistics are cumulative across shard retirement and resizing, including loads completing on retired generations. Counters do not retain old caches.

Scope: immediate revocation on the local node. Cross-node Redis propagation stays asynchronous. Plan and deviations: docs/plans/2026-10-07-policy-revocation-cache-invalidation.md (section 10).

Tests:

Use cases covered

  • A load that crosses a policy edit + invalidation never answers a later decision (RevocableLoadingCacheTest, SubjectCacheTest).
  • Provider none / null cache config still drops authorization caches on a write (CacheBundleTest).
  • State left on a reused MCP worker thread (entity cache, impersonation, persona) never reaches the next call, on success, tool error, auth error, usage-recording error and prompts (McpServerRequestContextTest). Real create_entity and patch_entity operations persist impersonatedBy=McpApplicationBot and are read back through the API (PolicyRevocationConcurrencyIT).
  • REST and permission-API denial after removing the Data Consumer SPARQL grant (SDK-generated and explicit PATCH), rejected update leaves access intact, restoration observed, with provider none and Redis (RdfPolicyRevocationIT).
  • Readers racing an HTTP policy edit, direct-role and team-inherited; MCP-first removal of a glossary Create allow rule via PUT/PATCH denies the next MCP and REST writes and persists neither entity (PolicyRevocationConcurrencyIT). A separate deny-removal check remains.

Unit tests

  • Added: RevocableLoadingCacheTest (incl. a reader started while a load is paused, name-case variants, and the size cap), CacheBundleTest, McpServerRequestContextTest; extended SubjectCacheTest (load crossing an invalidation; policy left in the thread's request cache).
  • Mutation checks: with the callback cleanup disabled 9/12 original McpServerRequestContextTest fail; with the old join behaviour / no fresh read scope the paused-reader, request-cache and SubjectCacheTest revocation tests fail; with per-shard rounding up, the size-cap test fails ("capped at 2 retained 32").
  • Implementation-time run: 72 tests across the changed and neighbouring classes, 0 failures, 0 skipped. Historical post-merge affected unit step at 40330ef6c5: 824 tests, 0 failures, 0 skipped. Review follow-up: RevocableLoadingCache has 100% line coverage (64/64) and 20/22 branches covered in the focused JaCoCo run. Other classes' coverage percentages were not measured for this follow-up.

Review follow-up (c7be899f9b, then test-only corrections at 197315bff6)

  • New cumulative-statistics tests failed before the fix: counters reset after invalidation, and a load completed after retirement was missing. After the fix, the focused cache suite passes (16 tests); the retained worker-context suite passes (10 tests).

  • Replaced the two mocked create/patch repository-argument tests with real API audit assertions. PolicyRevocationConcurrencyIT: 7 passed, 0 failures/errors/skips with MySQL + Elasticsearch, provider none, including an explicit HTTP PUT (the SDK update method sends PATCH).

  • The full matrix at c7be899f9b caught a negative-test assertion expecting an unwrapped InvalidRequestException; the SDK wraps it in OpenMetadataException. The test now asserts that wrapper, the typed cause and status 400. The final follow-up selected all three impacted/adjacent ITs and passed 34 tests without failures or skips.

  • Corrected the plan's obsolete epoch design, delete-path limitation, and test-run status; added the authorization-cache ADR and corrected case-matching documentation.

  • Final Redis regression at 197315bff6: PolicyRevocationConcurrencyIT 7 + RdfPolicyRevocationIT 5 + AgentSparqlResourceIT 22: 34 passed, 0 failures/errors/skips, with RDF enabled and cache provider redis confirmed in startup logs. Command: mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-os-redis -DintegrationTests.lane=rdf -Dit.test=PolicyRevocationConcurrencyIT,RdfPolicyRevocationIT,AgentSparqlResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false.

  • Final Spotless check across service, MCP, and IT modules passed; decision-record validation and diff whitespace checks passed.

Backend integration tests

  • Added RdfPolicyRevocationIT, PolicyRevocationConcurrencyIT.
  • Historical post-merge validation at 40330ef6c5 used make java_affected and the affected-test runner. The generated block below records the test-only follow-up at 197315bff6 against base c7be899f9b; the complete branch-wide matrix at c7be899f9b is retained in the historical section below. Production code is identical between those commits. The focused implementation-time runs at 5d95745cdf were:
    • RDF lane, -Pmysql-elasticsearch (provider none): RdfPolicyRevocationIT 5 + AgentSparqlResourceIT 22, 0 failures, 0 skipped.
    • RDF lane, -Ppostgres-os-redis (provider redis, confirmed in startup log): same, 0 failures, 0 skipped.
    • Parallel lane, -Pmysql-elasticsearch: PolicyRevocationConcurrencyIT (3), PolicyResourceIT, McpPermissionIT: 0 failures (30 skips are pre-existing skips in those classes). An earlier run errored once in the existing PolicyResourceIT.test_bulkGetPoliciesReturnsRolesField ("role not found"); I suspect a collision with an earlier version of my test deleting its roles while classes run in parallel, not confirmed, not reproduced since.
  • Known limit: MCP sparql_query is admin-only at this baseline, so the plan's MCP-first SPARQL scenario can't be driven; RdfPolicyRevocationIT warms through MCP search_metadata and asserts REST/permission denial instead.
  • Affected-runner limitation on current main: McpServiceResourceIT.java contains only a TODO and no test class, so the selected class cannot produce a report. WritePathBenchmarkIT is intentionally inert without -Dbenchmark.run=true and requires PostgreSQL for its commit probe. Both files are unchanged by this PR. The generated report retains these limitations; no passing result is claimed for them.
  • Additional post-merge provider regression at 40330ef6c5: RDF lane with -Ppostgres-os-redis (PostgreSQL + OpenSearch, provider redis confirmed in startup log), RdfPolicyRevocationIT 5 + AgentSparqlResourceIT 22: 27 passed, 0 failures/errors/skips. Command: mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-os-redis -DintegrationTests.lane=rdf -Dit.test=RdfPolicyRevocationIT,AgentSparqlResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false.

Validation after merging main — 2026-10-14

Verified merge head cab6717166d4. The full affected-test selection completed: 6,769 executed tests passed, 453 skipped, zero assertion failures/errors. The generated report below remains FAILED because the unchanged planner selects McpServiceResourceIT (a TODO-only file, with no test class/report) and WritePathBenchmarkIT (disabled unless -Dbenchmark.run=true). These are the same recorded selection limitations as the earlier full run; the report was not relabeled or edited. Full commands, selection, and results.

An additional PostgreSQL/OpenSearch/Redis RDF run on this head passed 55 tests, zero failures/errors/skips: PolicyRevocationConcurrencyIT (7), RdfPolicyRevocationIT (5), AgentSparqlResourceIT (22), and the newly merged RdfMcpKnowledgeGraphIT (21). This validates immediate MCP/REST revocation and the new non-admin MCP graph behavior together with Redis enabled.

mvn -B verify -pl :openmetadata-integration-tests -am \
  -Dspring-boot.repackage.skip=true -Ppostgres-os-redis \
  -DintegrationTests.lane=rdf \
  -Dit.test=PolicyRevocationConcurrencyIT,RdfPolicyRevocationIT,AgentSparqlResourceIT,RdfMcpKnowledgeGraphIT \
  -Dfailsafe.failIfNoSpecifiedTests=false \
  -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false

Local Java test run: FAILED

  • Commit: cab6717166d4 (base origin/main)
  • Finished: 2026-10-14 08:29 UTC · 83.9 min
  • Details: the classes each step ran, why these tests, the commands
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-mcp (5 classes), openmetadata-service (28 classes) 33 825 0 0 1.5 passed
integration mysql-elasticsearch · parallel 152 5683 0 444 21.0 FAILED
integration mysql-elasticsearch · isolated 8 465 0 9 12.2 passed
integration mysql-elasticsearch · rdf 13 137 0 0 12.5 passed
integration cache-tests · parallel 10 41 0 0 3.8 passed
integration cache-tests · isolated 2 11 0 0 3.6 passed
integration postgres-opensearch · search-it 25 60 0 0 29.3 passed

Selected but produced no report: McpServiceResourceIT (mysql-elasticsearch · parallel)

Every test skipped, so these exercised nothing (check their assumptions — usually the engine): WritePathBenchmarkIT (mysql-elasticsearch · parallel)

  • Impacted, not run locally: 14 classes (listed in the details)

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

None beyond the automated runs above.

UI screen recording / screenshots:

Not applicable.

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.
  • 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.
Historical full affected-test matrix at c7be899

This report is preserved as generated. Its RDF assertion failure is corrected and rerun at 197315bff6, as recorded above. The missing TODO-only class and inert benchmark are unchanged from main.

Local Java test run: FAILED

  • Commit: c7be899f9bf5 (base origin/main)
  • Finished: 2026-10-13 15:34 UTC · 78.4 min
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-mcp (5 classes), openmetadata-service (28 classes) 33 825 0 0 1.4 passed
integration mysql-elasticsearch · parallel 147 5659 0 444 18.7 FAILED
integration mysql-elasticsearch · isolated 8 465 0 9 11.3 passed
integration mysql-elasticsearch · rdf 12 116 1 0 12.7 FAILED
integration cache-tests · parallel 10 41 0 0 4.4 passed
integration cache-tests · isolated 2 11 0 0 4.3 passed
integration postgres-opensearch · search-it 25 60 0 0 25.6 passed

Failed: RdfPolicyRevocationIT#rejectedUpdateLeavesThePolicyAndTheGrantUntouched

Selected but produced no report: McpServiceResourceIT (mysql-elasticsearch · parallel)

Every test skipped, so these exercised nothing (check their assumptions — usually the engine): WritePathBenchmarkIT (mysql-elasticsearch · parallel)

Tests run locally

  • unit · openmetadata-mcp (5 classes), openmetadata-service (28 classes): 33 classes, 825 tests executed (listed below)
  • integration · mysql-elasticsearch · parallel: 147 classes, 5215 tests executed (listed below)
  • integration · mysql-elasticsearch · isolated: ConversationSchemaMigrationIT (2 passed), DataContractValidationAppIT (3 passed), EntityShapeIT (312 passed), SessionMultiNodeIT (11 passed), SystemResourceIT (52 passed), TestSuiteReindexIT (1 passed), UserMetricsResourceIT (7 passed), WorkflowDefinitionResourceIT (68 passed, 9 skipped)
  • integration · mysql-elasticsearch · rdf: AgentSparqlResourceIT (22 passed), RdfConceptRealizationIT (1 passed), RdfFusekiAuthorizationIT (10 passed), RdfGlossaryGraphIT (11 passed), RdfGovernanceRulesIT (2 passed), RdfInferenceMaterializationIT (16 passed), RdfInferenceMultiServerIT (4 passed), RdfPolicyRevocationIT (4 passed, 1 failed), RdfReindexFailuresIT (13 passed), RdfResourceIT (15 passed), RdfRoundTripFidelityIT (7 passed), RdfSemanticSearchIT (10 passed)
  • integration · cache-tests · parallel: AlertStateIT (21 passed), BundleWarmupCertificationIT (1 passed), CachedSearchLayerIT (5 passed), ContainerCacheCorrectnessIT (1 passed), EntityCacheInvalidationIT (4 passed), EntityCacheMemoryIT (2 passed), EntityCacheWriteOrderIT (1 passed), RelationshipCacheInvalidationIT (1 passed), TagRenameCacheIT (1 passed), UncachedReadIT (4 passed)
  • integration · cache-tests · isolated: SessionRedisMultiNodeIT (8 passed), TokenRevocationRedisMultiNodeIT (3 passed)
  • integration · postgres-opensearch · search-it: ColumnIndexingToggleIT (1 passed), CustomPropertyAggregationIT (2 passed), DbToEsCountReconciliationIT (1 passed), ExtensionHighlightSearchIT (1 passed), IndexFieldExplosionIT (2 passed), IndexMappingTemplatesIT (1 passed), LiveIndexRetryIT (1 passed), LiveSearchSettingsChangeIT (1 passed), NestedHierarchyIndexIT (1 passed), NoDuplicatesDuringReindexIT (1 passed), OwnersNestedMappingIT (1 passed), PerEntitySearchDefaultsIT (1 passed), ReindexAliasSwapIT (1 passed), ReindexDocSurvivalIT (4 passed), ReindexOutageRecoveryIT (1 passed), ReindexStatsIT (2 passed), ReindexStopUnderLoadIT (1 passed), SearchClusterFitnessReindexE2EIT (2 passed), SearchCountConsistencyIT (6 passed), SearchEntityRankingIT (14 passed), SearchRelevancyPreviewIT (8 passed), SearchScoringIT (4 passed), StagedIndexUnrefreshedCountIT (1 passed), TestCaseStaleDefinitionReindexIT (1 passed), UnsafeReindexConfigIT (1 passed)

Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The step totals above are Maven's own counts.

unit · openmetadata-mcp (5 classes), openmetadata-service (28 classes): 39 classes

AIAssetStatusSyncTest (8 passed), BotPolicySearchScopeTest (3 passed), BundleWarmupCertificationBackfillTest (4 passed), CacheBundleTest (4 passed), CachedPermissionEvaluationTest (5 passed), CollectionDAOMcpTest (3 passed), DeferredCacheInvalidationTest (5 passed), EntityRepositoryRestoreTest (19 passed), EntityRepositoryTagCacheTest (8 passed), EntityRepositoryUncachedReadTest (4 passed), EntityTypeNameTest (92 passed), McpExecutionIndexTest (8 passed), McpImpersonationTest (5 passed), McpSdkUpgradeTest (20 passed), McpServerIndexTest (3 passed), McpServerMapperTest (2 passed), McpServerRepositoryTest (9 passed), McpServerRequestContextTest (10 passed), McpServerResourceTest (14 passed), MigrationUtilDataConsumerPolicyCacheTest (6 passed), MigrationUtilTest (158 passed), PermissionDebugServiceTest (6 passed), PolicyRepositoryTest (2 passed), RdfJsonLdContextTest (0 passed), RdfJsonLdContextTest$AiAutomationContextTests (5 passed), RdfJsonLdContextTest$ExcludedProjectionTests (1 passed), RdfJsonLdContextTest$GovernanceContextSkosTests (6 passed), RdfJsonLdContextTest$LineageContextTests (5 passed), RdfJsonLdContextTest$StructuredPropertyTests (3 passed), RdfJsonLdContextTest$SupportingTypeTests (3 passed), RdfToolGatingTest (3 passed), RdfUtilsTest (27 passed), ReindexingUtilTest (58 passed), RevocableLoadingCacheTest (16 passed), SearchIndexFactoryTest (215 passed), SearchMetadataToolTest (47 passed), SubjectCacheTest (20 passed), SubjectContextTest (11 passed), TeamHierarchyResolverTest (7 passed)

integration · mysql-elasticsearch · parallel: 148 classes

AIApplicationResourceIT (16 passed, 6 skipped), AIContextMcpIT (1 passed), AIContextRestIT (3 passed), AIFrameworkControlResourceIT (8 passed, 1 skipped), AIGovernancePolicyResourceIT (7 passed), AgentExecutionResourceIT (19 passed, 7 skipped), AlertDeliveryIT (5 passed), AlertTickOutcomesIT (9 passed), AlertTimeBudgetIT (3 passed), AlertTimetableIT (1 passed), AppOperationPermissionsIT (34 passed), BaseEntityIT$ListEntityHistoryByTimestampPaginationTest (261 passed, 21 skipped), BotImpersonationIT (7 passed), BotResourceIT (22 passed, 1 skipped), BulkOperationPermissionsIT (14 passed), CachedSearchLayerIT (5 passed), ConceptContextIT (10 passed), ConfigResourceIT (12 passed), ContainerResourceIT (0 passed), ContextFileIT (20 passed), ContextMemoryAnchorIT (37 passed, 1 skipped), ContextMemoryCreateGrantIT (4 passed), ContextMemoryIT (65 passed, 3 skipped), ContextMemoryLifecycleIT (33 passed, 1 skipped), ContextMemoryRelatedEntitiesReconcileIT (7 passed), ContextMemorySourceEntityTiebreakIT (13 passed, 1 skipped), ContextMemoryStatusMigrationIT (1 passed), ContextMemoryWriteAccessIT (49 passed, 8 skipped), ConversationResourceIT (5 passed, 1 skipped), DataContractPermissionIT (1 passed, 1 skipped), DataContractResourceIT (9 passed), DataInsightSystemChartResourceIT (17 passed, 1 skipped), DataQualityLineageIT (6 passed), DatabaseServiceResourceIT (123 passed, 25 skipped), DatabaseSmokeIT (26 passed, 3 skipped), DispatchScenariosIT (7 passed), DomainAssetsColumnExclusionIT (17 passed, 1 skipped), DomainBulkAssetsDryRunIT (2 passed), DomainIsolationIT (2 passed), DomainRecreateSameNameIT (10 passed, 1 skipped), DomainResourceIT (4 passed), EmailFirstIdentityIT (16 passed), EntityCacheInvalidationIT (22 passed, 3 skipped), EntityCacheMemoryIT (2 passed), EntityCursorOffsetIT (30 passed, 2 skipped), EntityDeleteTaskCleanupIT (66 passed, 1 skipped), EntityHardDeletionAtomicityIT (10 passed), EntityHistoryPaginationIT (75 passed, 4 skipped), EntityLifecycleStagesIT (3 passed), EntityNameIndexIT (13 passed, 1 skipped), EntityProfileResourceIT (32 passed, 1 skipped), EntityRelationshipCleanupIT (278 passed, 18 skipped), EntityShapeBaselineIT (1 passed), EntityStatusWorkflowOwnershipIT (3 passed), EntitySubtreeAtomicityIT (2 passed), EntityTransactionBoundaryIT (4 passed), EntityUpdateLockOrderIT (3 passed), EntityUtilValidateEntityReferenceIT (20 passed), FeedAccessAuthzIT (50 passed, 7 skipped), GlossaryCsvRelationTypesIT (31 passed, 3 skipped), GlossaryRdfImportIT (8 passed, 1 skipped), GlossaryTermRealizationIT (8 passed), GlossaryTermRelationEdgeIT (33 passed), GlossaryTermRelationSettingsPermissionsIT (13 passed, 1 skipped), GlossaryTermResourceIT (185 passed, 23 skipped), IngestionPipelineAgentTypeIT (23 passed, 1 skipped), LLMModelResourceIT (35 passed, 2 skipped), LLMServiceResourceIT (75 passed, 12 skipped), LatencySamplerTest (12 passed), LineageBidirectionalIT (1 passed), LineageBrokenReferenceIT (4 passed), LineageDeletedPipelineIT (2 passed), LineageEdgePlannerTest (12 passed), LineageGraphLoaderTest (8 passed), LineageHydrateIT (115 passed, 16 skipped), LineageImpactAnalysisIT (17 passed, 1 skipped), LineageManualEdgeIT (56 passed, 2 skipped), LineagePipelineAnnotatorIT (32 passed, 4 skipped), LineageResourceIT (41 passed, 3 skipped), McpContextMemoryVisibilityIT (7 passed), McpExecutionResourceIT (55 passed, 1 skipped), McpIntegrationIT (4 passed), McpOAuthIT (37 passed, 2 skipped), McpPermissionIT (80 passed, 7 skipped), McpSearchIT (23 passed), McpServerResourceIT (20 passed, 1 skipped), McpToolsValidationIT (62 passed, 1 skipped), McpUserContextIT (52 passed, 3 skipped), MetricAssetsIT (32 passed, 1 skipped), NamespaceCleanupTest (2 passed), OAuth2TokenManagerIT (15 passed), OntologyAiResourceIT (46 passed, 2 skipped), OntologyAxiomResourceIT (51 passed, 5 skipped), OntologyBulkIT (52 passed, 5 skipped), OntologyChangeSetIT (294 passed, 43 skipped), OntologyEditLockResourceIT (18 passed), OntologyEffectiveAttributesIT (10 passed), OntologyGovernanceIT (48 passed, 6 skipped), OntologyImpactIT (16 passed), OntologyModelingIT (5 passed), OntologyPackResourceIT (15 passed), OntologyPatternIT (52 passed, 4 skipped), OntologyStructureIT (69 passed, 9 skipped), OntologySubsetIT (2 passed), OpenLineageLineageResolutionIT (20 passed), PermissionsResourceIT (23 passed, 2 skipped), PersonaAIContextIT (1 passed), PersonaResourceIT (101 passed, 11 skipped), PipelineStatusAuthorizationIT (51 passed, 7 skipped), PolicyResourceIT (60 passed, 8 skipped), PolicyRevocationConcurrencyIT (17 passed, 1 skipped), PromptTemplateResourceIT (65 passed, 1 skipped), QueryVisibilityPolicyIT (53 passed, 5 skipped), RoleResourceIT (38 passed, 4 skipped), SamlSecurityConfigIT (9 passed), SearchClusterFitnessResourceIT (8 passed), SearchResourceIT (81 passed, 12 skipped), SecurityServiceResourceIT (37 passed, 3 skipped), SeedDataPresenceIT (4 passed), ServiceAttributePolicyIT (45 passed, 6 skipped), ShapeCanaryTest (5 passed), SlackOAuth2AtRestEncryptionIT (7 passed), SlowEndpointIT (1 passed), SoftDeleteRetentionIT (50 passed, 6 skipped), SystemAlertsIT (3 passed), TableResourceIT (9 passed), TagResourceIT (1 passed), TaskPermissionsIT (4 passed, 1 skipped), TeamDefaultPersonaIT (20 passed, 1 skipped), TeamHierarchyInheritanceIT (13 passed, 1 skipped), TeamResourceIT (142 passed, 11 skipped), TemplateTestSendIT (6 passed), TestCaseCsvDomainIsolationIT (42 passed, 5 skipped), TestCaseDeleteResilienceIT (7 passed), TestCaseLatestStatusIT (13 passed, 1 skipped), TestCaseRelationshipRetentionCleanupIT (25 passed, 2 skipped), TestCaseResolutionStatusLegacyTestSuitesIT (1 passed), TestCaseResourceIT (180 passed, 2 skipped), TestCaseResultAuthorizationIT (5 passed), TestCaseSoftDeleteSearchIT (1 passed), TestLoginSessionSweepIT (21 passed), UserDefaultTeamAssignmentIT (1 passed), UserImportPrivilegeEscalationIT (135 passed, 20 skipped), UserPreferencesIT (18 passed, 1 skipped), UserResourceIT (98 passed, 6 skipped), UserTeamAssignmentPrivilegeIT (1 passed), WorkflowTriggerPermissionsIT (15 passed, 1 skipped), WritePathBenchmarkIT (0 passed, 1 skipped)

Why these tests
  • area ai-mcp-context ← openmetadata-mcp/src/main/java/org/openmetadata/mcp/McpServer.java, openmetadata-mcp/src/test/java/org/openmetadata/mcp/McpServerRequestContextTest.java
  • area cache ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java
  • area security ← openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PolicyRepository.java, openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/RevocableLoadingCache.java, openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectCache.java
  • called from entity Container ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java
  • called from entity Domain ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java
  • called from entity Entity ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java
  • called from entity Lineage ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java
  • called from entity Persona ← openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectCache.java
  • called from entity Role ← openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectCache.java
  • called from entity System ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java
  • called from entity Team ← openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectCache.java
  • called from entity TestCase ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java
  • called from entity User ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java, openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectCache.java
  • changed test ← openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/PolicyRevocationConcurrencyIT.java, openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/RdfPolicyRevocationIT.java, openmetadata-mcp/src/test/java/org/openmetadata/mcp/McpServerRequestContextTest.java, openmetadata-service/src/test/java/org/openmetadata/service/cache/CacheBundleTest.java, openmetadata-service/src/test/java/org/openmetadata/service/security/policyevaluator/RevocableLoadingCacheTest.java (+1 more)
  • entity Policy ← openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PolicyRepository.java
  • smoke ← code other than a test class changed
Impacted, not run locally (14)
  • RdfCatalogScaleIT → only with -DrdfCatalogScale=true, which no CI lane sets
  • LineagePayloadScaleIT → nightly: openmetadata-nightly k8s-java-it (scale-it)
  • LineageScenePerformanceScaleIT → nightly: openmetadata-nightly k8s-java-it (scale-it)
  • GoogleSsoSignInUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • EntityLoaderSmokeUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • LongCompoundNameSearchUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • PipelineOwnerIndexUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • DistributedAutoTuneReindexUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • SearchAvailableAllKindsDuringReindexUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • SearchAvailableDuringReindexUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • SelectiveFieldReindexUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • SimpleReindexTriggerUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • GoogleSsoBootstrapUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • MockIdpSmokeUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
Commands
mvn -B package -pl openmetadata-mcp,openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=AIAssetStatusSyncTest,BotPolicySearchScopeTest,BundleWarmupCertificationBackfillTest,CacheBundleTest,CachedPermissionEvaluationTest,CollectionDAOMcpTest,DeferredCacheInvalidationTest,EntityRepositoryRestoreTest,EntityRepositoryTagCacheTest,EntityRepositoryUncachedReadTest,EntityTypeNameTest,McpExecutionIndexTest,McpImpersonationTest,McpSdkUpgradeTest,McpServerIndexTest,McpServerMapperTest,McpServerRepositoryTest,McpServerRequestContextTest,McpServerResourceTest,MigrationUtilDataConsumerPolicyCacheTest,MigrationUtilTest,PermissionDebugServiceTest,PolicyRepositoryTest,RdfJsonLdContextTest,RdfToolGatingTest,RdfUtilsTest,ReindexingUtilTest,RevocableLoadingCacheTest,SearchIndexFactoryTest,SearchMetadataToolTest,SubjectCacheTest,SubjectContextTest,TeamHierarchyResolverTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=<148 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=ConversationSchemaMigrationIT,DataContractValidationAppIT,EntityShapeIT,SessionMultiNodeIT,SystemResourceIT,TestSuiteReindexIT,UserMetricsResourceIT,WorkflowDefinitionResourceIT -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,RdfConceptRealizationIT,RdfFusekiAuthorizationIT,RdfGlossaryGraphIT,RdfGovernanceRulesIT,RdfInferenceMaterializationIT,RdfInferenceMultiServerIT,RdfPolicyRevocationIT,RdfReindexFailuresIT,RdfResourceIT,RdfRoundTripFidelityIT,RdfSemanticSearchIT -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=AlertStateIT,BundleWarmupCertificationIT,CachedSearchLayerIT,ContainerCacheCorrectnessIT,EntityCacheInvalidationIT,EntityCacheMemoryIT,EntityCacheWriteOrderIT,RelationshipCacheInvalidationIT,TagRenameCacheIT,UncachedReadIT -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=global-state -Dit.test=SessionRedisMultiNodeIT,TokenRevocationRedisMultiNodeIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Psearch-it -DdatabaseType=postgres -DsearchType=opensearch -Djpw.data.mode=ingest -Dit.test=ColumnIndexingToggleIT,CustomPropertyAggregationIT,DbToEsCountReconciliationIT,ExtensionHighlightSearchIT,IndexFieldExplosionIT,IndexMappingTemplatesIT,LiveIndexRetryIT,LiveSearchSettingsChangeIT,NestedHierarchyIndexIT,NoDuplicatesDuringReindexIT,OwnersNestedMappingIT,PerEntitySearchDefaultsIT,ReindexAliasSwapIT,ReindexDocSurvivalIT,ReindexOutageRecoveryIT,ReindexStatsIT,ReindexStopUnderLoadIT,SearchClusterFitnessReindexE2EIT,SearchCountConsistencyIT,SearchEntityRankingIT,SearchRelevancyPreviewIT,SearchScoringIT,StagedIndexUnrefreshedCountIT,TestCaseStaleDefinitionReindexIT,UnsafeReindexConfigIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false

…rization decision

Removing a rule from a policy could leave the old grant usable: the
authorization caches were invalidated before the new rules were stored,
the invalidator was not registered when cacheProvider=none, MCP worker
threads kept a thread-local entity cache across calls, and an in-flight
policy load could republish pre-edit rules after invalidation.

- Invalidate through the existing post-commit path instead of inside the
  rules comparison, and register SubjectCache's invalidator for every
  cache provider.
- Clear per-request context on entry and exit of MCP tool and prompt
  callbacks, on the worker thread that runs them.
- Guard SubjectCache against loads that cross an invalidation with
  RevocableLoadingCache (cache swap on global invalidation, epoch check
  on targeted invalidation).
- Add unit and integration coverage, and record the implementation
  notes in the plan.

Fixes #34826
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

…olicies in a fresh read scope

Review follow-up for #34826.

- A reader that started after a targeted invalidation could join the
  old in-flight load and receive the revoked grant. Invalidating a user
  now retires that user's shard (keys shard by lower-cased name), so
  later readers cannot join a load that predates the invalidation.
- SubjectCache loads run inside a FreshReadScope, so a retry after an
  invalidation cannot re-read the old policy from the thread-local
  request cache and publish it into the new shared cache.
- Split the configured maximum across shards without exceeding it
  (previously rounded up to at least one entry per shard).
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@fmcardoso
fmcardoso marked this pull request as ready for review October 13, 2026 16:05
@fmcardoso
fmcardoso requested a review from a team as a code owner October 13, 2026 16:05
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@fmcardoso fmcardoso self-assigned this Oct 13, 2026
@fmcardoso fmcardoso added the safe to test Add this label to run secure Github workflows on PRs label Oct 13, 2026
@gitar-bot

gitar-bot Bot commented Oct 14, 2026

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

🔴 High risk · Retiring authorization-cache generations and changing post-commit invalidation could leave revoked grants usable or deny legitimate access if freshness handling fails.

Fixes removed policy rules persisting after an edit by invalidating authorization caches after the new rules are stored, registering the subject cache invalidator for all cache providers, clearing per-request state on MCP worker threads, and introducing a revocable loading cache so in-flight pre-edit loads cannot repopulate it. The resolved finding was that a later reader could join a pre-edit in-flight load after targeted invalidation; that is now addressed by retiring the affected cache shard. No open issues remain.

✅ 1 closed
✅ Bug: Targeted invalidation lets a later reader join a pre-edit in-flight load

📄 openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/RevocableLoadingCache.java:76-90 📄 openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectCache.java:186-190 📄 openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectCache.java:253-263
invalidate(key) and invalidateMatching bump the epoch and then remove the key, but Guava's Segment.remove leaves an entry alone while it is still loading (its value is null and UNSET.isActive() is false), and asMap().keySet().removeIf never visits loading entries either. Here is the race: reader A starts loading user X from the pre-change rows, then invalidateUser(X) (or a user write through the invalidator) completes, then reader B calls get. B reads the epoch after the bump and attaches to A's load, which is still running. That load returns the pre-change policies. B's epoch check passes because nothing changed after B read it, so B gets the revoked grants even though its decision started after the invalidation. Only A notices and evicts. This is the same in-flight publication gap the class is meant to close, and it stays open for role or team-membership revocations that go through targeted invalidation. To fix it, stamp each loaded value with the epoch read at the start of the load, and have readers reject (evict and retry) a value whose stamp is older than the epoch they read. Another option is to do targeted invalidation as a generation swap too.

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

@mohityadav766
mohityadav766 added this pull request to the merge queue Oct 14, 2026
@fmcardoso

Copy link
Copy Markdown
Member Author

Local Java test run: FAILED — details

  • Commit: cab6717166d4 (base origin/main)
  • The summary is in the PR description.

Selected but produced no report: McpServiceResourceIT (mysql-elasticsearch · parallel)

Every test skipped, so these exercised nothing (check their assumptions — usually the engine): WritePathBenchmarkIT (mysql-elasticsearch · parallel)

Tests run locally

  • unit · openmetadata-mcp (5 classes), openmetadata-service (28 classes): 33 classes, 825 tests executed (listed below)
  • integration · mysql-elasticsearch · parallel: 152 classes, 5239 tests executed (listed below)
  • integration · mysql-elasticsearch · isolated: ConversationSchemaMigrationIT (2 passed), DataContractValidationAppIT (3 passed), EntityShapeIT (312 passed), SessionMultiNodeIT (11 passed), SystemResourceIT (52 passed), TestSuiteReindexIT (1 passed), UserMetricsResourceIT (7 passed), WorkflowDefinitionResourceIT (68 passed, 9 skipped)
  • integration · mysql-elasticsearch · rdf: AgentSparqlResourceIT (22 passed), RdfConceptRealizationIT (1 passed), RdfFusekiAuthorizationIT (11 passed), RdfGlossaryGraphIT (11 passed), RdfGovernanceRulesIT (1 passed), RdfInferenceMaterializationIT (16 passed), RdfInferenceMultiServerIT (4 passed), RdfMcpKnowledgeGraphIT (21 passed), RdfPolicyRevocationIT (5 passed), RdfReindexFailuresIT (13 passed), RdfResourceIT (15 passed), RdfRoundTripFidelityIT (7 passed), RdfSemanticSearchIT (10 passed)
  • integration · cache-tests · parallel: AlertStateIT (21 passed), BundleWarmupCertificationIT (1 passed), CachedSearchLayerIT (5 passed), ContainerCacheCorrectnessIT (1 passed), EntityCacheInvalidationIT (4 passed), EntityCacheMemoryIT (2 passed), EntityCacheWriteOrderIT (1 passed), RelationshipCacheInvalidationIT (1 passed), TagRenameCacheIT (1 passed), UncachedReadIT (4 passed)
  • integration · cache-tests · isolated: SessionRedisMultiNodeIT (8 passed), TokenRevocationRedisMultiNodeIT (3 passed)
  • integration · postgres-opensearch · search-it: ColumnIndexingToggleIT (1 passed), CustomPropertyAggregationIT (2 passed), DbToEsCountReconciliationIT (1 passed), ExtensionHighlightSearchIT (1 passed), IndexFieldExplosionIT (2 passed), IndexMappingTemplatesIT (1 passed), LiveIndexRetryIT (1 passed), LiveSearchSettingsChangeIT (1 passed), NestedHierarchyIndexIT (1 passed), NoDuplicatesDuringReindexIT (1 passed), OwnersNestedMappingIT (1 passed), PerEntitySearchDefaultsIT (1 passed), ReindexAliasSwapIT (1 passed), ReindexDocSurvivalIT (4 passed), ReindexOutageRecoveryIT (1 passed), ReindexStatsIT (2 passed), ReindexStopUnderLoadIT (1 passed), SearchClusterFitnessReindexE2EIT (2 passed), SearchCountConsistencyIT (6 passed), SearchEntityRankingIT (14 passed), SearchRelevancyPreviewIT (8 passed), SearchScoringIT (4 passed), StagedIndexUnrefreshedCountIT (1 passed), TestCaseStaleDefinitionReindexIT (1 passed), UnsafeReindexConfigIT (1 passed)

Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts.

unit · openmetadata-mcp (5 classes), openmetadata-service (28 classes): 39 classes

AIAssetStatusSyncTest (8 passed), BotPolicySearchScopeTest (3 passed), BundleWarmupCertificationBackfillTest (4 passed), CacheBundleTest (4 passed), CachedPermissionEvaluationTest (5 passed), CollectionDAOMcpTest (3 passed), DeferredCacheInvalidationTest (5 passed), EntityRepositoryRestoreTest (19 passed), EntityRepositoryTagCacheTest (8 passed), EntityRepositoryUncachedReadTest (4 passed), EntityTypeNameTest (92 passed), McpExecutionIndexTest (8 passed), McpImpersonationTest (5 passed), McpSdkUpgradeTest (20 passed), McpServerIndexTest (3 passed), McpServerMapperTest (2 passed), McpServerRepositoryTest (9 passed), McpServerRequestContextTest (10 passed), McpServerResourceTest (14 passed), MigrationUtilDataConsumerPolicyCacheTest (6 passed), MigrationUtilTest (158 passed), PermissionDebugServiceTest (6 passed), PolicyRepositoryTest (2 passed), RdfJsonLdContextTest (0 passed), RdfJsonLdContextTest$AiAutomationContextTests (5 passed), RdfJsonLdContextTest$ExcludedProjectionTests (1 passed), RdfJsonLdContextTest$GovernanceContextSkosTests (6 passed), RdfJsonLdContextTest$LineageContextTests (5 passed), RdfJsonLdContextTest$StructuredPropertyTests (3 passed), RdfJsonLdContextTest$SupportingTypeTests (3 passed), RdfToolGatingTest (3 passed), RdfUtilsTest (27 passed), ReindexingUtilTest (58 passed), RevocableLoadingCacheTest (16 passed), SearchIndexFactoryTest (215 passed), SearchMetadataToolTest (47 passed), SubjectCacheTest (20 passed), SubjectContextTest (11 passed), TeamHierarchyResolverTest (7 passed)

integration · mysql-elasticsearch · parallel: 153 classes

AIApplicationResourceIT (2 passed), AIContextMcpIT (1 passed), AIContextRestIT (33 passed, 2 skipped), AIFrameworkControlResourceIT (3 passed), AIGovernancePolicyResourceIT (2 passed), AgentExecutionResourceIT (4 passed, 2 skipped), AlertDeliveryIT (5 passed), AlertTickOutcomesIT (10 passed), AlertTimeBudgetIT (3 passed), AlertTimetableIT (1 passed), ApiLatencyRecorderTest (0 passed), AppOperationPermissionsIT (29 passed), BaseEntityIT$ListEntityHistoryByTimestampPaginationTest (261 passed, 21 skipped), BotImpersonationIT (3 passed), BotResourceIT (20 passed, 1 skipped), BulkOperationPermissionsIT (15 passed), CachedSearchLayerIT (5 passed), ConceptContextIT (5 passed), ConfigResourceIT (15 passed), ContainerResourceIT (0 passed), ContextFileIT (145 passed, 12 skipped), ContextMemoryAnchorIT (8 passed), ContextMemoryCreateGrantIT (4 passed), ContextMemoryIT (46 passed), ContextMemoryLifecycleIT (7 passed), ContextMemoryRelatedEntitiesReconcileIT (97 passed, 12 skipped), ContextMemorySourceEntityTiebreakIT (5 passed), ContextMemoryStatusMigrationIT (1 passed), ContextMemoryWriteAccessIT (19 passed, 2 skipped), ConversationResourceIT (133 passed, 10 skipped), DataContractPermissionIT (3 passed), DataContractResourceIT (65 passed, 5 skipped), DataInsightSystemChartResourceIT (41 passed, 3 skipped), DataQualityLineageIT (222 passed, 31 skipped), DatabaseServiceResourceIT (105 passed, 16 skipped), DatabaseSmokeIT (7 passed, 1 skipped), DispatchScenariosIT (7 passed), DomainAssetsColumnExclusionIT (1 passed), DomainBulkAssetsDryRunIT (56 passed, 8 skipped), DomainIsolationIT (5 passed), DomainRecreateSameNameIT (24 passed, 2 skipped), DomainResourceIT (245 passed, 31 skipped), EmailFirstIdentityIT (14 passed, 1 skipped), EntityCacheInvalidationIT (3 passed), EntityCacheMemoryIT (2 passed), EntityCursorOffsetIT (66 passed, 7 skipped), EntityDeleteTaskCleanupIT (26 passed, 5 skipped), EntityHardDeletionAtomicityIT (10 passed), EntityHistoryPaginationIT (55 passed, 3 skipped), EntityLifecycleStagesIT (3 passed), EntityNameIndexIT (6 passed), EntityProfileResourceIT (74 passed, 5 skipped), EntityRelationshipCleanupIT (18 passed, 1 skipped), EntityShapeBaselineIT (7 passed, 1 skipped), EntityStatusWorkflowOwnershipIT (3 passed), EntitySubtreeAtomicityIT (2 passed), EntityTransactionBoundaryIT (4 passed), EntityUpdateLockOrderIT (5 passed), EntityUtilValidateEntityReferenceIT (21 passed, 4 skipped), FeedAccessAuthzIT (88 passed, 16 skipped), GlossaryCsvRelationTypesIT (26 passed, 2 skipped), GlossaryRdfImportIT (42 passed, 1 skipped), GlossaryTermRealizationIT (53 passed, 5 skipped), GlossaryTermRelationEdgeIT (21 passed, 2 skipped), GlossaryTermRelationSettingsPermissionsIT (11 passed, 1 skipped), GlossaryTermResourceIT (5 passed, 1 skipped), IngestionPipelineAgentTypeIT (11 passed, 1 skipped), LLMModelResourceIT (33 passed, 3 skipped), LLMServiceResourceIT (58 passed, 9 skipped), LatencyHistogramTest (21 passed), LatencySamplerTest (4 passed), LineageBidirectionalIT (8 passed, 1 skipped), LineageBrokenReferenceIT (4 passed), LineageDeletedPipelineIT (8 passed), LineageEdgePlannerTest (12 passed), LineageGraphLoaderTest (8 passed), LineageHydrateIT (56 passed, 1 skipped), LineageImpactAnalysisIT (15 passed, 2 skipped), LineageManualEdgeIT (1 passed), LineagePipelineAnnotatorIT (80 passed, 10 skipped), LineageResourceIT (1 passed, 1 skipped), McpContextMemoryVisibilityIT (37 passed, 4 skipped), McpExecutionResourceIT (25 passed), McpIntegrationIT (24 passed, 5 skipped), McpOAuthIT (30 passed, 1 skipped), McpPermissionIT (13 passed, 1 skipped), McpRdfNotEnabledIT (35 passed, 5 skipped), McpSearchIT (86 passed, 13 skipped), McpServerResourceIT (36 passed, 6 skipped), McpToolsValidationIT (8 passed), McpUserContextIT (1 passed), MetricAssetsIT (23 passed, 3 skipped), NamespaceCleanupTest (2 passed), OAuth2TokenManagerIT (16 passed, 1 skipped), OntologyAiResourceIT (4 passed), OntologyAxiomResourceIT (6 passed), OntologyBulkIT (8 passed), OntologyChangeSetIT (5 passed), OntologyEditLockResourceIT (10 passed, 1 skipped), OntologyEffectiveAttributesIT (1 passed), OntologyGovernanceIT (64 passed, 5 skipped), OntologyImpactIT (16 passed), OntologyModelingIT (7 passed, 1 skipped), OntologyPackResourceIT (39 passed, 6 skipped), OntologyPatternIT (1 passed), OntologyStructureIT (83 passed, 11 skipped), OntologySubsetIT (14 passed), OpenLineageLineageResolutionIT (376 passed, 13 skipped), PermissionsResourceIT (45 passed, 3 skipped), PersonaAIContextIT (31 passed, 2 skipped), PersonaResourceIT (33 passed, 4 skipped), PipelineStatusAuthorizationIT (16 passed, 1 skipped), PolicyResourceIT (98 passed, 7 skipped), PolicyRevocationConcurrencyIT (39 passed), PromptTemplateResourceIT (52 passed), ProviderRoleSyncIT (1 passed), QueryVisibilityPolicyIT (8 passed), RoleResourceIT (61 passed, 6 skipped), SamlSecurityConfigIT (9 passed), SearchClusterFitnessResourceIT (9 passed), SearchResourceIT (107 passed, 10 skipped), SecurityServiceResourceIT (44 passed, 8 skipped), SeedDataPresenceIT (10 passed), SeededLineageGraphTest (3 passed), ServiceAttributePolicyIT (7 passed, 1 skipped), ShapeCanaryTest (4 passed), SlackOAuth2AtRestEncryptionIT (2 passed, 1 skipped), SlowEndpointIT (1 passed), SoftDeleteRetentionIT (43 passed, 4 skipped), SystemAlertsIT (7 passed, 1 skipped), TableResourceIT (1 passed), TagResourceIT (11 passed, 2 skipped), TaskPermissionsIT (41 passed, 3 skipped), TeamDefaultPersonaIT (56 passed, 1 skipped), TeamHierarchyInheritanceIT (13 passed), TeamResourceIT (45 passed, 5 skipped), TemplateTestSendIT (20 passed, 1 skipped), TestCaseCsvDomainIsolationIT (8 passed, 1 skipped), TestCaseDeleteResilienceIT (11 passed, 1 skipped), TestCaseLatestStatusIT (75 passed, 5 skipped), TestCaseRelationshipRetentionCleanupIT (21 passed, 2 skipped), TestCaseResolutionStatusLegacyTestSuitesIT (1 passed), TestCaseResourceIT (5 passed), TestCaseResultAuthorizationIT (1 passed), TestCaseSoftDeleteSearchIT (1 passed), TestLoginSessionSweepIT (2 passed), UserDefaultTeamAssignmentIT (1 passed), UserImportPrivilegeEscalationIT (179 passed, 20 skipped), UserPreferencesIT (36 passed, 2 skipped), UserResourceIT (50 passed, 5 skipped), UserTeamAssignmentPrivilegeIT (18 passed), WorkflowTriggerPermissionsIT (5 passed), WritePathBenchmarkIT (0 passed, 1 skipped)

Why these tests
  • area ai-mcp-context ← openmetadata-mcp/src/main/java/org/openmetadata/mcp/McpServer.java, openmetadata-mcp/src/test/java/org/openmetadata/mcp/McpServerRequestContextTest.java
  • area cache ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java
  • area security ← openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PolicyRepository.java, openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/RevocableLoadingCache.java, openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectCache.java
  • called from entity Container ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java
  • called from entity Domain ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java
  • called from entity Entity ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java
  • called from entity Lineage ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java
  • called from entity Persona ← openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectCache.java
  • called from entity Role ← openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectCache.java
  • called from entity System ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java
  • called from entity Team ← openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectCache.java
  • called from entity TestCase ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java
  • called from entity User ← openmetadata-service/src/main/java/org/openmetadata/service/cache/CacheBundle.java, openmetadata-service/src/main/java/org/openmetadata/service/security/policyevaluator/SubjectCache.java
  • changed test ← openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/PolicyRevocationConcurrencyIT.java, openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/RdfPolicyRevocationIT.java, openmetadata-mcp/src/test/java/org/openmetadata/mcp/McpServerRequestContextTest.java, openmetadata-service/src/test/java/org/openmetadata/service/cache/CacheBundleTest.java, openmetadata-service/src/test/java/org/openmetadata/service/security/policyevaluator/RevocableLoadingCacheTest.java (+1 more)
  • entity Policy ← openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/PolicyRepository.java
  • smoke ← code other than a test class changed
Impacted, not run locally (14)
  • RdfCatalogScaleIT → only with -DrdfCatalogScale=true, which no CI lane sets
  • LineagePayloadScaleIT → nightly: openmetadata-nightly k8s-java-it (scale-it)
  • LineageScenePerformanceScaleIT → nightly: openmetadata-nightly k8s-java-it (scale-it)
  • GoogleSsoSignInUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • EntityLoaderSmokeUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • LongCompoundNameSearchUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • PipelineOwnerIndexUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • DistributedAutoTuneReindexUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • SearchAvailableAllKindsDuringReindexUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • SearchAvailableDuringReindexUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • SelectiveFieldReindexUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • SimpleReindexTriggerUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • GoogleSsoBootstrapUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • MockIdpSmokeUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
Commands
mvn -B package -pl openmetadata-mcp,openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=AIAssetStatusSyncTest,BotPolicySearchScopeTest,BundleWarmupCertificationBackfillTest,CacheBundleTest,CachedPermissionEvaluationTest,CollectionDAOMcpTest,DeferredCacheInvalidationTest,EntityRepositoryRestoreTest,EntityRepositoryTagCacheTest,EntityRepositoryUncachedReadTest,EntityTypeNameTest,McpExecutionIndexTest,McpImpersonationTest,McpSdkUpgradeTest,McpServerIndexTest,McpServerMapperTest,McpServerRepositoryTest,McpServerRequestContextTest,McpServerResourceTest,MigrationUtilDataConsumerPolicyCacheTest,MigrationUtilTest,PermissionDebugServiceTest,PolicyRepositoryTest,RdfJsonLdContextTest,RdfToolGatingTest,RdfUtilsTest,ReindexingUtilTest,RevocableLoadingCacheTest,SearchIndexFactoryTest,SearchMetadataToolTest,SubjectCacheTest,SubjectContextTest,TeamHierarchyResolverTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=<153 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=ConversationSchemaMigrationIT,DataContractValidationAppIT,EntityShapeIT,SessionMultiNodeIT,SystemResourceIT,TestSuiteReindexIT,UserMetricsResourceIT,WorkflowDefinitionResourceIT -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,RdfConceptRealizationIT,RdfFusekiAuthorizationIT,RdfGlossaryGraphIT,RdfGovernanceRulesIT,RdfInferenceMaterializationIT,RdfInferenceMultiServerIT,RdfMcpKnowledgeGraphIT,RdfPolicyRevocationIT,RdfReindexFailuresIT,RdfResourceIT,RdfRoundTripFidelityIT,RdfSemanticSearchIT -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=AlertStateIT,BundleWarmupCertificationIT,CachedSearchLayerIT,ContainerCacheCorrectnessIT,EntityCacheInvalidationIT,EntityCacheMemoryIT,EntityCacheWriteOrderIT,RelationshipCacheInvalidationIT,TagRenameCacheIT,UncachedReadIT -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=global-state -Dit.test=SessionRedisMultiNodeIT,TokenRevocationRedisMultiNodeIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Psearch-it -DdatabaseType=postgres -DsearchType=opensearch -Djpw.data.mode=ingest -Dit.test=ColumnIndexingToggleIT,CustomPropertyAggregationIT,DbToEsCountReconciliationIT,ExtensionHighlightSearchIT,IndexFieldExplosionIT,IndexMappingTemplatesIT,LiveIndexRetryIT,LiveSearchSettingsChangeIT,NestedHierarchyIndexIT,NoDuplicatesDuringReindexIT,OwnersNestedMappingIT,PerEntitySearchDefaultsIT,ReindexAliasSwapIT,ReindexDocSurvivalIT,ReindexOutageRecoveryIT,ReindexStatsIT,ReindexStopUnderLoadIT,SearchClusterFitnessReindexE2EIT,SearchCountConsistencyIT,SearchEntityRankingIT,SearchRelevancyPreviewIT,SearchScoringIT,StagedIndexUnrefreshedCountIT,TestCaseStaleDefinitionReindexIT,UnsafeReindexConfigIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false

Merged via the queue into main with commit 0ce7ed0 Oct 14, 2026
81 of 82 checks passed
@mohityadav766
mohityadav766 deleted the fmcardoso/policy-edit-that-removes-a-rule-does-not-reach-a branch October 14, 2026 18:08
mohityadav766 added a commit that referenced this pull request Nov 17, 2026
…tion decision (#34940) (#37996)

* Give fresh-read scopes their own request cache (from #34209)

SubjectCache now loads policies and user contexts in a FreshReadScope so
that a retry after an invalidation cannot read the pre-edit policy back
from the thread-local request cache. On 2.0 a fresh read still read and
filled that cache (under fromCache=false keys), so a load retried on the
same thread could compile the old rules into the new cache generation
(SubjectCacheTest.testLoadIgnoresPolicyLeftInTheThreadsRequestCache).

RequestEntityCache, FreshReadScope and RequestEntityCacheTest are taken
as they are on main after #34209; 2.0's copies matched main before
#34089. The javadoc drops main's claim that fresh reads skip the
not-found markers, which 2.0's find() still checks. #34209's
EventSubscriptionScheduler change is not part of this.

* Fixes #34826: apply a removed policy rule on the next authorization decision (#34940)

Backport of #34940 to 2.0, adapted where 2.0 differs from main:

- SubjectCache's invalidator drops the policy cache on team, role and
  policy writes, and a user write drops that user's policy entry too.
  Main got that with #33632, which 2.0 does not have. Without it the
  post-commit invalidation this change moves to never reaches the policy
  cache, so a disabled policy kept granting access until the two-minute
  TTL ran out (PolicyEnforcementIT.aDisabledPolicyGrantsNothing).
  SubjectCacheTest gains main's team/role/user invalidator tests and a
  policy-write one, and keeps a single putUserWithPolicy helper (2.0
  already had one).
- invalidateAll() has no team-hierarchy cache to drop on 2.0.
- McpServer: 2.0's tool callback reads no active-persona header and its
  prompt callback resolves the token from the transport context. Both now
  run inside the clean request context. McpServerRequestContextTest
  follows that: a persona left on the worker replaces the header test,
  and the prompt tests pass the token in the context.
- CacheBundleTest puts back the user repository it replaced in the
  JVM-wide registry. Its mock answers every user name, and in 2.0's unit
  run it made ODCSConverterTest's owner lookups find users.
- Not carried: RdfPolicyRevocationIT (2.0 has no agent SPARQL endpoint),
  the implementation plan and the docs/index.md entry (2.0 has no index).
  The ADR is carried with its guard list matched to 2.0.

(cherry picked from commit 0ce7ed0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

2 participants