Repository navigation
feat(agent-context): add okf.<key> filter alias for OKF frontmatter extensions - #21888
shirshanka wants to merge 1 commit into
Conversation
PR SummaryOverview Filters compile to Unit tests cover spellings, case, Reviewed by Cursor Bugbot for commit 3bb1d70. Bugbot is set up for automated code reviews on this repo. Configure here. |
Smart test selectionpytest smoke testsMode: active. Only the selection below runs for the pytest smoke tests on this PR (applied:
Selected scopes (40 files or classes, 188 tests)
Add the commit |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3bb1d70. Configure here.
| "START_WITH", | ||
| [f"{spelling}=" for spelling in _okf_extension_spellings(extension_key)], | ||
| ) | ||
| return declared if negated else F.not_(declared) |
There was a problem hiding this comment.
Null checks ignore key case
Medium Severity
okf.<key> IS [NOT] NULL is a START_WITH prefix on okfExtensions, while = and IN use IEQUAL. On Search V3 that wildcard is case-sensitive, and a lowercase copy is added only when the prefix itself contains uppercase. okf.domain IS NOT NULL therefore misses a key stored as Domain or DOMAIN, and IS NULL treats that key as absent. Equality still matches those keys. The re-added x- spelling is always lowercase, so an X-domain key is missing from the prefix list entirely.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 3bb1d70. Configure here.
Connector Tests ResultsConnector tests failed for commit To skip connector tests, add the Autogenerated by the connector-tests CI pipeline. |


Stacked on #21876. Review that one first; this PR only adds the commit on top.
What
Agents can filter OKF documents by any custom frontmatter key with
okf.<key>:The server side is #21886, which indexes those keys as
key=valueentries in theokfExtensionsfield.How it maps
okf.<key> = v(andIN) becomesokfExtensions IEQUAL ["<key>=v", "x-<key>=v"]. It's case-insensitive, like the otherokf_*aliases.x-(x-domain), while earlier bundles use bare keys (domain). The index keeps keys as written, sookf.domainandokf.x-domainboth send both spellings. This costs one extra value in the same criterion, and agents don't need to know which version a bundle uses.!=/NOTnegates that condition.IS NOT NULLbecomesokfExtensions START_WITH ["<key>=", "x-<key>="], which finds documents that declare the key.IS NULLis its negation.>,<and similar operators are rejected with a clear error, since values are stored as text. So areokf.andokf.x-without a key.analysts, engineers), and a nested key uses dots (x-team.lead), as indexed by feat(okf): make OKF frontmatter extensions searchable and filterable #21886.The
search_documentstool description andFILTER_DOCSdescribeokf.<key>and add an example. On a server without #21886, the field doesn't exist and the filter matches nothing.Tests
tests/unit/cli/test_search_filter_parser.py: both spellings, case,INwith a joined value, nested keys and values with=, negation, null checks, combining withokf_type, and rejected forms.IEQUALandSTART_WITHcriteria this alias sends against a live server, on Search V3 and V2.Local:
:metadata-ingestion:testSingleon the parser tests (42 pass),:datahub-agent-context:testFull(689 pass) and:datahub-agent-context:lintare clean.:metadata-ingestion:lintreports no errors in these files.Checklist
🤖 Opened with cclaude on behalf of @shirshanka
Summary by cubic
Adds an
okf.<key>filter alias so agents can filter OKF documents by any custom frontmatter key, backed by theokfExtensionsindex field from the server-side change in #21886.okf.<key> = v,IN,!=, andIS [NOT] NULLmap to case-insensitiveIEQUAL/START_WITHcriteria onokfExtensions.domain) and OKF 0.3'sx-prefixed form (x-domain), so agents don't need to know which bundle version uses which.>,<) and keyless forms (okf.,okf.x-) are rejected with a clear error.Tests cover both spellings, case, joined list values, nested keys, negation, null checks, and rejection of unsupported forms.
Written for commit 3bb1d70. Summary will update on new commits.