-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix(governance): resolve inherited fields freshly instead of from a never-cleared cache #31133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
harshach
wants to merge
15
commits into
main
Choose a base branch
from
harshach/inherited-reviewers-workflow-it
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5363c70
fix(governance): resolve inherited reviewers in the approval gate
harshach 5b3d8e4
refactor(governance): resolve effective reviewers generically, not pe…
harshach 22d0be9
test(governance): unit-test the reviewers gate; rename buildRuleData …
harshach f4a39d9
test(glossary): add inherited-reviewer approval repro for the stale p…
harshach 803630a
fix(governance): resolve inherited fields freshly instead of from a n…
harshach 8988195
fix(tests): wait for a committed status; match job events by enum
harshach 00b552b
fix(events): clear per-request context on every tick exit path
harshach f0186e1
Merge branch 'main' into harshach/inherited-reviewers-workflow-it
yan-3005 8ad9f0c
test(glossary): stabilize reviewer workflow test
yan-3005 8c3c908
test(glossary): wait for approval task
yan-3005 2df8ebe
fix(workflow): cancel after entity delete
yan-3005 45d423d
test(glossary): wait for inherited reviewer
yan-3005 bc1939c
Merge branch 'main' into harshach/inherited-reviewers-workflow-it
yan-3005 2e0a877
test(glossary): isolate inherited reviewer tests
yan-3005 ae99517
style(glossary): format inherited reviewer test
yan-3005 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
475 changes: 475 additions & 0 deletions
475
...ests/src/test/java/org/openmetadata/it/tests/GlossaryTermInheritedReviewerApprovalIT.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...ain/java/org/openmetadata/service/governance/workflows/WorkflowThreadCleanupListener.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| /* | ||
| * Copyright 2024 Collate | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.openmetadata.service.governance.workflows; | ||
|
|
||
| import org.flowable.common.engine.api.delegate.event.FlowableEngineEventType; | ||
| import org.flowable.common.engine.api.delegate.event.FlowableEvent; | ||
| import org.flowable.common.engine.api.delegate.event.FlowableEventListener; | ||
| import org.openmetadata.service.util.PerRequestContextCleaner; | ||
|
|
||
| /** | ||
| * Clears per-request ThreadLocal caches once an async job finishes. | ||
| * | ||
| * <p>Flowable's async-executor threads are pooled and long lived, and never pass through the JAX-RS | ||
| * response filter that clears these ThreadLocals for HTTP requests. Without this, a parent entity | ||
| * read by one job is served to every later job on the same thread for the life of the process. | ||
| * | ||
| * <p>Only the job-completion events are handled: both are dispatched on the async-executor thread | ||
| * itself, after the job's delegates have finished, which mirrors the response filter's "clear once | ||
| * the unit of work completes" semantics. Note the synchronous workflow path (a change event | ||
| * signalling a process inline) does not produce these events — that thread is cleaned by {@code | ||
| * AbstractEventConsumer}. | ||
| */ | ||
| public class WorkflowThreadCleanupListener implements FlowableEventListener { | ||
|
|
||
| @Override | ||
| public void onEvent(FlowableEvent event) { | ||
| // Registered engine-wide, so every event lands here: keep the check cheap and first. Compare | ||
| // against the enum constants rather than their names so that if Flowable renames an event type, | ||
| // this fails to compile instead of silently never clearing again. | ||
| if (event.getType() == FlowableEngineEventType.JOB_EXECUTION_SUCCESS | ||
| || event.getType() == FlowableEngineEventType.JOB_EXECUTION_FAILURE) { | ||
| PerRequestContextCleaner.clear(); | ||
| } | ||
| } | ||
|
|
||
| /** Cleanup must never fail the job that triggered it. */ | ||
| @Override | ||
| public boolean isFailOnException() { | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isFireOnTransactionLifecycleEvent() { | ||
| return false; | ||
| } | ||
|
|
||
| @Override | ||
| public String getOnTransaction() { | ||
| return null; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.