EPDD-13457 feat(filter): typed filter builder generated from the API filter grammar - #78
Open
joeyadelman wants to merge 1 commit into
Open
EPDD-13457 feat(filter): typed filter builder generated from the API filter grammar#78joeyadelman wants to merge 1 commit into
joeyadelman wants to merge 1 commit into
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
@codex please do an in-depth review of this PR. |
|
To use Codex here, create a Codex account and connect to github. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Python counterpart of profound-typescript-sdk#97 (EPDD-13457). The API publishes its report-filter grammar as
x-profound-filter-grammaron the OpenAPI spec (CQS #1494); this PR generates a Python field/operator table from that extension and adds a small builder on top so callers don't hand-write filter JSON.Source of truth is the spec, not this repo:
scripts/generate_filter_table.py [path-or-url]reads the spec (default: the Scalar registry@profound/apis/external-api/latest) and writessrc/profound/lib/filter_table.py(FieldSpec,FIELD_TABLE,Fields,MAX_DEPTH). It exits non-zero if the extension is missing, so the table is never silently overwritten with an empty grammar..github/workflows/sync-filter-table.ymlregenerates on every Scalar regeneration (push toscalar-nexttouchingscalar-sdk.manifest.json), nightly, and on dispatch, and commits the result toscalar-next. It will fail until CQS #1494 is live in the published spec — that is intended..github/workflows/filter-builder-ci.ymlruns the tests and regenerates from the committed fixturetests/fixtures/filter-grammar.openapi.json, failing on any diff so the generated file can't be hand-edited.Builder (
profound.lib.filter) returns plain dicts matching the API tree:Runtime guards mirror the TS builder and the server validators: unsupported field/op, depth >
MAX_DEPTH, prompt/entity layer mixing underor/not, emptyin/not_in,matchespatterns shorter than 3 chars.Targets
scalar-nextperVERSIONING.md(custom code lands there;mainonly advances via release PRs).Link to Devin session: https://profound.devinenterprise.com/sessions/7601ee8459424184a5c2525a48e94f99
Open in Devin Desktop: https://profound.devinenterprise.com/desktop/session/7601ee8459424184a5c2525a48e94f99?variant=devin
Requested by: @joeyadelman