Skip to content

feat: show criticalityReason context for safe schema changes based on usage#8182

Open
jenishasubedi05 wants to merge 3 commits into
graphql-hive:mainfrom
jenishasubedi05:feature/6892-safe-change-context
Open

feat: show criticalityReason context for safe schema changes based on usage#8182
jenishasubedi05 wants to merge 3 commits into
graphql-hive:mainfrom
jenishasubedi05:feature/6892-safe-change-context

Conversation

@jenishasubedi05

Copy link
Copy Markdown

Background

Closes #6892

When a schema change is marked as "safe" due to conditional breaking change settings (usage threshold or client exclusion), the schema check view gives no explanation of why. Developers have to manually cross-reference the target's Conditional Breaking Changes configuration to understand why a change passed.

Description

This PR surfaces the existing criticalityReason field through to the frontend UI.

Changes:

  • packages/services/api/src/modules/schema/providers/inspector.ts — Added reason: change.criticality.reason to pass the criticality reason through the model
  • packages/web/app/src/components/target/history/errors-and-changes.tsx — Added criticalityReason to both GraphQL fragments and displays it inline next to "Safe based on usage data" in the schema check results view

Checklist

  • Tests added/updated
  • pnpm graphql:generate run after GraphQL changes
  • No breaking changes

@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 support for Windows path separators in build scripts, adds the criticalityReason field to the schema changes UI, configures a named volume for ClickHouse in Docker Compose, and updates dependency configurations. However, several issues need to be addressed: temporary bundled .mjs files containing local absolute paths should be removed, the prebuild script skip in package.json should be reverted, JSX whitespace and indentation in errors-and-changes.tsx should be cleaned up, and the Byte Order Mark (BOM) in schema-v1.graphql must be removed to avoid parsing errors.

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.

import { readFileSync } from "fs";
import { join, resolve } from "path";
import { getPackagesSync } from "@manypkg/get-packages";
var __injected_dirname__ = "C:\\Users\\College\\Desktop\\console\\configs\\tsup";

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

These bundled .mjs files (e.g., dev.config.node.bundled_*.mjs) appear to be temporary build artifacts generated during development. They contain hardcoded local absolute paths (e.g., C:\\Users\\College\\Desktop\\console...) and should not be committed to the repository. Please remove these files and ensure they are covered by .gitignore.

Comment thread package.json Outdated
"local:setup": "docker compose -f ./docker/docker-compose.dev.yml up -d --build --remove-orphans && pnpm --filter @hive/migrations db:init",
"postinstall": "node ./scripts/patch-manifests.js && pnpm env:sync && node ./scripts/turborepo-cleanup.js && pnpm cargo:fix",
"prebuild": "rimraf deploy-tmp && rimraf packages/**/deploy-tmp",
"prebuild": "echo skip",

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

Changing the "prebuild" script to "echo skip" disables the cleanup of deploy-tmp directories. This can lead to stale build artifacts or bloated deployments. Please revert this change or explain why it is necessary.

Suggested change
"prebuild": "echo skip",
"prebuild": "rimraf deploy-tmp && rimraf packages/**/deploy-tmp",

Comment on lines +249 to +258
{change.isSafeBasedOnUsage && change.criticalityReason && (
<span className="text-xs text-muted-foreground ml-1">
({change.criticalityReason})
</span>
)}





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

Clean up the indentation of the closing </span> tag and remove the unnecessary empty lines/whitespace added within the JSX block to keep the code clean and maintainable.

Suggested change
{change.isSafeBasedOnUsage && change.criticalityReason && (
<span className="text-xs text-muted-foreground ml-1">
({change.criticalityReason})
</span>
)}
{change.isSafeBasedOnUsage && change.criticalityReason && (
<span className="text-xs text-muted-foreground ml-1">
({change.criticalityReason})
</span>
)}

Comment thread schema-v1.graphql Outdated
Comment on lines +1 to +4
type Query {
hello: String
legacyField: String
}

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

The file starts with a Byte Order Mark (BOM) character (\ufeff). UTF-8 BOMs are discouraged as they can cause parsing issues with some GraphQL tools and CLI parsers. Please save the file as standard UTF-8 without BOM.

Suggested change
type Query {
hello: String
legacyField: String
}
type Query {
hello: String
legacyField: String
}

@jenishasubedi05

Copy link
Copy Markdown
Author

Hi! I've addressed all the review feedback from the bot:

  • Removed the temporary bundled .mjs build artifacts
  • Reverted the prebuild script change in package.json
  • Fixed indentation in errors-and-changes.tsx
  • Removed schema-v1.graphql test file

Ready for another look when you have time!

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.

consider giving more context for safe schema change based on usage

1 participant