Skip to content

Conversation

@adambenhassen
Copy link
Collaborator

Description

Adds activeAppDeployments GraphQL query to find app deployments based on usage criteria, enabling teams to identify and clean up stale deployments

Filter options:

  • lastUsedBefore - find deployments used but not recently
  • neverUsedAndCreatedBefore - find old unused deployments
  • name - filter by app name (partial match)

Closes CONSOLE-1504

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @adambenhassen, 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 significant enhancement to the API by providing a new GraphQL query, activeAppDeployments, designed to help teams efficiently identify and manage stale application deployments. This feature allows users to filter deployments based on their last usage date or creation date if they've never been used, facilitating cleanup and resource optimization. The addition of a createdAt field to the AppDeployment type further enriches the data available for these operations, ensuring better visibility into deployment lifecycle.

Highlights

  • New GraphQL Query: Introduced activeAppDeployments GraphQL query to retrieve app deployments based on usage and creation criteria.
  • Filter Options: Added filter options including lastUsedBefore (for recently unused deployments), neverUsedAndCreatedBefore (for old, never-used deployments), and name (for partial name matching). Date filters use OR logic, while the name filter uses AND logic.
  • AppDeployment Type Enhancement: The AppDeployment GraphQL type now includes a createdAt field to track the deployment's creation timestamp.
  • Comprehensive Testing: Extensive integration tests have been added to validate the functionality of the new activeAppDeployments query, covering various filter combinations and pagination.
  • Documentation Update: New documentation has been added to guide users on 'Finding Stale App Deployments', including usage tracking, GraphQL API querying examples, and automated cleanup workflows.
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

github-actions bot commented Dec 5, 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-20251205131858-16aea1d6a6e847a02f2178e50e89b4eb027bb17c npm ↗︎ unpkg ↗︎

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

📚 Storybook Deployment

The latest changes are available as preview in: https://pr-7377.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 new activeAppDeployments GraphQL query to find stale deployments, which is a valuable addition for maintenance and cleanup. The implementation is accompanied by thorough integration tests and clear documentation. My main feedback is a performance concern regarding how deployments are fetched and filtered, which could be problematic for targets with a large number of deployments. I've also noted an opportunity to reduce code duplication in the new tests.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

💻 Website Preview

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

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

Targets: build

Platforms: linux/amd64

Image Tag: 16aea1d6a6e847a02f2178e50e89b4eb027bb17c

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.

Great job adding descriptions, comments, and docs. These are all very helpful. I'm excited for App Deployments to get more flushed out

paginatedDeployments = filteredDeployments.filter(deployment => {
const deploymentCreatedAt = new Date(deployment.createdAt).getTime();
return (
deploymentCreatedAt < cursorCreatedAt ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it'd be simpler to build this into the sql query.

AND "retired_at" IS NULL
${args.filter.name ? sql`AND "name" ILIKE ${'%' + args.filter.name + '%'}` : sql``}
ORDER BY "created_at" DESC, "id"
LIMIT ${maxDeployments}
Copy link
Collaborator

Choose a reason for hiding this comment

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

To avoid setting this limit and to simplify this logic, I wonder if we should be flip the query order. So that you first collect, from Clickhouse, a set of the deployments that match the lastUsed filter, and then use those IDs to fetch the rest of the details from postgres. This should eliminate the overfetching and avoid any limit issues for incredibly large deployment sets

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.

2 participants