Skip to content

Commit 5134c82

Browse files
chitalianJustin Torreclaude
authored
fix: Filter validation errors, provider filter, and pagination (#5520)
* fix: Allow TextOperators for request_body and response_body filters Changed request_body and response_body from VectorOperators to TextOperators to support text-based filtering operations like 'like', 'ilike', 'equals', etc. Previously, these fields only allowed 'contains' operator (VectorOperators), causing 422 validation errors when users tried to filter with 'like'. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: Add provider filter and fix pagination button logic 1. Added provider filter to REQUEST_TABLE_FILTERS so users can filter requests by provider (OpenAI, Anthropic, etc.) in the UI 2. Fixed inverted pagination button disabled logic in tableFooter.tsx - Changed from `!isCountLoading && condition` to `isCountLoading || condition` - Previously, buttons were enabled during loading and disabled after - Now buttons correctly disable during loading and at boundary pages Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * test: Update frontendFilterDefs tests for Provider filter - Updated expected length from 12 to 13 for REQUEST_TABLE_FILTERS - Added 'Provider' to expected filter labels - Updated request category filter count from 10 to 11 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Justin Torre <justin@Justins-MacBook-Pro.local> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 157a1a4 commit 5134c82

File tree

8 files changed

+23
-42
lines changed

8 files changed

+23
-42
lines changed

packages/__tests__/filters/frontendFilterDefs.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ describe('Frontend Filter Definitions', () => {
246246

247247
describe('REQUEST_TABLE_FILTERS', () => {
248248
test('should have correct structure and length', () => {
249-
expect(REQUEST_TABLE_FILTERS).toHaveLength(12);
249+
expect(REQUEST_TABLE_FILTERS).toHaveLength(13);
250250

251251
const filterLabels = REQUEST_TABLE_FILTERS.map(f => f.label);
252252
const expectedLabels = [
@@ -258,6 +258,7 @@ describe('Frontend Filter Definitions', () => {
258258
'Total Tokens',
259259
'User',
260260
'Model',
261+
'Provider',
261262
'Status',
262263
'Path',
263264
'Feedback',
@@ -278,7 +279,7 @@ describe('Frontend Filter Definitions', () => {
278279
const responseFilters = REQUEST_TABLE_FILTERS.filter(f => f.category === 'response');
279280
const feedbackFilters = REQUEST_TABLE_FILTERS.filter(f => f.category === 'feedback');
280281

281-
expect(requestFilters).toHaveLength(10);
282+
expect(requestFilters).toHaveLength(11);
282283
expect(responseFilters).toHaveLength(1);
283284
expect(feedbackFilters).toHaveLength(1);
284285
});

packages/filters/filterDefs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ interface RequestResponseRMTToOperators {
214214
[key: string]: SingleKey<TextOperators>;
215215
};
216216
scores_column: SingleKey<TextOperators>;
217-
request_body: SingleKey<VectorOperators>;
218-
response_body: SingleKey<VectorOperators>;
217+
request_body: SingleKey<TextOperators>;
218+
response_body: SingleKey<TextOperators>;
219219
cache_enabled: SingleKey<BooleanOperators>;
220220
cache_reference_id: SingleKey<TextOperators>;
221221
cached: SingleKey<BooleanOperators>;

packages/filters/frontendFilterDefs.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ export const REQUEST_TABLE_FILTERS: [
291291
SingleFilterDef<"request_response_rmt">,
292292
SingleFilterDef<"request_response_rmt">,
293293
SingleFilterDef<"request_response_rmt">,
294+
SingleFilterDef<"request_response_rmt">,
294295
SingleFilterDef<"request_response_rmt">
295296
] = [
296297
{
@@ -349,6 +350,13 @@ export const REQUEST_TABLE_FILTERS: [
349350
column: "model",
350351
category: "request",
351352
},
353+
{
354+
label: "Provider",
355+
operators: textOperators,
356+
table: "request_response_rmt",
357+
column: "provider",
358+
category: "request",
359+
},
352360
{
353361
label: "Status",
354362
operators: STATUS_OPS,

valhalla/jawn/src/tsoa-build/private/routes.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,14 +1107,9 @@ const models: TsoaRoute.Models = {
11071107
"type": {"dataType":"nestedObjectLiteral","nestedProperties":{"equals":{"dataType":"datetime"},"gte":{"dataType":"datetime"},"lte":{"dataType":"datetime"},"lt":{"dataType":"datetime"},"gt":{"dataType":"datetime"}},"validators":{}},
11081108
},
11091109
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
1110-
"Partial_VectorOperators_": {
1111-
"dataType": "refAlias",
1112-
"type": {"dataType":"nestedObjectLiteral","nestedProperties":{"contains":{"dataType":"string"}},"validators":{}},
1113-
},
1114-
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
11151110
"Partial_RequestResponseRMTToOperators_": {
11161111
"dataType": "refAlias",
1117-
"type": {"dataType":"nestedObjectLiteral","nestedProperties":{"country_code":{"ref":"Partial_TextOperators_"},"latency":{"ref":"Partial_NumberOperators_"},"cost":{"ref":"Partial_NumberOperators_"},"provider":{"ref":"Partial_TextOperators_"},"time_to_first_token":{"ref":"Partial_NumberOperators_"},"status":{"ref":"Partial_NumberOperators_"},"request_created_at":{"ref":"Partial_TimestampOperatorsTyped_"},"response_created_at":{"ref":"Partial_TimestampOperatorsTyped_"},"model":{"ref":"Partial_TextOperators_"},"user_id":{"ref":"Partial_TextOperators_"},"organization_id":{"ref":"Partial_TextOperators_"},"node_id":{"ref":"Partial_TextOperators_"},"job_id":{"ref":"Partial_TextOperators_"},"threat":{"ref":"Partial_BooleanOperators_"},"request_id":{"ref":"Partial_TextOperators_"},"prompt_tokens":{"ref":"Partial_NumberOperators_"},"completion_tokens":{"ref":"Partial_NumberOperators_"},"prompt_cache_read_tokens":{"ref":"Partial_NumberOperators_"},"prompt_cache_write_tokens":{"ref":"Partial_NumberOperators_"},"total_tokens":{"ref":"Partial_NumberOperators_"},"target_url":{"ref":"Partial_TextOperators_"},"property_key":{"dataType":"nestedObjectLiteral","nestedProperties":{"equals":{"dataType":"string","required":true}}},"properties":{"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"Partial_TextOperators_"}},"search_properties":{"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"Partial_TextOperators_"}},"scores":{"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"Partial_TextOperators_"}},"scores_column":{"ref":"Partial_TextOperators_"},"request_body":{"ref":"Partial_VectorOperators_"},"response_body":{"ref":"Partial_VectorOperators_"},"cache_enabled":{"ref":"Partial_BooleanOperators_"},"cache_reference_id":{"ref":"Partial_TextOperators_"},"cached":{"ref":"Partial_BooleanOperators_"},"assets":{"ref":"Partial_TextOperators_"},"helicone-score-feedback":{"ref":"Partial_BooleanOperators_"},"prompt_id":{"ref":"Partial_TextOperators_"},"prompt_version":{"ref":"Partial_TextOperators_"},"request_referrer":{"ref":"Partial_TextOperators_"},"is_passthrough_billing":{"ref":"Partial_BooleanOperators_"}},"validators":{}},
1112+
"type": {"dataType":"nestedObjectLiteral","nestedProperties":{"country_code":{"ref":"Partial_TextOperators_"},"latency":{"ref":"Partial_NumberOperators_"},"cost":{"ref":"Partial_NumberOperators_"},"provider":{"ref":"Partial_TextOperators_"},"time_to_first_token":{"ref":"Partial_NumberOperators_"},"status":{"ref":"Partial_NumberOperators_"},"request_created_at":{"ref":"Partial_TimestampOperatorsTyped_"},"response_created_at":{"ref":"Partial_TimestampOperatorsTyped_"},"model":{"ref":"Partial_TextOperators_"},"user_id":{"ref":"Partial_TextOperators_"},"organization_id":{"ref":"Partial_TextOperators_"},"node_id":{"ref":"Partial_TextOperators_"},"job_id":{"ref":"Partial_TextOperators_"},"threat":{"ref":"Partial_BooleanOperators_"},"request_id":{"ref":"Partial_TextOperators_"},"prompt_tokens":{"ref":"Partial_NumberOperators_"},"completion_tokens":{"ref":"Partial_NumberOperators_"},"prompt_cache_read_tokens":{"ref":"Partial_NumberOperators_"},"prompt_cache_write_tokens":{"ref":"Partial_NumberOperators_"},"total_tokens":{"ref":"Partial_NumberOperators_"},"target_url":{"ref":"Partial_TextOperators_"},"property_key":{"dataType":"nestedObjectLiteral","nestedProperties":{"equals":{"dataType":"string","required":true}}},"properties":{"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"Partial_TextOperators_"}},"search_properties":{"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"Partial_TextOperators_"}},"scores":{"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"Partial_TextOperators_"}},"scores_column":{"ref":"Partial_TextOperators_"},"request_body":{"ref":"Partial_TextOperators_"},"response_body":{"ref":"Partial_TextOperators_"},"cache_enabled":{"ref":"Partial_BooleanOperators_"},"cache_reference_id":{"ref":"Partial_TextOperators_"},"cached":{"ref":"Partial_BooleanOperators_"},"assets":{"ref":"Partial_TextOperators_"},"helicone-score-feedback":{"ref":"Partial_BooleanOperators_"},"prompt_id":{"ref":"Partial_TextOperators_"},"prompt_version":{"ref":"Partial_TextOperators_"},"request_referrer":{"ref":"Partial_TextOperators_"},"is_passthrough_billing":{"ref":"Partial_BooleanOperators_"}},"validators":{}},
11181113
},
11191114
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
11201115
"Partial_SessionsRequestResponseRMTToOperators_": {

valhalla/jawn/src/tsoa-build/private/swagger.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3872,15 +3872,6 @@
38723872
"type": "object",
38733873
"description": "Make all properties in T optional"
38743874
},
3875-
"Partial_VectorOperators_": {
3876-
"properties": {
3877-
"contains": {
3878-
"type": "string"
3879-
}
3880-
},
3881-
"type": "object",
3882-
"description": "Make all properties in T optional"
3883-
},
38843875
"Partial_RequestResponseRMTToOperators_": {
38853876
"properties": {
38863877
"country_code": {
@@ -3982,10 +3973,10 @@
39823973
"$ref": "#/components/schemas/Partial_TextOperators_"
39833974
},
39843975
"request_body": {
3985-
"$ref": "#/components/schemas/Partial_VectorOperators_"
3976+
"$ref": "#/components/schemas/Partial_TextOperators_"
39863977
},
39873978
"response_body": {
3988-
"$ref": "#/components/schemas/Partial_VectorOperators_"
3979+
"$ref": "#/components/schemas/Partial_TextOperators_"
39893980
},
39903981
"cache_enabled": {
39913982
"$ref": "#/components/schemas/Partial_BooleanOperators_"

valhalla/jawn/src/tsoa-build/public/routes.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,14 +1471,9 @@ const models: TsoaRoute.Models = {
14711471
"type": {"dataType":"nestedObjectLiteral","nestedProperties":{"equals":{"dataType":"datetime"},"gte":{"dataType":"datetime"},"lte":{"dataType":"datetime"},"lt":{"dataType":"datetime"},"gt":{"dataType":"datetime"}},"validators":{}},
14721472
},
14731473
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
1474-
"Partial_VectorOperators_": {
1475-
"dataType": "refAlias",
1476-
"type": {"dataType":"nestedObjectLiteral","nestedProperties":{"contains":{"dataType":"string"}},"validators":{}},
1477-
},
1478-
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
14791474
"Partial_RequestResponseRMTToOperators_": {
14801475
"dataType": "refAlias",
1481-
"type": {"dataType":"nestedObjectLiteral","nestedProperties":{"country_code":{"ref":"Partial_TextOperators_"},"latency":{"ref":"Partial_NumberOperators_"},"cost":{"ref":"Partial_NumberOperators_"},"provider":{"ref":"Partial_TextOperators_"},"time_to_first_token":{"ref":"Partial_NumberOperators_"},"status":{"ref":"Partial_NumberOperators_"},"request_created_at":{"ref":"Partial_TimestampOperatorsTyped_"},"response_created_at":{"ref":"Partial_TimestampOperatorsTyped_"},"model":{"ref":"Partial_TextOperators_"},"user_id":{"ref":"Partial_TextOperators_"},"organization_id":{"ref":"Partial_TextOperators_"},"node_id":{"ref":"Partial_TextOperators_"},"job_id":{"ref":"Partial_TextOperators_"},"threat":{"ref":"Partial_BooleanOperators_"},"request_id":{"ref":"Partial_TextOperators_"},"prompt_tokens":{"ref":"Partial_NumberOperators_"},"completion_tokens":{"ref":"Partial_NumberOperators_"},"prompt_cache_read_tokens":{"ref":"Partial_NumberOperators_"},"prompt_cache_write_tokens":{"ref":"Partial_NumberOperators_"},"total_tokens":{"ref":"Partial_NumberOperators_"},"target_url":{"ref":"Partial_TextOperators_"},"property_key":{"dataType":"nestedObjectLiteral","nestedProperties":{"equals":{"dataType":"string","required":true}}},"properties":{"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"Partial_TextOperators_"}},"search_properties":{"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"Partial_TextOperators_"}},"scores":{"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"Partial_TextOperators_"}},"scores_column":{"ref":"Partial_TextOperators_"},"request_body":{"ref":"Partial_VectorOperators_"},"response_body":{"ref":"Partial_VectorOperators_"},"cache_enabled":{"ref":"Partial_BooleanOperators_"},"cache_reference_id":{"ref":"Partial_TextOperators_"},"cached":{"ref":"Partial_BooleanOperators_"},"assets":{"ref":"Partial_TextOperators_"},"helicone-score-feedback":{"ref":"Partial_BooleanOperators_"},"prompt_id":{"ref":"Partial_TextOperators_"},"prompt_version":{"ref":"Partial_TextOperators_"},"request_referrer":{"ref":"Partial_TextOperators_"},"is_passthrough_billing":{"ref":"Partial_BooleanOperators_"}},"validators":{}},
1476+
"type": {"dataType":"nestedObjectLiteral","nestedProperties":{"country_code":{"ref":"Partial_TextOperators_"},"latency":{"ref":"Partial_NumberOperators_"},"cost":{"ref":"Partial_NumberOperators_"},"provider":{"ref":"Partial_TextOperators_"},"time_to_first_token":{"ref":"Partial_NumberOperators_"},"status":{"ref":"Partial_NumberOperators_"},"request_created_at":{"ref":"Partial_TimestampOperatorsTyped_"},"response_created_at":{"ref":"Partial_TimestampOperatorsTyped_"},"model":{"ref":"Partial_TextOperators_"},"user_id":{"ref":"Partial_TextOperators_"},"organization_id":{"ref":"Partial_TextOperators_"},"node_id":{"ref":"Partial_TextOperators_"},"job_id":{"ref":"Partial_TextOperators_"},"threat":{"ref":"Partial_BooleanOperators_"},"request_id":{"ref":"Partial_TextOperators_"},"prompt_tokens":{"ref":"Partial_NumberOperators_"},"completion_tokens":{"ref":"Partial_NumberOperators_"},"prompt_cache_read_tokens":{"ref":"Partial_NumberOperators_"},"prompt_cache_write_tokens":{"ref":"Partial_NumberOperators_"},"total_tokens":{"ref":"Partial_NumberOperators_"},"target_url":{"ref":"Partial_TextOperators_"},"property_key":{"dataType":"nestedObjectLiteral","nestedProperties":{"equals":{"dataType":"string","required":true}}},"properties":{"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"Partial_TextOperators_"}},"search_properties":{"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"Partial_TextOperators_"}},"scores":{"dataType":"nestedObjectLiteral","nestedProperties":{},"additionalProperties":{"ref":"Partial_TextOperators_"}},"scores_column":{"ref":"Partial_TextOperators_"},"request_body":{"ref":"Partial_TextOperators_"},"response_body":{"ref":"Partial_TextOperators_"},"cache_enabled":{"ref":"Partial_BooleanOperators_"},"cache_reference_id":{"ref":"Partial_TextOperators_"},"cached":{"ref":"Partial_BooleanOperators_"},"assets":{"ref":"Partial_TextOperators_"},"helicone-score-feedback":{"ref":"Partial_BooleanOperators_"},"prompt_id":{"ref":"Partial_TextOperators_"},"prompt_version":{"ref":"Partial_TextOperators_"},"request_referrer":{"ref":"Partial_TextOperators_"},"is_passthrough_billing":{"ref":"Partial_BooleanOperators_"}},"validators":{}},
14821477
},
14831478
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
14841479
"Partial_SessionsRequestResponseRMTToOperators_": {

valhalla/jawn/src/tsoa-build/public/swagger.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4036,15 +4036,6 @@
40364036
"type": "object",
40374037
"description": "Make all properties in T optional"
40384038
},
4039-
"Partial_VectorOperators_": {
4040-
"properties": {
4041-
"contains": {
4042-
"type": "string"
4043-
}
4044-
},
4045-
"type": "object",
4046-
"description": "Make all properties in T optional"
4047-
},
40484039
"Partial_RequestResponseRMTToOperators_": {
40494040
"properties": {
40504041
"country_code": {
@@ -4146,10 +4137,10 @@
41464137
"$ref": "#/components/schemas/Partial_TextOperators_"
41474138
},
41484139
"request_body": {
4149-
"$ref": "#/components/schemas/Partial_VectorOperators_"
4140+
"$ref": "#/components/schemas/Partial_TextOperators_"
41504141
},
41514142
"response_body": {
4152-
"$ref": "#/components/schemas/Partial_VectorOperators_"
4143+
"$ref": "#/components/schemas/Partial_TextOperators_"
41534144
},
41544145
"cache_enabled": {
41554146
"$ref": "#/components/schemas/Partial_BooleanOperators_"

web/components/templates/requests/tableFooter.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default function TableFooter(props: TableFooterProps) {
7979
variant="outline"
8080
size="icon"
8181
className="hidden h-7 w-7 sm:inline-flex"
82-
disabled={!isCountLoading && currentPage <= 1}
82+
disabled={isCountLoading || currentPage <= 1}
8383
onClick={() => setPage(1)}
8484
>
8585
<ChevronFirst className="h-3 w-3" />
@@ -88,7 +88,7 @@ export default function TableFooter(props: TableFooterProps) {
8888
variant="outline"
8989
size="icon"
9090
className="h-7 w-7"
91-
disabled={!isCountLoading && currentPage <= 1}
91+
disabled={isCountLoading || currentPage <= 1}
9292
onClick={() => setPage(currentPage - 1)}
9393
>
9494
<ChevronLeft className="h-3 w-3" />
@@ -130,7 +130,7 @@ export default function TableFooter(props: TableFooterProps) {
130130
variant="outline"
131131
size="icon"
132132
className="h-7 w-7"
133-
disabled={!isCountLoading && currentPage >= totalPages}
133+
disabled={isCountLoading || currentPage >= totalPages}
134134
onClick={() => setPage(currentPage + 1)}
135135
>
136136
<ChevronRight className="h-3 w-3" />
@@ -139,7 +139,7 @@ export default function TableFooter(props: TableFooterProps) {
139139
variant="outline"
140140
size="icon"
141141
className="hidden h-7 w-7 sm:inline-flex"
142-
disabled={!isCountLoading && currentPage >= totalPages}
142+
disabled={isCountLoading || currentPage >= totalPages}
143143
onClick={() => setPage(totalPages)}
144144
>
145145
<ChevronLast className="h-3 w-3" />

0 commit comments

Comments
 (0)