Feat/new projects screen#8132
Conversation
…data query + design update
🚀 Snapshot Release (
|
| Package | Version | Info |
|---|---|---|
@graphql-hive/apollo |
0.48.1-alpha-20260610080006-90e5ed6e68eb5a079aa24c71c78048b71a6ad1d0 |
npm ↗︎ unpkg ↗︎ |
@graphql-hive/cli |
0.60.1-alpha-20260610080006-90e5ed6e68eb5a079aa24c71c78048b71a6ad1d0 |
npm ↗︎ unpkg ↗︎ |
@graphql-hive/core |
0.21.1-alpha-20260610080006-90e5ed6e68eb5a079aa24c71c78048b71a6ad1d0 |
npm ↗︎ unpkg ↗︎ |
@graphql-hive/envelop |
0.40.6-alpha-20260610080006-90e5ed6e68eb5a079aa24c71c78048b71a6ad1d0 |
npm ↗︎ unpkg ↗︎ |
@graphql-hive/yoga |
0.48.1-alpha-20260610080006-90e5ed6e68eb5a079aa24c71c78048b71a6ad1d0 |
npm ↗︎ unpkg ↗︎ |
hive |
11.2.2-alpha-20260610080006-90e5ed6e68eb5a079aa24c71c78048b71a6ad1d0 |
npm ↗︎ unpkg ↗︎ |
There was a problem hiding this comment.
Code Review
This pull request introduces cursor-based pagination, searching, and sorting (by name, creation date, requests, and schema versions) for projects and targets on both the backend and frontend. It also refactors the organization and project dashboard views to use a new, detailed TargetCard component that displays latency, request volume, and success rate over time. Feedback on the changes focuses on preventing potential integer overflow bugs in ClickHouse queries by avoiding database-level casts to 32-bit integers for high-volume metrics, recommending instead the use of z.coerce.number() in Zod schemas. Additionally, a PostgreSQL query in TargetStats requires casting COUNT(*) to ::int to ensure the driver parses it as a JavaScript number, preventing a runtime validation error against the expected Zod schema.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| psql`/* TargetStats.countSchemaVersionsByTargetIds */ | ||
| SELECT | ||
| sv.target_id as "targetId", | ||
| COUNT(*) as total |
There was a problem hiding this comment.
In PostgreSQL, COUNT(*) returns a bigint which is parsed as a string by the pg driver. Since the Zod schema expects total to be a number (line 55), this will cause a runtime validation error. Casting COUNT(*) to ::int (as done in ProjectStats.countSchemaVersionsByProjectIds) ensures it is parsed as a JavaScript number. Additionally, when refactoring or optimizing SQL queries, write comprehensive integration tests to verify correctness under edge cases (such as shared commits across multiple targets) to ensure correctness and prevent regressions.
| COUNT(*) as total | |
| COUNT(*)::int as total |
References
- When refactoring or optimizing SQL queries, write comprehensive integration tests to verify correctness under edge cases (such as shared commits across multiple targets) to ensure correctness and prevent regressions.
| query: aggregationTableName => sql` | ||
| SELECT | ||
| target, | ||
| sum(total)::int as total |
There was a problem hiding this comment.
Casting sum(total) to ::int (which ClickHouse maps to Int32) can lead to integer overflow if the total number of requests for a target exceeds 2.14 billion (the maximum value for a signed 32-bit integer) within the queried period. High-traffic APIs can easily exceed this threshold. To prevent overflow while still ensuring the value is parsed as a number in JavaScript, we should avoid casting to Int32 in ClickHouse and instead use z.coerce.number() in the Zod schema. Additionally, write comprehensive integration tests to verify correctness under edge cases when refactoring SQL queries.
| sum(total)::int as total | |
| sum(total) as total |
References
- When refactoring or optimizing SQL queries, write comprehensive integration tests to verify correctness under edge cases (such as shared commits across multiple targets) to ensure correctness and prevent regressions.
| data: z.array( | ||
| z.object({ | ||
| target: z.string(), | ||
| total: z.number(), |
| ifNull(aggregated.total, 0)::int as total, | ||
| ifNull(aggregated.totalOk, 0)::int as totalOk, |
There was a problem hiding this comment.
Casting total and totalOk to ::int (which ClickHouse maps to Int32) can lead to integer overflow if the total number of requests for a target exceeds 2.14 billion within the queried period. High-traffic APIs can easily exceed this threshold. To prevent overflow while still ensuring the value is parsed as a number in JavaScript, we should avoid casting to Int32 in ClickHouse and instead use z.coerce.number() in the Zod schema. Ensure comprehensive integration tests are written to verify correctness under edge cases when refactoring these queries.
| ifNull(aggregated.total, 0)::int as total, | |
| ifNull(aggregated.totalOk, 0)::int as totalOk, | |
| ifNull(aggregated.total, 0) as total, | |
| ifNull(aggregated.totalOk, 0) as totalOk, |
References
- When refactoring or optimizing SQL queries, write comprehensive integration tests to verify correctness under edge cases (such as shared commits across multiple targets) to ensure correctness and prevent regressions.
| total: z.number(), | ||
| totalOk: z.number(), |
There was a problem hiding this comment.
|
🐋 This PR was built and pushed to the following Docker images: Targets: Platforms: Image Tags: |
d5af727 to
90e5ed6
Compare
Background
Description
Checklist