Repository navigation
Fixes #37516: Reject tag recognizers saved without a supported language - #37517
Conversation
The ingestion client's Tag model requires recognizerConfig.supportedLanguage for every recognizer type but predefined. The server accepted a recognizer without it, and the client then dropped every tag of that classification from auto-classification while the run still reported success.
A tag stored with a language-less recognizer before the rule must stay editable, including by recognizer feedback that patches the whole tag. Also reject an unknown language value, which the ingestion client skips the same way.
A predefined recognizer may omit supportedLanguage, but an unknown value is still skipped by the ingestion client. Adds ITs for POST rejecting a recognizer without a language and for a PUT resending stored recognizers without ids.
❌ PR checklist incompleteThis 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 |
| /** | ||
| * The ingestion client's Tag model requires a valid supportedLanguage on every recognizer type | ||
| * but predefined, where it may be omitted; a tag it cannot parse is skipped by | ||
| * auto-classification while the run passes. | ||
| */ | ||
| static void validateSupportedLanguage(Recognizer recognizer) { | ||
| JsonNode config = JsonUtils.valueToTree(recognizer.getRecognizerConfig()); | ||
| JsonNode language = config.path(SUPPORTED_LANGUAGE); | ||
| boolean languageOmitted = | ||
| PREDEFINED_RECOGNIZER_TYPE.equals(config.path("type").asText()) | ||
| && (language.isMissingNode() || language.isNull()); | ||
| boolean languageValid = | ||
| Arrays.stream(ClassificationLanguage.values()) | ||
| .anyMatch(l -> l.value().equals(language.asText())); | ||
| if (!languageOmitted && !languageValid) { |
There was a problem hiding this comment.
⚠️ Quality: Recognizer language rule is a client contract with no decision record
This PR adds a validation rule that the server and the ingestion client's Tag model must both follow, and the rule appears only in the PR description. Nothing in docs/decisions/ mentions supportedLanguage or tag recognizer validation. The repository squash-merges, so the description will not reach git log.
The record should state two things:
- The contract: every recognizer type except
predefinedmust setrecognizerConfig.supportedLanguageto aClassificationLanguagevalue. Apredefinedrecognizer may omit it, but any value it does set must be valid. This comes from the description: "Every recognizer type except predefined must set recognizerConfig.supportedLanguage to a valid ClassificationLanguage." - The grandfathering rule: "On update, only recognizer configs that are new or edited are checked … Configs are matched by value rather than id, because a PUT may resend recognizers without their ids."
The Collate recognizer form follow-up and any future ingestion-side change depend on this rule, and only the record would keep it in the tree. Fix: add a dated record under docs/decisions/ and cite it as ADR:<date>-<slug> from validateSupportedLanguage and validateChangedRecognizers.
Record both rules and cite the record from TagRepository.:
# docs/decisions/2026-11-<dd>-tag-recognizers-require-a-supported-language.md
Status: Accepted
Every recognizer type except `predefined` sets `recognizerConfig.supportedLanguage`
to a `ClassificationLanguage` value; a `predefined` recognizer may omit it but, if set,
it must be valid. On update only new or edited recognizer configs, matched by value
not id, are checked, so tags stored before this rule stay editable.
Was this helpful? React with 👍 / 👎
Code Review
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source
|
🤖 Backport to |
|
🤖 Backport to |
…ge (#37517) (#37568) * Reject tag recognizers saved without supportedLanguage The ingestion client's Tag model requires recognizerConfig.supportedLanguage for every recognizer type but predefined. The server accepted a recognizer without it, and the client then dropped every tag of that classification from auto-classification while the run still reported success. * Check recognizer language only on new or edited configs A tag stored with a language-less recognizer before the rule must stay editable, including by recognizer feedback that patches the whole tag. Also reject an unknown language value, which the ingestion client skips the same way. * Check a predefined recognizer's language when set; cover create and PUT A predefined recognizer may omit supportedLanguage, but an unknown value is still skipped by the ingestion client. Adds ITs for POST rejecting a recognizer without a language and for a PUT resending stored recognizers without ids. * Assert the language error and cover an explicit null predefined language (cherry picked from commit 93ec4e2) Co-authored-by: Ayush Shah <ayush02shah12@gmail.com>
Describe your changes:
Fixes #37516
The server now rejects a tag recognizer that the ingestion client cannot parse because of its language. Every recognizer type except
predefinedmust setrecognizerConfig.supportedLanguageto a validClassificationLanguage. Apredefinedrecognizer may leave it out, but if it sets one, the value must be valid. A violation returns 400 naming the recognizer.Why:
recognizerConfigis an untypedObjecton the server, so a config withoutsupportedLanguagewas stored as-is. The ingestion client's generated model requires the field, so it could not parse that tag. Auto-classification then skipped the tag; on 2.0.x it dropped the whole classification. The run still reportedsuccess.Where it runs:
prepare.TagUpdaterchecks only recognizers whose config is new or edited. A tag stored before this rule therefore stays editable, including when recognizer feedback patches the whole tag. Configs are matched by value, not id, because a PUT may resend recognizers without their ids.Type of change:
High-level design:
N/A — small change.
Tests:
Use cases covered
supportedLanguage→ 400.supportedLanguagefrom an existing pattern recognizer → 400, and the stored value is unchanged.supportedLanguage(written through the DAO) can still be edited: a PATCH of its description → 200, and a PUT resending its recognizers without ids → 200."english") is rejected for pattern and for predefined recognizers. A predefined recognizer without a language, and a pattern recognizer withany, are accepted.Unit tests
openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/TagRepositoryUnitTest.javamvn -pl openmetadata-service test -Dtest=TagRepositoryUnitTest: 24 run, 0 failures (ate012339af1).Backend integration tests
openmetadata-integration-tests/for new/changed API endpoints.openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/TagResourceIT.java:post_recognizerWithoutSupportedLanguage_rejected,patch_recognizerWithoutSupportedLanguage_rejected,patch_tagStoredWithoutSupportedLanguage_staysEditable,put_tagStoredWithoutSupportedLanguage_resentWithoutIds_accepted.e012339af1(mvn -pl openmetadata-integration-tests test-compile). The focused plan (make java_affected ARGS="--scope focused") selectsTagRepositoryUnitTestandTagResourceIT(mysql-elasticsearch, parallel).TagResourceITis pending and runs in the merge queue.Ingestion integration tests
Playwright (UI) tests
Manual testing performed
Not performed beyond the tests above. The failure was diagnosed on a 2.0.7 deployment: one pattern recognizer had been saved without
supportedLanguage, the pipeline loggedFailed to fetch tags for classification Sensitivity: 22 validation errors for Tag, and no column was tagged.UI screen recording:
Not applicable — backend-only validation change.
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: not applicable, no schema change.
supportedLanguageis alreadyrequiredin the recognizer schemas.For a UI feature or feature task: not applicable, backend only.
I have added tests (unit / integration / Playwright as applicable) and listed them above.
Self-review: I reviewed the final diff against
REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.e30264a882(pre-amend09bcb73692),8e48e6baff,9ecb0ee36c. The one 🔴, that a tag stored without a language became uneditable, is fixed in8e48e6baff.9ecb0ee36c.nullpredefined language, ine012339af1(test-only).recognizerConfig(regexFlags, unknown keys) against its schema. The stored configs carryscoreas a string, so full validation needs its own change.enoranyis a separate decision.Decision check: no record needed. The schema already requires the field, and the update-only-changed-configs rule is stated in the code comment at
TagUpdater.validateChangedRecognizers.Bug fix: I have added a test that covers the exact scenario we are fixing.