fix(benchmark): adapt standings/matrix wrappers to query endpoints#663
fix(benchmark): adapt standings/matrix wrappers to query endpoints#663RapidPoseidon wants to merge 2 commits into
Conversation
ReviewLooked at the hand-written wrapper changes ( Overall: the fix is minimal, well-scoped, and correctly wires the wrappers to the new A couple of minor things worth a look, non-blocking:
Nothing else stood out — no security concerns (no user input reaches string formatting/eval, just JSON encoding into a typed filter field), and the endpoint/field renames all line up with the regenerated client. |
146931b to
20f8d25
Compare
ReviewReviewed the hand-written wiring ( Bug:
|
…ue in Rebased onto the latest regenerated client and made the SDK work end-to-end with the reshaped backend filter API: - Point the benchmark/leaderboard/participant wrappers at the new *_query_get standings & matrix endpoints (the old *_get were removed). - Adapt the flow manager to the regenerated IFlowModel, which is now a plain model (id/name) instead of a oneOf wrapper (no .actual_instance). - Build the standings/matrix filters inline: the backend's in operator (and the generated var_in) is a real array now, so the value is assigned directly with no JSON-string encoding. - Explode list-valued deepObject operators into repeated query params in the api.mustache template (field[in]=a&field[in]=b) and regenerate. The custom deepObject serializer only handled scalars, so a list value was emitted as a Python repr (tags[in]=['a', 'b']) and never parsed by the backend. Regenerating applied the fix to every filterable endpoint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-Authored-By: lino <lino@rapidata.ai>
20f8d25 to
9db59b8
Compare
|
Review Reviewed the hand-written changes in The core template fix is good: exploding list-valued DSL filter operators ( Bug:
( and the PR description makes the same claim (" But tracing the actual request path: For an empty list this loop runs zero times, so the PR description doesnt match the shipped code The description says a shared helper Minor: repeated boilerplate The two step Unrelated-looking change worth a second look
Nice to have No tests exercise Nothing here blocks merging as a fix for the broken endpoints/renamed params. The empty-list semantics issue looks like a pre-existing gap (the old codegen likely had the same problem) rather than a regression this PR introduces, but since the PR explicitly claims to preserve that semantic, it is worth either fixing it here or filing a follow-up. |
What & why
The new OpenAPI generator (surfaced by #662) reshaped the benchmark/leaderboard standings & matrix API, breaking the hand-written wrappers and failing the
type-check(Pyright) job on #662. Two changes landed in the generated client:/queryvariants:benchmark_benchmark_id_standings_get→benchmark_benchmark_id_standings_query_getbenchmark_benchmark_id_matrix_get→benchmark_benchmark_id_matrix_query_getleaderboard_leaderboard_id_standings_get→..._standings_query_getleaderboard_leaderboard_id_matrix_get→..._matrix_query_gettags,participant_ids,leaderboard_ids) to the shared filter-DSL typeAudienceAudienceIdJobsGetJobIdParameterwith singular field names (participant_id,leaderboard_id).The fix
rapidata_benchmark.py,leaderboard/rapidata_leaderboard.py, andparticipant/participant.pyat the new*_query_getmethods.benchmark/_query_filter.py(in_filter) that maps the public list arguments onto the DSLinoperator, JSON-encoding the list so the backend (FilterQuery.ParseValue→GetStringValues) parses it as a multi-valueIN (...)set.Nonedisables the filter; an empty list matches nothing — matching the prior documented semantics.Return-type shapes (
.itemswithname/wins/total_matches/score, and.data/.index/.columnsfor matrices) are identical between old and new outputs, so the consuming code needed no other changes.This branches off #662 so the fix can't be clobbered by a re-run of the schema-generation action.
Verification
pyright src/rapidata/rapidata_client→ 0 errors (was 5 on Update OpenAPI Schemas #662).black src/rapidata/rapidata_clientclean on touched files.in_filter(['a','b'])→{'in': '["a", "b"]'}, which the backend query binder JSON-parses into a multi-valueIN.Session: https://session-3e431d5b.poseidon.rapidata.internal/