Repository navigation
Fixes 28727: flatten testCaseResolutionStatusDetails index mapping + validate highlight fields at save time (Parts A & B) - #31839
Conversation
…pping to match its schema The resolution-status index mapping declared a `resolved` wrapper object under `testCaseResolutionStatusDetails` that no document can ever carry. The schema models that field as a oneOf over assigned.json / resolved.json, and resolved.json declares testCaseFailureReason / testCaseFailureComment / resolvedBy directly with "additionalProperties": false — so a `resolved` key is illegal, not merely absent. Doc building is generic (SearchIndex uses JsonUtils.getMap and TestCaseResolutionStatusIndex only adds fqnParts/@timestamp/parent relationships), so the indexed document has always been flat. Consequences: the 10x boost on `testCaseResolutionStatusDetails.resolved.testCaseFailureComment` matched nothing in any language, and the real flat fields were only indexed by accident via "dynamic": true — as analyzed text with the standard analyzer, so exact-match on testCaseFailureReason failed and CJK/Russian comment search was broken. Move the three properties up one level in all four locale mappings and repoint the boost. Each locale keeps its own analyzer (om_analyzer for en/ru, om_analyzer_jp for jp, ik_max_word for zh) and jp/zh keep their fields.ngram subfield. "dynamic": true is kept: after flattening, every property of both oneOf branches is mapped explicitly, so it is no longer load-bearing, but it remains the forward-compatibility net that lets a newly added schema property be indexed rather than silently dropped. Flipping it is a separate hardening decision. Keeping it also gives un-reindexed clusters a partial improvement immediately, since the repointed boost now targets a path dynamic mapping already created. UPGRADE: this requires a reindex of test_case_resolution_status_search_index. No DB migration is involved — IndexMappingVersionTracker hashes each mapping and the smart-reindex plan recreates just the changed index. But `migrate` alone is not enough and will not silently no-op: on any cluster that has ever resolved an incident, dynamic mapping already created testCaseResolutionStatusDetails.testCaseFailureReason as text, so the PUT _mapping that updateIndexes() sends is rejected 400 on both engines with "mapper [...] cannot be changed from type [text] to [keyword]" (reproduced on OpenSearch 3.4.0 and Elasticsearch 9.3.0). The rejection is atomic, so no property in that request lands, and on the OpenSearch path the cause is swallowed by OpenSearchIndexManager's catch block. Only the recreate path applies the new mapping and drops the stale `resolved` sub-object. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ch behavior tests Nothing indexed a Resolved-variant resolution-status document and nothing asserted the boost field list, which is why the dead `resolved` wrapper survived. SearchConsumerFieldBehaviorIT now indexes both oneOf branches (Assigned and Resolved) into the real per-language OpenSearch mappings and adds three probes: - the Incident Manager free-text search, built from TestCaseResolutionStatusIndex.getFields() so repointing a boost at a path no document carries fails the test; - an exact-match term on testCaseFailureReason, which distinguishes an explicitly mapped keyword from a field merely picked up by "dynamic": true; - _analyze on testCaseFailureComment per locale, which pins the per-locale analyzer and would catch a flatten that homogenized them. IndexMappingNestedFieldConsistencyTest gains a mapping-to-schema invariant that reads the oneOf branch schemas at runtime rather than hardcoding field names, so adding a property to assigned.json / resolved.json fails until the mappings follow. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…roves incidentFailureReasonFilterReturnsIncidentInAllLanguages reported "Incident Manager failure-reason exact match ... is broken in language(s)", but no production search query filters on testCaseResolutionStatusDetails.testCaseFailureReason — the UI reads it from _source, and IncidentTcrsSyncHandler / TestCaseResolutionStatusRepository read it from the task payload. The name and message would send someone hunting for a broken feature that does not exist. The test is valuable as a mapping-type probe: it is what distinguishes an explicitly declared keyword from a field merely picked up by "dynamic": true as analyzed text, on which an exact term can never match. Rename it to failureReasonSupportsExactMatchTermInAllLanguages, reword the assertion to describe the type guarantee rather than a feature, and add a javadoc saying why the probe exists. No behaviour change. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
…ight verdict
Three defects found in review, all in the same seam.
1. The UI dropped the flag. EntitySearchSettings mapped allowedFields to
{name, description} only, so `highlight` never reached FieldConfiguration
and every toggle rendered disabled no matter what the server sent.
2. allowedFields is not a complete list of configurable fields — 63 shipped
search fields have no entry (name.keyword, name.compound, columnNamesFuzzy,
…). The UI renders a row per search field and reads the verdict from
allowedFields, so those fields had no entry and read as unhighlightable.
annotateHighlightableFields now backfills a placeholder entry for every
configured search field, on the read path only.
3. Save-time validation could lock an upgraded cluster out of Settings > Search
(reported by gitar-bot). A highlight field stored before this check existed
is round-tripped by the UI on every save, so every subsequent PUT — even for
an unrelated edit — was rejected with an error the admin cannot clear from
the UI. A value already present in the stored settings is now dropped and
logged; only values this payload introduces are rejected.
Also addresses the duplication in HighlightFieldClassifier: the recursive
properties walk with dotted-path building already existed in
IndexMappingNestedFieldConsistencyTest (findExtensionTypeViolations /
findViolations / getTopLevelProperties). Extracted to IndexMappingProperties
and used by both, which removes the Map-based asMap/childProperties adapters
that existed only because the classifier walked a different representation than
the rest of the codebase.
The remaining gitar finding — the query-time union guard drops a field unsafe
in any single index — is pinned by
crossIndexCollisionsStayLimitedToKnownNonHighlightablePaths: exactly three such
collisions exist (changeDescription, incrementalChangeDescription, users) and
none is a plausible highlight field.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01PTQrUmyp9P6DpwZq4Rd9jT
…t does backfillConfiguredSearchFields read as a data migration — in this codebase `backfill*` is what the v11xx migration utils are called — but it neither migrates nor persists anything. It runs on the outgoing copy of a settings read and exists only because the UI renders one row per search field while reading the highlight verdict from allowedFields, and the two lists do not coincide. Renamed to listConfiguredSearchFieldsAsAllowed and reworded both javadocs to state where it runs, that nothing is stored, and why the flag is derived rather than persisted. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01PTQrUmyp9P6DpwZq4Rd9jT
manerow
left a comment
There was a problem hiding this comment.
Pulled the branch down and ran it locally. The highlight toggles break as soon as you hit Save.
To reproduce on a stock install: Settings → Preferences → Search Settings → Table, expand any field (description will do), change something, click Save. Every Highlight toggle on the page goes grey with "This field cannot be highlighted". Reload and they're fine again. Restore Defaults does the same thing.
The backend meanwhile still says the field is both highlighted and highlightable:
table.highlightFields = [name, displayName, description]
allowedFields[table][description].highlight = true
So the UI is showing the user the opposite of what the server actually thinks.
What's happening is that highlight only gets derived inside getSettingByName. Five endpoints can hand back searchSettings, and I checked each one:
highlight |
|
|---|---|
GET /system/settings/searchSettings |
true |
GET /system/settings |
false |
PUT /system/settings |
false |
PUT /system/settings/reset/searchSettings |
false |
PATCH /system/settings/searchSettings |
false |
The one that bites is the save. mergeSearchSettings throws away the annotated list and swaps in the seed's copy, which has no highlight key at all:
// SearchSettingsHandler.java:464
incomingSearchSettings.setAllowedFields(defaultSearchSettings.getAllowedFields());and the UI takes that PUT response straight into app state (EntitySearchSettings.tsx:290, and :579 for Restore Defaults), so from then on every field reads as unhighlightable. Worth noting SearchSettingsPage.handleResetToDefault already avoids this by ignoring the response and re-fetching.
For the fix I'd lean on what the codebase already does for href, which has the same shape as highlight: derived by the server, response-only, and clients hand it back. EntityResource deals with that by stamping it at every response boundary, create/update/patch/delete included (:593, 624, 674, 688, 731, 751). Same trick here: generalise withHighlightFlags and call it from all five places.
private Settings forResponse(Settings settings) { /* today's withHighlightFlags body */ }
private Response forResponse(Response response) {
return response.getEntity() instanceof Settings s
? Response.fromResponse(response).entity(forResponse(s)).build()
: response;
}getSettingByName and list wrap the settings, createOrUpdateSetting and patch wrap the response (after the write, so nothing derived gets persisted). resetSettingToDefault returns a bare SearchSettings, so annotate a JsonUtils.deepCopy there rather than the object itself.
Keep annotating copies, by the way. Mutating in place looks safe right now only because readDefaultSearchSettings() has an inverted cache guard (if (defaultSearchSettingsCache != null) is always true, so it re-reads the seed every call). If anyone ever fixes that guard, in-place annotation would start corrupting the shared default.
On tests: servedAllowedFieldsCarryTheHighlightFlag is the right test, just pointed at one endpoint. Running it over all five would have caught this, which is the wiring-level job its own javadoc describes. Same for the new Playwright test, worth having it save and then re-check the toggle.
Separate and non-blocking: "default": false in the schema generates private Boolean highlight = false;, so "nobody derived this" and "this field can't be highlighted" look identical on the wire, and the failure lands on the side that silently removes a working feature. Field is @JsonInclude(NON_NULL), so dropping the default would leave the key absent instead, and ?? true in FieldConfiguration.tsx:60 would make a future miss fall back to today's behaviour rather than disabling everything. The 400 on save is the real enforcement either way. Only catch is the client-built extension.* rows in fetchCustomProperties would then need an explicit highlight: false.
…e boundary Five endpoints serve searchSettings; only the named GET derived allowedFields[].highlight, so the other four served the schema default false for every field. The save is the one that bit. mergeSearchSettings swaps in the seed's allowedFields, which carry no verdict, and the UI writes the PUT response straight into app state -- so one Save greyed out every highlight toggle on the page, telling the user the opposite of what the server had stored. A reload fixed it, which is why the reload-based tests never saw it. Generalise withHighlightFlags into forResponse and apply it at all five boundaries, the way EntityResource stamps href on create/update/patch/ delete rather than on GET alone. The write paths are annotated after the write, so nothing derived is persisted; the reset path returns a bare SearchSettings, so it gets a deep copy. Every overload annotates a copy: mergeSearchSettings hands the merged settings the default's own allowedFields list, so in-place would write the derived flag onto defaultSearchSettingsCache. Point the IT at all five endpoints instead of one -- checking a single endpoint is what let this through -- and assert the contradiction directly: a response may not call a field highlighted and unhighlightable at once. Make the Playwright test save and re-check without reloading. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Ry156vsrMhA9D7KGZ9uNvQ
|
Code Review
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source
| /** Classifies {@code field} against the index mapping of {@code entityType}. */ | ||
| public static HighlightSupport classify(String entityType, String field) { | ||
| Map<String, HighlightSupport> unsupported = mappingIndex().byEntity().get(entityType); | ||
| return unsupported == null ? HighlightSupport.SUPPORTED : resolve(unsupported, field); | ||
| } |
| <Tooltip | ||
| placement="top" | ||
| title={t('message.field-cannot-be-highlighted')}> | ||
| <TooltipTrigger> | ||
| <Switch | ||
| disabled | ||
| checked={false} | ||
| className="m-l-xlg" | ||
| data-testid="highlight-field-switch" | ||
| /> | ||
| </TooltipTrigger> | ||
| </Tooltip> |
| "fetch-domain-list-error": "هنگام واکشی دامنهها خطایی رخ داد", | ||
| "fetch-pipeline-status-error": "خطا در دریافت وضعیت لوله داده.", | ||
| "field-ca-certs-description": "مسیر گواهینامه باید به پیکربندی اضافه شود. مسیر باید به صورت محلی در کانتینر Ingestion باشد.", | ||
| "field-cannot-be-highlighted": "Este campo não pode ser destacado. Apenas campos de texto analisados suportam destaque.", |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 42 out of 45 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
openmetadata-ui/src/main/resources/ui/src/locale/languages/pr-pr.json:3706
- The
pr-pr.jsonlocale file is Persian, but the newmessage.field-cannot-be-highlightedstring is in Portuguese. This will show the wrong language in the UI for this locale.
| for (String field : listOrEmpty(assetConfig.getHighlightFields())) { | ||
| HighlightSupport support = | ||
| HighlightFieldClassifier.classify(assetConfig.getAssetType(), field); | ||
| if (support == HighlightSupport.SUPPORTED) { |
|



Describe your changes:
Fixes #28727
Both parts of #28727 — this closes the issue. Issue #28727 has two parts and this PR now carries both.
testCaseResolutionStatusDetailsmapping↔schema mismatch (deadresolved.*mapping + dead search boost).A correction to the issue text for reviewers: #28727 says Part B should reuse
SearchSourceBuilderFactory.isHighlightUnsafeField, added by #28674. That symbol never existed onmain. The equivalent query-time guard landed separately via #29073 (7738765de58) asOpenSearchSourceBuilderFactory.isFlattenedExtensionField— OpenSearch-only and hardcoded toextension. #28674 was later rewritten into a config-driven version of Part B and closed unmerged on 2026-08-24, so thehighlightflag it introduced never landed. Part B here is built onmainand reuses the concept, not the (nonexistent) symbol.I flattened the
testCaseResolutionStatusDetailsindex mapping so it matches its JSON Schema, and repointed the resolution-comment search boost at the path documents actually carry.The mapping declared a
resolvedwrapper object that the schema makes structurally impossible.testCaseResolutionStatus.jsonmodels the field asoneOf [assigned.json, resolved.json], and both branches are"additionalProperties": false—resolved.jsondeclarestestCaseFailureReason/testCaseFailureComment/resolvedBydirectly. So aresolvedkey could never legally appear in a document, and indeed never did: doc building is generic (SearchIndex→JsonUtils.getMap(entity);TestCaseResolutionStatusIndexonly addsfqnParts,@timestamp, and parent relationships). The consequence was a dead 10× boost —testCaseResolutionStatusDetails.resolved.testCaseFailureCommentinTestCaseResolutionStatusIndex.getFields()matched nothing, in every language."dynamic": trueon that node was masking the bug: it indexed the real flat fields anyway, but as standard-analyzertextrather than the declared types. That broke exact match ontestCaseFailureReason(analyzed text never matches an exact term) and broke CJK/Cyrillic comment search (the standard analyzer splits Japanese/Chinese into single characters and does not stem Russian).Type of change:
High-level design — Part A
Approach — the issue's option 1: correct the mapping to the schema, don't reshape the document. The schema and the document are already flat and are the source of truth; only the mapping was wrong. Reshaping the document to match the mapping would mean writing a wrapper key that
additionalProperties: falseforbids.Files changed (7):
openmetadata-spec/.../elasticsearch/{en,jp,ru,zh}/test_case_resolution_status_index_mapping.jsontestCaseFailureReason/testCaseFailureComment/resolvedByup one level, out of theresolvedwrapper. Pure unwrap — no other edit.openmetadata-service/.../search/indexes/TestCaseResolutionStatusIndex.javatestCaseResolutionStatusDetails.testCaseFailureComment(one line).openmetadata-service/src/test/.../IndexMappingNestedFieldConsistencyTest.javaopenmetadata-integration-tests/.../SearchConsumerFieldBehaviorIT.javaThere is no separate OpenSearch resource tree — the same four files serve both engines, with
OsUtils.enrichIndexMappingForOpenSearchrewriting at runtime.Per-locale analyzers deliberately preserved, not homogenized. en/ru keep
om_analyzer; jp keepsom_analyzer_jp(kuromoji) and itsfields.ngram; zh keepsik_max_wordand itsfields.ngram. Verified byte-for-byte: en ≡ ru in this subtree, and unwrapping the baseresolvedobject withjqyields output identical to this branch in all four locales."dynamic": truekept — deliberate. After flattening, every property of bothoneOfbranches is mapped explicitly, sodynamicis no longer load-bearing for correctness. It is retained as the forward-compatibility net: a property added toassigned.json/resolved.jsonstill gets indexed rather than silently dropped, and the new unit test fires immediately in that case. Flipping it tofalseis a separate hardening decision and would couple a silent-data-loss behavior change to a mapping correction.Alternative rejected: rewriting the document in
TestCaseResolutionStatusIndexto emit aresolvedwrapper. That would contradict the schema, break the UI and Python (both already read/write the flat shape), and invalidate the existingtestCaseResolutionStatusDetails.assignee.namefilter pattern.High-level design — Part B
Problem. Search Settings accepted a highlight field the index mapping can never highlight. Two mapped shapes cannot highlight:
flattened(rewritten toflat_objectfor OpenSearch byOsUtils) has no analyzer and fails the highlight shard — a 500 on the search;enabled: falseis kept in_sourcebut never indexed, so a highlight on it silently matches nothing. The bad value was only neutralised at query time and still lived in the settings.Approach — derive from the mappings, don't maintain a list.
HighlightFieldClassifierwalks the index-mapping resources once and classifies a dotted path asSUPPORTED,NOT_INDEXED, orNOT_ANALYZABLE. This same knowledge previously lived as hardcoded path lists that had to be restated on every mapping change — see the duplicatedSTALE_FLATTENED_CHILDREN_FIELDSin the v1130 and v11210 migration utils — and drifted each time.A field that is absent from the mapping stays supported: the highlighter skips unmapped fields without erroring, so rejecting them would break configurations that merely name a field an index does not carry.
One classifier backs three call sites:
SearchSettingsHandler.validateHighlightFieldsSearchSettingsHandler.annotateHighlightableFieldsallowedFieldsso the UI only offers a toggle that worksOpenSearchSourceBuilderFactory.buildHighlightsV2isFlattenedExtensionFieldThis closes a live gap. The guard it replaces matched only
extension/extension.*.extensionis now{"type":"object","enabled":false}in 35 mappings, while the one genuinelyflattenedfield left —aiGovernance.complianceStatus(ai_application,llm_model,mcp_server) — was not covered. The classifier catches it;flattenedFieldIsNotAnalyzableasserts so. The oldextensionbehaviour is preserved deliberately and asserted byqueryTimeGuardStillDropsExtensionAsBefore, because clusters whose indexes were created whileextensionwas stillflattenedkeep that mapping until a reindex.Validation hooks the REST payload, not
mergeSearchSettings— deliberate.mergeSearchSettingsis the obvious home and is a trap:SettingsCache.initializecatches onlyIOException(SettingsCache.java:205), so throwing from the merge path would fail startup on any cluster already carrying a bad value. The check runs on the incoming payload inSystemResource.createOrUpdateSetting, alongside the existingvalidateGlobalSettings.The UI flag is derived, not seeded. The closed #28674 hand-typed
"highlight": trueinto ~200 seed entries and added migration v11211 to scrub stored values against it. Here the flag is computed from the same classifier the validator uses, and the seed is untouched — so what the UI offers and what the API accepts cannot disagree, and no migration is needed.annotatedFlagAgreesWithWhatTheSavePathAcceptswalks every shipped allowed field and asserts the two agree.Part B needs no reindex and no migration — no mapping changes, no stored-data changes. The reindex note below applies to Part A only.
Known limitation, deliberately out of scope.
PATCH /v1/system/settings/{settingName}(SystemResource.java:765) writes straight to the repository with no search-settings validation. It bypasses this check — and already bypasses the pre-existingvalidateGlobalSettings, sokeywordWeight: 5can be set through it today. Pre-existing hole affecting all settings validation; the query-time guard remains as defense-in-depth for values arriving that way.Applies to Part A only. This change requires a reindex of
test_case_resolution_status_search_index.migratealone is not sufficient and will log a mapping-update failure for that index. (Part B requires neither a reindex nor a migration.)migratereachessearchRepository.updateIndexes()(OpenMetadataOperations.java:1196), which issuesPUT _mapping. On any cluster that has ever resolved an incident,dynamic: truehas already created those fields astext, so declaring themkeywordis an incompatible type change and the request is rejected 400:Three things worth knowing:
…testCaseFailureReason, Elasticsearch 9.3.0 reported…resolvedBy.idfor the identical request. Same 400, same atomicity; a different field name is not a different bug.OpenSearchIndexManagerlogs"Failed to Update Open Search index {}"without the exception, so an operator sees one bare error line and a silently stale mapping.The supported path is
./bootstrap/openmetadata-ops.sh reindex(no trailing period — it is parsed as part of the subcommand). It is also the only path that drops the staleresolvedsub-object, sincePUT _mappingcannot remove a field.IndexMappingVersionTrackerhashes each mapping, so the smart-reindex plan picks uptestCaseResolutionStatusand recreates just that index — no DB migration is involved.Mitigating point: because
"dynamic": truewas retained, un-reindexed clusters still get a partial improvement immediately — the repointed boost now targets a path dynamic mapping has already created (as standard-analyzer text) rather than a path with no values at all. Full correctness (declaredkeyword, per-locale analyzers) arrives with the reindex.Tests:
Use cases covered
testCaseResolutionStatusDetailsis indexed and searchable at all — previously no test anywhere indexed a Resolved-variant document.testCaseFailureReasonsupports exact-match term lookup, i.e. its declaredkeywordtype is actually in effect.assignee.namefilter, test-case/origin-entity filters) is unchanged.Unit tests
openmetadata-service/src/test/java/org/openmetadata/service/search/IndexMappingNestedFieldConsistencyTest.javaresolutionStatusDetailsMappingMustMatchSchemaPropertiesasserts the mapped subfield set equals the union of thepropertiesof everyoneOfbranch, read from the JSON Schema at runtime rather than hardcoded — so adding a property toassigned.json/resolved.jsonfails this test until the mappings follow. It guards the class of bug, not just this instance.Tests run: 7, Failures: 0, Errors: 0, Skipped: 0(1 failure before the fix).Coverage on the changed class — measured, and honestly short of the 90% target. Ran
mvn -P static-code-analysis -pl openmetadata-service test jacoco:reportscoped to the search tests.TestCaseResolutionStatusIndex.javaline coverage is 62.8% (27/43):<init>buildSearchIndexDocInternalgetEntityTypeNamesetParentRelationshipsgetEntitygetFields— the method this PR changesThe 0% on
getFieldsis a measurement artifact, not an untested line:getFields()is executed directly by the new integration test (incidentResolutionCommentSearchReturnsIncidentInAllLanguagesbuilds its query fromTestCaseResolutionStatusIndex.getFields()), and that test lives inopenmetadata-integration-tests— a separate Maven module whose execution this-pl openmetadata-servicejacoco run does not observe. The changed line is covered by an automated test that fails without the fix; it is simply not covered by a unit test in the measured module. The remaining gaps (setParentRelationships,getEntity) are pre-existing and untouched by this PR.Backend integration tests
openmetadata-integration-tests/.openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/SearchConsumerFieldBehaviorIT.javaThis class boots a real OpenSearch 3.4.0 testcontainer with analysis-kuromoji and analysis-ik, creates the real mapping for every language in
IndexMappingLanguage(en/jp/ru/zh), indexes real documents and runs the actual consumer queries. I added a Resolved-variant document alongside the existing Assigned one, plus three tests:incidentResolutionCommentSearchReturnsIncidentInAllLanguagesmost_fields/operator:andmulti_matchbuilt fromTestCaseResolutionStatusIndex.getFields()— returns the incident when searching a word unique to its comment. Because the field list comes from production code, repointing a boost at a dead path fails this test.is broken in language(s): [en, jp, zh, ru], 0 hits everywherefailureReasonSupportsExactMatchTermInAllLanguagestermontestCaseResolutionStatusDetails.testCaseFailureReasonreturns the incident, i.e. the declaredkeywordis in effect. A type probe, not a product feature — nothing filters on the reason today; it is what distinguishes "explicitly mapped" from "accidentally indexed bydynamic:true".is broken in language(s): [en, jp, zh, ru]resolutionCommentUsesLanguageAnalyzerInAllLanguages_analyzeon the comment field yields each locale's expected token, proving the per-locale analyzer survived the flatten.ru expected 'продаж' but got [ежемесячные, продажи],zh expected '销售' but got [北, 京, 大, 学, 的, 销, 售, 报, 表],jp expected '東京' but got [東, 京, タワー, の, 売, 上]Tests run: 20, Failures: 0, Errors: 0, Skipped: 0(3 failures before the fix; the 17 pre-existing tests passed throughout, so the added document perturbs nothing).Elasticsearch — verified by hand only. The automated IT runs OpenSearch 3.4.0. On a real ES 9.3.0 container the branch mapping creates cleanly, the flat Resolved document indexes, and both the boost query and the
testCaseFailureReasonterm filter return 1 hit — against 0 hits on the base mapping. This was done manually during review; no automated ES coverage exists for this index, so a future ES-only regression would not be caught by CI.Ingestion integration tests
ingestion/.../sample_data.pyalready writes the flat shape and needed no change.Part B tests
Unit —
HighlightFieldClassifierTest(8 tests, new). Reads the real mapping resources, so each assertion is a statement about the shipped mappings:extension→NOT_INDEXED;extension.someCustomPropertyandcolumns.children.nameinherit their parent's verdict;aiGovernance.complianceStatus→NOT_ANALYZABLE(the case the old guard missed);name/description/columns.name→SUPPORTED; an unmapped field and an unknown asset type stay supported;extension/extension.*still dropped by the query-time guard.Unit —
SearchSettingsHandlerTest(6 added, 20 total). Rejects a non-indexed and a flattened highlight field with a message naming the field and the reason; accepts an analyzed one; the shipped seed passes the validator; the query-time union guard drops none of the shipped highlight fields; the annotated flag agrees with what the save path accepts.Backend IT —
HighlightFieldSaveValidationIT(4 tests, new).servedAllowedFieldsCarryTheHighlightFlagassertshighlight=trueon the realGET /system/settings/searchSettingsresponse. It guards the wiring: the unit tests callannotateHighlightableFieldsdirectly, so they pass even when nothing in production calls it — which is exactly the regression that reached review. The remaining three: PUTs to the real/v1/system/settingsand asserts 400 forextension.foundry_rid(message names the field and says "not indexed") and fordataModel.columns.children.name, and 2xx fordescription— so the negatives cannot pass merely because the endpoint rejects anyhighlightFieldsedit.Two existing ITs updated.
ExtensionHighlightSearchITandFlattenedChildrenHighlightSearchITconfigure exactly the values now rejected on save, to prove the query-time guard tolerates them. Their PUT would now 400, so they write the bad value through the repository instead — which is also truer to what they test: a value stored before this check existed. Their query-time assertions are unchanged.Playwright (UI) tests
SearchSettings.spec.ts→ "Highlight toggle is offered for analyzed fields", which drives the real Search Settings page against a real server and asserts the toggle renders enabled. This is the level the regression above lived at: the Jest test suppliesentityFieldsas props, so it can never catch a backend that stops annotating the flag.yarn lint:playwrightpasses with 0 errors and no new warnings.Not applicable — Jest covers the change.Part A has no UI changes. Part B's UI change is one control's disabled state, covered byFieldConfiguration.test.tsx(5 passed), including a new case asserting the toggle is disabled and the change handler is not called. This is component-level state, not a user journey across pages, so it does not warrant an E2E test.Manual testing performed ✅
Part A — mapping flatten and boost
Steps 1 and the reindex/mapping inspection below are the reproducible procedure; steps marked (not verified) were not executed against a running OpenMetadata stack — the equivalent effects are covered by the automated IT against a real engine, and the
PUT _mappingrejection in step 3a was reproduced directly against both engines rather than throughopenmetadata-ops.sh.Index mapping changed for entity: testCaseResolutionStatusand only that entity in the plan; a secondreindexreports no changes.migrate-only path fails as described in the upgrade note above (400, atomic, cause swallowed on OpenSearch).["assignee","resolvedBy","testCaseFailureComment","testCaseFailureReason"]and noresolved. Then checktestCaseFailureCommentcarries"type":"text"with the locale's analyzer (om_analyzeren/ru,om_analyzer_jpjp,ik_max_wordzh) and, for jp/zh, afields.ngramsubfield.FalsePositive, commentflakyupstream feed was backfilled.hits.total.value: 0; post-fix the incident is returned. Re-run with&explain=trueand confirm the winning clause istestCaseResolutionStatusDetails.testCaseFailureComment^10.0, ranking a comment match above atestCaseResolutionStatusType^1.0match.SearchListFilter→testCaseResolutionStatusDetails.assignee.name) and the incident detail panel still renders reason/comment/resolvedBy.Part B — save-time validation and the UI toggle
Continuing on the same stack. No reindex or migration is needed for these steps.
The
highlightflag is served. It is derived, not stored — absent fromsearchSettings.jsonon disk, present in the payload:Expect
"highlight": trueon both. The flag is derived, not stored — it is absent fromsearchSettings.jsonon disk and appears only in the served payload.This step earns its place: it caught a real regression during review. The flag was originally
annotated in
readDefaultSearchSettings, which is not the path that produces the servedpayload —
SettingsCache.initializewrites the store from the seed file directly and neverannotated it. Every field came back as the schema default
false, and because the UI readsentityFieldConfig?.highlight ?? false, every highlight toggle rendered disabled. It is nowannotated in
getSettingByName, so the served flag is correct regardless of which path wrote thestored settings — including clusters that persisted them before the flag existed.
(not verified) No existing toggle changes state — the important regression check. Go to Settings → Preferences → Search Settings → Table (
/settings/preferences/search-settings/table) and expandname,description,columns.name. Every Highlight toggle is still interactive. Zero shipped search fields are unhighlightable, so this change must be invisible on a default install.(not verified) The disabled toggle. Since a default install shows none, add one: on the same page add a search field named
extension.foundry_rid(it renders with the blue Custom badge), then expand it. Its Highlight toggle is greyed out and unclickable, and hovering shows "This field cannot be highlighted. Only analyzed text fields support highlighting." Contrast withdescriptionon the same page, which stays interactive.Why:
extensionis{"type":"object","enabled":false}intable_index_mapping.json, so nothing beneath it is indexed and a highlight there could never match.The save path rejects it — the toggle is an affordance, the 400 is the enforcement. For API clients that bypass the UI:
Expect HTTP 400:
Repeat with
dataModel.columns.children.namefor the same 400, and withdescriptionfor HTTP 200.(not verified) Search still works. Search any container or table from Explore; results and highlighting are unchanged.
Gates run for Part B:
mvn test -nsu -pl openmetadata-service -Dtest='org.openmetadata.service.search.**.*Test,SearchSettingsHandlerTest'Tests run: 2246, Failures: 0, Errors: 0, Skipped: 0mvn spotless:check -nsu -pl openmetadata-service,openmetadata-integration-tests0 needs changes to be cleanin both,BUILD SUCCESSmvn test-compile -nsu -pl openmetadata-integration-testsBUILD SUCCESSyarn test src/components/SearchSettings/FieldConfigurationTests: 5 passed, 5 totalyarn ui-checkstyle:changed0 errors;✔ No new Antd imports or .less filesnpx tsc --noEmitRED checks — each fix proven to fail without it:
throwinvalidateHighlightFieldsbehindif (false)→saveIsRejectedForNonIndexedHighlightFieldandsaveIsRejectedForFlattenedHighlightFieldboth fail with "ExpectedSystemSettingsExceptionto be thrown, but nothing was thrown."isHighlightAllowed = trueinFieldConfiguration.tsx→Should disable the highlight toggle…fails (1 failed, 4 passed). Restored →5 passed.Not executed:
HighlightFieldSaveValidationITand the two updated ITs are compile-verified only — they need an OpenSearch container and a booted app. Steps 9, 10 and 12 were likewise not run against a live stack.Gates run on the rebased branch for Part A (spec + service installed from the working tree first):
mvn spotless:check -nsu -pl openmetadata-service,openmetadata-integration-tests0 needs changes to be cleanin both modules,BUILD SUCCESSmvn test -nsu -pl openmetadata-service -Dtest='org.openmetadata.service.search.**.*Test,SearchListFilterTest'Tests run: 2231, Failures: 0, Errors: 0, Skipped: 0mvn test -nsu -pl openmetadata-integration-tests -Dtest=SearchConsumerFieldBehaviorITTests run: 20, Failures: 0, Errors: 0, Skipped: 0UI screen recording / screenshots:
Part A contains no UI changes. Part B changes one component:
FieldConfiguration.tsx(Settings → Preferences → Search Settings → entity).The change is a single control's state. On a default install nothing changes — none of the search fields shipped in
searchSettings.jsonare unhighlightable (asserted byqueryTimeGuardKeepsEveryShippedHighlightField), so every existing Highlight toggle stays interactive. The new state is only reachable by adding a custom-property search field:description,name,columns.name(shipped)extension.foundry_rid(custom property, blue Custom badge)Screen recording not attached — the visual delta is one disabled switch plus a tooltip, and it is covered by
FieldConfiguration.test.tsx(Should disable the highlight toggle for a field that cannot be highlighted, which asserts bothtoBeDisabled()and that the change handler is not called). Step 5 of the manual testing section is the exact click-path to reproduce it. Happy to record one if a reviewer wants it.Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.configuration/searchSettings.jsongains an optionalhighlightboolean onallowedFields[].fields[]. Generated output was regenerated, not hand-edited: Java POJOs viamvn clean install -pl openmetadata-spec(build-time, not committed), and the three committed TS types (configuration/searchSettings.ts,settings/settings.ts,api/search/previewSearchRequest.ts) viajson2ts.sh— followed byyarn license-header-fix, because quicktype strips the Apache header. The committed TS diff is purely additive (+21/−0).make generate(Pydantic) is not required: nothing iningestion/readsallowedFields. No SQL migration. Part A's mapping drift is tracked by content hash inIndexMappingVersionTrackerand resolved by reindex (see the upgrade note); Part B changes no stored data — thehighlightflag is derived at read time. Precedent for the mapping resources: 14b3a57 (fix(search): add nested customPropertiesTyped mapping to 5 entity indexes #30501) changed 20 mapping JSONs with no SQL and no version bump.FieldConfiguration.tsx) plus one i18n key, translated in all 19 non-English locales rather than left as the English placeholderyarn i18ninserts.yarn ui-checkstyle:changedpasses with 0 errors, includingtw-guard— the tooltip usesTooltip/TooltipTriggerfrom@openmetadata/ui-core-components, since addingTooltipto the file's existingantdimport would have been flagged as new Ant Design debt.mainand pass here; the RED output is quoted in the tables above.🤖 Generated with Claude Code
Greptile Summary
The PR aligns test-case resolution-status mappings with the schema and introduces mapping-derived highlight-field validation and UI affordances.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart LR M[Index mappings] --> C[HighlightFieldClassifier] C --> V[Save-time validation] C --> R[Response annotation] C --> Q[Query-time guard] R --> U[Search Settings UI] V --> P[Persist valid settings] Q --> S[Safe search highlights]Reviews (7): Last reviewed commit: "Fixes #28727: derive the highlight flag ..." | Re-trigger Greptile
Context used (5)