Repository navigation
feat(okf): make OKF frontmatter extensions searchable and filterable - #21886
shirshanka wants to merge 3 commits into
Conversation
PR SummaryOverview Ingestion Search indexes each entry as Reviewed by Cursor Bugbot for commit 46dfdfa. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Smart test selectionpytest smoke testsMode: active. Only the selection below runs for the pytest smoke tests on this PR (applied:
Selected scopes (45 files or classes, 205 tests)
Add the Playwright E2E testsThis run:
Specs selected because of this PR (18)
Add the commit |
i18n locale parityStatus:
Per-key detail is in the job summary of the ./gradlew :datahub-web-react:yarnI18nParityCheck # all locales
cd datahub-web-react && yarn check-i18n-parity --lang de # one locale |
There was a problem hiding this comment.
1 issue found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="metadata-ingestion/src/datahub/ingestion/source/repository_documents/okf_mapping.py">
<violation number="1" location="metadata-ingestion/src/datahub/ingestion/source/repository_documents/okf_mapping.py:66">
P2: These aliases are removed from searchable extensions but never mapped to their canonical fields, so `x-datahub-id`, `x-datahub-owners`, and `x-datahub-glossary_terms` are silently lost from derived metadata. Normalize the aliases before typed mapping or make the typed mapping read both spellings while retaining the exclusion from extensions.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| ) | ||
| # OKF 0.3 spellings of mapped keys, accepted as aliases. | ||
| MAPPED_KEY_ALIASES = frozenset( | ||
| {"x-datahub-id", "x-datahub-owners", "x-datahub-glossary_terms"} |
There was a problem hiding this comment.
P2: These aliases are removed from searchable extensions but never mapped to their canonical fields, so x-datahub-id, x-datahub-owners, and x-datahub-glossary_terms are silently lost from derived metadata. Normalize the aliases before typed mapping or make the typed mapping read both spellings while retaining the exclusion from extensions.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At metadata-ingestion/src/datahub/ingestion/source/repository_documents/okf_mapping.py, line 66:
<comment>These aliases are removed from searchable extensions but never mapped to their canonical fields, so `x-datahub-id`, `x-datahub-owners`, and `x-datahub-glossary_terms` are silently lost from derived metadata. Normalize the aliases before typed mapping or make the typed mapping read both spellings while retaining the exclusion from extensions.</comment>
<file context>
@@ -54,6 +55,17 @@
+)
+# OKF 0.3 spellings of mapped keys, accepted as aliases.
+MAPPED_KEY_ALIASES = frozenset(
+ {"x-datahub-id", "x-datahub-owners", "x-datahub-glossary_terms"}
+)
+MAPPED_KEYS = OKF_PROPERTY_KEYS | frozenset(NATIVE_MAPPINGS) | MAPPED_KEY_ALIASES
</file context>
There was a problem hiding this comment.
1 existing issue remains and no new issues found across 16 files
Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.
View guided diff | Turn on auto-fix | Re-trigger cubic
Bundle ReportBundle size has no change ✅ |
Connector Tests ResultsConnector tests failed for commit To skip connector tests, add the Autogenerated by the connector-tests CI pipeline. |
What
An OKF document can now be found by its custom frontmatter keys. A concept with
x-domain: finance(OKF 0.3) ordomain: finance(earlier bundles) matches the filterokfExtensions = x-domain=finance(ordomain=finance) on Search V2 and V3, and its extension values are matched by full-text search.Until now, keys with no typed field lived only in
okfProperties.raw, which isn't indexed, so nobody could search or filter on them.The field:
okfProperties.extensionsA new
extensions: optional map[string, string]onokfProperties, indexed asokfExtensions.id", "version keys remain extensions").customPropertieswould be confused with the native aspect of that name.x-prefix included. Mapped keys (id,type,title,description,status,stale_after,generated,verified,owners,tags,glossary_terms) and the accepted OKF 0.3 aliasesx-datahub-id,x-datahub-ownersandx-datahub-glossary_termsare left out.true,2,0.5). Dates are already strings.,([analysts, engineers]→analysts, engineers). Amap<string,string>holds one value per key. AMAP_ARRAYfield would allow one value per list item, but it's indexed as an object (okfExtensions.<key>), not askey=value, so it wouldn't filter likecustomProperties. With joining, a filter matches only the whole list, while full-text search still finds each item.x-team: {lead: alice}→x-team.lead = alice. OKF 0.3 allows nested custom values, and flattening keeps them filterable. Deeper levels are left out. If a flattened key matches a key written with dots, the first one in the file is kept and the other is reported.rawandfrontmatter): nulls, empty and blank values (empty counts as absent, including blank list items), and lists that contain objects, lists or nulls.=, since search storeskey=value. Values are up to 1,000 characters, well under GMS's 4,096-characterSEARCH_DOCUMENT_MAX_VALUE_LENGTH, which would otherwise drop longer values from the index without a word. Each file that goes over a cap, or nests too deeply, gets one warning listing the keys, and the count adds tookf_extensions_droppedin the report.x-datahub-*:x-datahub-id,x-datahub-ownersandx-datahub-glossary_termsare excluded because they're OKF 0.3 spellings of mapped keys. The mapping itself comes in feat(ingest/repository-documents): import OKF bundles by the OKF 0.3 rules #21885. Merge this PR after feat(ingest/repository-documents): import OKF bundles by the OKF 0.3 rules #21885 or together with it: on its own, this PR leaves those keys out of both the mapping andextensions.rawstays the only source of truth.extensionsis derived from it at import, like the other typed fields.Search
The annotation copies
customProperties:"/*"map,fieldType: TEXT.key=value(keyword plus.delimited) and queried by default, likecustomProperties.queryByDefault: falseandcopyToOther: true, likecustomProperties. Values reach full text through the sharedotherfield and stay out of the per-field query list, so the search template golden (field-manifest.json) doesn't change.EQUALonokfExtensionswithx-domain=financeis exact.IEQUALignores case.START_WITHwithx-domain=finds documents that declare the key.okfPropertiesschemaVersiongoes to 3, as #21877 did for the description. With unknown-data tolerance on, a rolled-back GMS uses the version stamp to treat rows that carryextensionsas the newer version's. GraphQL exposesOkfProperties.extensions: [StringMapEntry!].The ingestion
MAPPING_VERSIONgoes to 7. It feeds the source hash, so the next import rewrites concepts whose files haven't changed and fillsextensionswithout a forced re-run.Upgrade
The new field is added to the existing mappings, so no reindex is needed. Documents imported before this change have no
extensionsuntil they're imported again. Rerun the OKF ingestion recipe once; the mapping-version bump makes it rewrite every concept. RestoreIndices doesn't help here, because the stored aspects have noextensionsuntil re-import.Example
The agent filter alias
okf.domain = finance(stacked PRs below) sendsIEQUAL ["domain=finance", "x-domain=finance"]on this field.Tests
test_okf_metadata.py: scalars, lists, flattening and the depth cap, skipped values, mapped keys andx-datahub-*aliases left out, the count, length and=caps with one warning.test_github_documents_source.pyand the GitHub and GitLab documents integration goldens: extensions on the imported concept, mapping version 7.SearchDocumentTransformerTest:extensionsis indexed asokfExtensionskey=valueentries.SearchQueryBuilderTest: V2 default query fields includeokfExtensionsandokfExtensions.delimited.V3SearchFieldsTest:okfExtensionsis among the document's V3otherfull-text sources.DocumentMapperTest: GraphQL mapsextensions, and leaves it null when unset.test_okf_extensions_are_filterable: writes a concept withx-domain, a joined list and a flattened nested key. It finds the concept byEQUALon each one, byIEQUALon both spellings with different case, and bySTART_WITHx-domain=. It also finds it by full text on an extension value, and checks that a wrong value and an undeclared key don't match.How I tested it locally:
:metadata-io:testfiltered toSearchTemplateGoldenTest,V3SearchFieldModelTest,V3SearchFieldsTest,SearchQueryBuilderTest,SearchDocumentTransformerTest,MultiEntityMappingsBuilderTestandV2MappingsBuilderTest, plus:datahub-graphql-core:testDocumentMapperTest: all pass. The golden is unchanged.:metadata-ingestion:testSingleon the repository, GitHub and GitLab documents unit and integration tests: 330 pass.:metadata-ingestion:lintis clean for these files.scripts/dev/datahub-dev.sh start --local --job smoke-test):test_okf_search.pypasses on Search V3. With the V2 index on and V3 keyword reads off, the new extensions test passes too. The live V2 mapping hasokfExtensionsas keyword with.delimited.Related
okf.<key>: feat(agent-context): add okf.<key> filter alias for OKF frontmatter extensions #21888 (stacked on feat(agent-context): return OKF document properties and add okf_* filter aliases #21876) and feat(documents): add okf.<key> filter alias for OKF frontmatter extensions acryldata/mcp-server-datahub#303 (stacked on feat(documents): return OKF properties and add okf_* filter aliases acryldata/mcp-server-datahub#301).Checklist
🤖 Opened with cclaude on behalf of @shirshanka