Skip to content

Conversation

@mskorokhodov
Copy link
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

@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 robust plugin system to the Laboratory feature, significantly enhancing its extensibility. The primary demonstration of this new capability is the 'Target Environment' plugin, which allows users to define and manage environment variables directly within the Laboratory. This change also refines the preflight script execution by enabling header manipulation and improves logging visibility, making the Laboratory more versatile and user-friendly for complex testing scenarios.

Highlights

  • Plugin System Introduction: A new plugin system has been integrated into the Laboratory feature, allowing for dynamic extension of its capabilities.
  • Target Environment Plugin: A 'Target Environment' plugin is now implemented, enabling the management of environment variables specific to a target within the Laboratory.
  • Custom Commands and Tabs: The plugin system supports custom commands, which are integrated into the command dialog, and custom tabs, which can be rendered in the main Laboratory content area.
  • Enhanced Preflight Scripts: Preflight scripts can now manipulate request headers, and the preflight log display has been improved to include 'info' and 'system' log levels with distinct styling.
  • Laboratory Context Extension: The core Laboratory context and API have been extended to properly support and manage the new plugin architecture.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

@github-actions
Copy link
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.46.0-alpha-20251223213227-2823a4efeb0cb3ff095ab6be9bf6538a67e950a0 npm ↗︎ unpkg ↗︎
@graphql-hive/cli 0.57.0-alpha-20251223213227-2823a4efeb0cb3ff095ab6be9bf6538a67e950a0 npm ↗︎ unpkg ↗︎
@graphql-hive/core 0.19.0-alpha-20251223213227-2823a4efeb0cb3ff095ab6be9bf6538a67e950a0 npm ↗︎ unpkg ↗︎
@graphql-hive/envelop 0.40.1-alpha-20251223213227-2823a4efeb0cb3ff095ab6be9bf6538a67e950a0 npm ↗︎ unpkg ↗︎
@graphql-hive/yoga 0.46.1-alpha-20251223213227-2823a4efeb0cb3ff095ab6be9bf6538a67e950a0 npm ↗︎ unpkg ↗︎
hive 8.14.0-alpha-20251223213227-2823a4efeb0cb3ff095ab6be9bf6538a67e950a0 npm ↗︎ unpkg ↗︎
hive-apollo-router-plugin 2.3.6-alpha-20251223213227-2823a4efeb0cb3ff095ab6be9bf6538a67e950a0 npm ↗︎ unpkg ↗︎
hive-console-sdk-rs 0.2.3-alpha-20251223213227-2823a4efeb0cb3ff095ab6be9bf6538a67e950a0 npm ↗︎ unpkg ↗︎

@github-actions
Copy link
Contributor

📚 Storybook Deployment

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

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 plugin system for the Laboratory, enabling extensibility with custom commands and tabs, and includes an example 'Target Environment' plugin. My review focuses on the completeness and robustness of this new system. I've identified a critical issue with the plugin state management which appears incomplete, preventing stateful plugins from functioning as designed. Additionally, there's a high-severity issue regarding the LaboratoryTab type definition that compromises type safety. I've also noted some medium-severity concerns related to code duplication and redundant hook calls that should be addressed to enhance maintainability and performance.

| 'onSettingsChange'
| 'defaultTests'
| 'onTestsChange'
| 'plugins'
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The current implementation of the plugin system appears to be incomplete, particularly regarding state management. The LaboratoryPlugin interface defines defaultState and onStateChange, and the preflight.lab.object function signature includes state and setState. However, the core logic to manage this state within the Laboratory component or its hooks seems to be missing. Consequently, plugin commands and tabs are called with a hardcoded empty object {} for their state, and the preflight integration for plugins is not functional. This prevents plugins from being stateful, which seems to be a key part of the design as shown in the target-env plugin example.

Comment on lines 63 to +70
export type LaboratoryTab =
| LaboratoryTabOperation
| LaboratoryTabPreflight
| LaboratoryTabEnv
| LaboratoryTabHistory
| LaboratoryTabSettings
| LaboratoryTabTest;
| LaboratoryTabTest
| LaboratoryTabCustom;
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 LaboratoryTab union type is not a safe discriminated union. The LaboratoryTabCustom interface has type: string, which is too broad and prevents TypeScript from correctly narrowing the type of tab in switch statements or if conditions. This forces the use of unsafe type assertions, as seen in packages/web/app/src/laboratory/components/laboratory/tabs.tsx. This compromises type safety and can lead to runtime errors if a plugin uses a type that conflicts with a built-in tab type.

To fix this, you could consider restricting custom tab types to not overlap with built-in ones, and potentially refine the LaboratoryTab and LaboratoryTabCustom types to make the union safer.

env,
plugins,
} = useLaboratory();
const laboratory = useLaboratory();
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The useLaboratory hook is called here for a second time. It's more efficient to call it only once at the top of the component, store its result in a variable (e.g., const laboratory = useLaboratory()), and then destructure the needed properties from that variable. This avoids redundant hook execution. This same pattern is repeated in LaboratoryContent (laboratory.tsx) and Tab (tabs.tsx) components.

Comment on lines +169 to +178
let customTab: LaboratoryPluginTab<Record<string, unknown>> | null = null;

for (const plugin of plugins) {
for (const tab of plugin.tabs ?? []) {
if (tab.type === props.item.type) {
customTab = tab;
break;
}
}
}
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 logic to find a custom tab definition by its type is duplicated in tabName and tabIcon memos within this file, and also in the LaboratoryContent component in laboratory.tsx. To improve maintainability and reduce code duplication, this logic should be extracted into a reusable helper function or a custom hook, for example usePluginTab(tabType: string).

@github-actions
Copy link
Contributor

github-actions bot commented Dec 23, 2025

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

Targets: build

Platforms: linux/amd64

Image Tag: 2823a4efeb0cb3ff095ab6be9bf6538a67e950a0

@github-actions
Copy link
Contributor

💻 Website Preview

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

@mskorokhodov mskorokhodov force-pushed the feature/target-env-plugin branch from c0189bd to 93ad419 Compare January 9, 2026 14:17
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.

1 participant