fix: normalize legacy recognizer feedback review payloads#29251
fix: normalize legacy recognizer feedback review payloads#29251PRADDZY wants to merge 2 commits into
Conversation
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
| case "Generic" -> { | ||
| ObjectNode payload = JsonUtils.getObjectNode(); | ||
| if (taskDetails.has("suggestion") && !taskDetails.get("suggestion").isNull()) { | ||
| payload.put("data", taskDetails.get("suggestion").asText()); | ||
| payload.put( | ||
| RecognizerFeedbackTaskPayloadKeys.LEGACY_DATA, | ||
| taskDetails.get("suggestion").asText()); | ||
| } | ||
| yield payload; |
There was a problem hiding this comment.
💡 Quality: Generic migration reuses recognizer-feedback constant for "data" key
In the Generic branch of the v200 task payload migration, the suggestion value is now written using RecognizerFeedbackTaskPayloadKeys.LEGACY_DATA (= "data"). The Generic task type is unrelated to recognizer feedback, so borrowing a constant from RecognizerFeedbackTaskPayloadKeys is semantically misleading — a reader could reasonably infer Generic tasks are recognizer-feedback payloads. It also couples this branch to a class whose LEGACY_DATA name implies a legacy/deprecated key, whereas for Generic tasks data is the intended modern key. Functionally the string value is unchanged, so this is purely a clarity concern. Consider defining a Generic-specific constant (e.g. GENERIC_DATA = "data") local to the migration or a shared, neutrally-named payload-keys class rather than reusing the recognizer-feedback constant.
Introduce a Generic-specific constant (GENERIC_DATA_KEY = "data") instead of reusing RecognizerFeedbackTaskPayloadKeys.LEGACY_DATA.:
case "Generic" -> {
ObjectNode payload = JsonUtils.getObjectNode();
if (taskDetails.has("suggestion") && !taskDetails.get("suggestion").isNull()) {
payload.put(GENERIC_DATA_KEY, taskDetails.get("suggestion").asText());
}
yield payload;
}
- Apply fix
Check the box to apply the fix or reply for a change | Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 4 resolved / 5 findingsNormalizes legacy recognizer feedback payloads in TaskRepository and migrations, resolving key mapping and redundancy issues. Update the v200 migration to use a dedicated constant instead of the generic recognizer-feedback key for clarity. 💡 Quality: Generic migration reuses recognizer-feedback constant for "data" keyIn the Introduce a Generic-specific constant (GENERIC_DATA_KEY = "data") instead of reusing RecognizerFeedbackTaskPayloadKeys.LEGACY_DATA.✅ 4 resolved✅ Edge Case: hasFeedbackPayload("data") may misclassify other Review tasks
✅ Quality: No unit test for TaskRepository.normalizeDataQualityReviewPayload
✅ Quality: Magic string literals for payload keys in normalization
✅ Performance: Redundant deepCopy after valueToTree in normalization
🤖 Prompt for agentsOptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
Describe your changes:
Related to #29233
While investigating #29233, I found current integration tests already expect recognizer feedback review tasks to be exposed as
DataQualityReview, so this PR does not change the public task type.Instead, it fixes the legacy payload path that still writes and reads recognizer feedback review tasks using
dataandmetadata.recognizer. Current resolver and UI paths expectfeedbackandrecognizer.This change:
DataQualityReviewpayloads on read inTaskRepositorydatapayloads as feedback approval tasks inTaskFormExecutionResolverv200migration path to emit modern payload keysType of change:
High-level design:
N/A - small change.
Tests:
Use cases covered
v200continue to resolve as feedback approval tasks.v200migrations emitfeedbackandrecognizerpayload keys expected by current task code.Unit tests
openmetadata-service/src/test/java/org/openmetadata/service/tasks/TaskFormExecutionResolverTest.javaopenmetadata-service/src/test/java/org/openmetadata/service/migration/utils/v200/MigrationUtilTest.javaBackend integration tests
TagRecognizerFeedbackITalready asserts the currentDataQualityReviewtask type expectations.Ingestion integration tests
Playwright (UI) tests
Manual testing performed
mvn --% -pl openmetadata-service -am -DskipITs -Dtest=TaskFormExecutionResolverTest,MigrationUtilTest -Dsurefire.failIfNoSpecifiedTests=false testmainfailed in unrelated search and elasticsearch compile paths underopenmetadata-service.UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.