Skip to content

Feat/new projects screen#8132

Open
mskorokhodov wants to merge 39 commits into
mainfrom
feat/new-projects-screen
Open

Feat/new projects screen#8132
mskorokhodov wants to merge 39 commits into
mainfrom
feat/new-projects-screen

Conversation

@mskorokhodov

Copy link
Copy Markdown
Collaborator

Background

Description

Checklist

  • Input validation
  • Output encoding
  • Authentication management
  • Session management
  • Access control
  • Cryptographic practices
  • Error handling and logging
  • Data protection
  • Communication security
  • System configuration
  • Database security
  • File management
  • Memory management
  • Testing

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

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 ↗︎

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
COUNT(*) as total
COUNT(*)::int as total
References
  1. 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
sum(total)::int as total
sum(total) as total
References
  1. 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(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Use z.coerce.number() to safely coerce the ClickHouse Int64 string representation into a JavaScript number, avoiding potential integer overflow from casting to Int32 in the database query.

Suggested change
total: z.number(),
total: z.coerce.number(),

Comment on lines +2287 to +2288
ifNull(aggregated.total, 0)::int as total,
ifNull(aggregated.totalOk, 0)::int as totalOk,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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
  1. 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.

Comment on lines +2344 to +2345
total: z.number(),
totalOk: z.number(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Use z.coerce.number() to safely coerce the ClickHouse Int64 string representation into a JavaScript number, avoiding potential integer overflow from casting to Int32 in the database query.

Suggested change
total: z.number(),
totalOk: z.number(),
total: z.coerce.number(),
totalOk: z.coerce.number(),

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🐋 This PR was built and pushed to the following Docker images:

Targets: build

Platforms: linux/amd64

Image Tags: 3f1467ed760b8b01ce0541c6e33592297d5caac4, 3f1467e

@theguild-bot theguild-bot temporarily deployed to development June 9, 2026 21:35 Inactive
@mskorokhodov mskorokhodov force-pushed the feat/new-projects-screen branch from d5af727 to 90e5ed6 Compare June 10, 2026 07:59
@theguild-bot theguild-bot had a problem deploying to development June 10, 2026 08:08 Failure
@theguild-bot theguild-bot had a problem deploying to development June 10, 2026 08:10 Failure
@theguild-bot theguild-bot had a problem deploying to development June 10, 2026 08:18 Failure
@theguild-bot theguild-bot had a problem deploying to development June 10, 2026 08:26 Failure
@theguild-bot theguild-bot temporarily deployed to development June 22, 2026 08:33 Inactive
@mskorokhodov mskorokhodov marked this pull request as ready for review June 24, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants