Skip to content

Conversation

@mskorokhodov
Copy link
Collaborator

@mskorokhodov mskorokhodov commented Dec 4, 2025

Background

Replacement for GraphiQL

Description

New hive laboratory as replacement for new GraphiQL

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

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @mskorokhodov, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a brand new 'Hive Laboratory' feature, designed to be a powerful and interactive environment for GraphQL API exploration and testing. It provides a rich set of tools for building, executing, and managing GraphQL operations, along with features for history tracking, environment configuration, and preflight scripting. The new laboratory aims to significantly enhance the developer experience by centralizing various GraphQL interaction capabilities within the application.

Highlights

  • New Hive Laboratory Feature: Introduces a comprehensive GraphQL 'Laboratory' within the application, providing a dedicated environment for interacting with GraphQL APIs.
  • Interactive GraphQL Editor: Integrates a Monaco-based editor with support for GraphQL queries, variables, headers, and extensions, offering syntax highlighting and schema-aware features. It also includes a visual query builder for interactive schema exploration.
  • Operation Management and History: Enables users to organize GraphQL operations into collections, track a detailed history of executed queries and subscription responses, and manage environment variables and preflight scripts.
  • Enhanced User Interface: Adds a suite of new UI components (e.g., AlertDialog, Badge, ButtonGroup, Command Palette, ContextMenu, Dialog, DropdownMenu, Empty states, Field components, Input, Label, Resizable panels, ScrollArea, Select, Separator, Sonner, Sortable lists, Spinner, Tabs, Toggle, Tooltip) to deliver a rich and intuitive user experience for the new laboratory.
  • Backend Integration: Connects the new laboratory functionality with backend services for persisting collections, operations, and preflight scripts, ensuring data consistency and collaboration.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 a new 'Laboratory' feature, which is a powerful GraphQL IDE integrated into the application. The changes are extensive, adding many new components, hooks, and dependencies. The overall structure is well-organized.

A significant issue is the consistent misspelling of 'laboratory' as 'labaratory' throughout the codebase. This affects file names, directory names, component names, CSS classes, and more. This should be corrected globally for code quality and maintainability.

I have also provided specific feedback on a potential bug in parsing environment variables, a UI issue in the editor's theme, and an inconsistency in string replacement methods.

--chart-2: 340 75% 55%;
}

.hive-labaratory {
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The word laboratory is misspelled as labaratory. This should be corrected for consistency.

  .hive-laboratory {

() =>
Object.values(
(
schema?.getType(props.field.type.toString().replace(/\[|\]|!/g, '')) as GraphQLObjectType
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This line uses replace() with a global regex, while line 427 uses replaceAll() for the same purpose. For consistency and readability, it's better to use replaceAll() in both places.

Suggested change
schema?.getType(props.field.type.toString().replace(/\[|\]|!/g, '')) as GraphQLObjectType
schema?.getType(props.field.type.toString().replaceAll(/[\[\]!]/g, '')) as GraphQLObjectType

base: 'vs-dark',
inherit: true,
rules: [
{ token: '', foreground: 'F8F9FA', background: 'fffffe' },
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

In the darkTheme definition, the default token ('') has a background color of 'fffffe', which is nearly white. This will likely clash with the dark editor background (#18181b). To fix this, you can remove the background property to let it inherit the editor's background color.

Suggested change
{ token: '', foreground: 'F8F9FA', background: 'fffffe' },
{ token: '', foreground: 'F8F9FA' },

@mskorokhodov mskorokhodov requested a review from n1ru4l December 8, 2025 15:23
@mskorokhodov mskorokhodov requested a review from jdolle December 8, 2025 16:45
@mskorokhodov mskorokhodov changed the title [WIP]: feat: new hive lab feat: new hive lab Dec 8, 2025
Copy link
Collaborator

@jdolle jdolle left a comment

Choose a reason for hiding this comment

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

Only minor comments.

Although some files are quite large, the components are well designed and make great use of memo, callbacks, etc to keep the code clean and efficient.

You haven't selected any endpoint yet. Get started by selecting an endpoint.
</EmptyDescription>
</EmptyHeader>
{/* <EmptyContent>
Copy link
Collaborator

Choose a reason for hiding this comment

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

minor: should this be removed?

</CommandGroup>
<CommandSeparator />
<CommandGroup heading="Schema">
{/* <CommandItem
Copy link
Collaborator

Choose a reason for hiding this comment

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

^

variables: Object.fromEntries(
value
?.split('\n')
.filter(line => line.trim() && !line.trim().startsWith('#'))
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like this is to support adding comments within env vars?

This is a new feature for us. Maybe we can update documentation examples to include comments to 1) show this feature, 2) add more inline context to our examples

// </LaboratoryProvider>
// </div>
// );
// };
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this file be deleted?

return (
<Editor
value={JSON.stringify(
JSON.parse((historyItem as LaboratoryHistoryRequest)?.response ?? '{}'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's an edge case, but what if the response body is invalid JSON?
Should we show that it's invalid json or show the text content?

<Query operation={operation} isReadOnly={isReadOnly} />
</ResizablePanel>
<ResizableHandle />
<ResizablePanel minSize={10} defaultSize={30} className="!overflow-visible">
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume your styling is right, but I expected overflow-auto to allow scrolling

import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

minor: we have a package for this already. But if we want to keep this independent with the plan to publish as a separate package then I'm fine with this.


const getLocalStorageState = (key: string, defaultValue: any) => {
const value = localStorage.getItem(`${localStoragePrefix}${key}`);
return value ? JSON.parse(value) : defaultValue;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Something maybe to consider for the future is if the localstorage can be corrupted or if we want to migrate storage to another format, maybe we gracefully handle syntax errors


const createOperation = useMemo(
() =>
throttle((collection: LaboratoryCollection, operation: LaboratoryCollectionOperation) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's difficult to follow the logic for these callbacks so maybe this is already handled, but in addition to throttling, I think this should only allow one request at a time so that if for some reason the request is taking longer, that duplicate operations aren't accidentally created by impatient users.


setIntrospection(response.data as IntrospectionQuery);
} catch {
toast.error('Failed to fetch schema');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are there cases where this error will show up repetitively because the schema keeps trying to get fetched? If so, let's make sure not to spam the UI with alerts because that can be annoying

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

🚀 Snapshot Release (alpha)

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

Package Version Info
hive 8.13.0-alpha-20251209234638-86cdca53819a11e958aa5711c4598a39cfc1178c npm ↗︎ unpkg ↗︎

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

📚 Storybook Deployment

The latest changes are available as preview in: https://pr-7374.hive-storybook.pages.dev

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

💻 Website Preview

The latest changes are available as preview in: https://pr-7374.hive-landing-page.pages.dev

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

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

Targets: build

Platforms: linux/amd64

Image Tag: 86cdca53819a11e958aa5711c4598a39cfc1178c

@n1ru4l
Copy link
Contributor

n1ru4l commented Dec 9, 2025

@mskorokhodov Can you please take care of type-checking and linting failing?

Copy link
Contributor

@n1ru4l n1ru4l left a comment

Choose a reason for hiding this comment

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

Legit to merge after addressing failing checks

@mskorokhodov mskorokhodov merged commit b4df418 into main Dec 10, 2025
26 checks passed
@mskorokhodov mskorokhodov deleted the feature/new-lab branch December 10, 2025 00:09
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.

4 participants