Skip to content

Conversation

@Raubzeug
Copy link
Contributor

@Raubzeug Raubzeug commented Dec 4, 2025

Greptile Overview

Greptile Summary

This PR adds support for an optional cluster_external_name setting that allows clusters to specify an alternative name for URL generation during cross-domain navigation.

  • Added cluster_external_name to the MetaClusterSettings type and Zod validation schema
  • Added clusterExternalName to PreparedCluster interface and extraction logic
  • Modified calculateClusterPath to use the external name when both clusterDomain and clusterExternalName are present

The implementation is clean and follows existing patterns. The external name is only used when cross-domain navigation is active (i.e., when clusterDomain is set), ensuring backward compatibility for standard single-domain deployments.

Confidence Score: 5/5

  • This PR is safe to merge - it adds a simple optional field with no breaking changes.
  • The changes are minimal and well-contained: adding an optional field to types, Zod schema, and a conditional check. The logic correctly gates the external name usage on the presence of clusterDomain, ensuring backward compatibility. All type definitions are consistent across files.
  • No files require special attention.

Important Files Changed

File Analysis

Filename Score Overview
src/types/api/meta.ts 5/5 Added cluster_external_name optional property to MetaClusterSettings interface. Simple, type-safe addition.
src/store/reducers/cluster/parseFields.ts 5/5 Added cluster_external_name to Zod validation schema as optional string. Consistent with existing pattern for settings validation.
src/store/reducers/clusters/types.ts 5/5 Added clusterExternalName optional property to PreparedCluster interface. Follows existing naming convention (camelCase for prepared data).
src/store/reducers/clusters/utils.ts 5/5 Extracts cluster_external_name from parsed settings and maps to clusterExternalName in prepared cluster object.
src/containers/Clusters/utils.ts 5/5 Uses external name for URL generation when both clusterDomain and clusterExternalName are present. Logic correctly gates external name usage on domain presence.

Sequence Diagram

sequenceDiagram
    participant API as Meta API
    participant Parser as parseSettingsField
    participant Prepare as prepareClustersData
    participant Utils as calculateClusterPath
    participant Router as createHref

    API->>Parser: settings (with cluster_external_name)
    Parser->>Parser: Validate with Zod schema
    Parser->>Prepare: parsedSettings
    Prepare->>Prepare: Extract clusterExternalName
    Prepare->>Utils: PreparedCluster (with clusterExternalName)
    Utils->>Utils: Check clusterDomain && clusterExternalName
    alt Both domain and external name present
        Utils->>Router: clusterName = clusterExternalName
    else Otherwise
        Utils->>Router: clusterName = name
    end
    Router->>Router: Generate URL with clusterName query param
Loading

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
378 375 0 1 2
Test Changes Summary ⏭️2

⏭️ Skipped Tests (2)

  1. Scroll to row, get shareable link, navigate to URL and verify row is scrolled into view (tenant/diagnostics/tabs/queries.test.ts)
  2. Copy result button copies to clipboard (tenant/queryEditor/queryEditor.test.ts)

Bundle Size: ✅

Current: 62.34 MB | Main: 62.34 MB
Diff: +0.50 KB (0.00%)

✅ Bundle size unchanged.

ℹ️ CI Information
  • Test recordings for failed tests are available in the full report.
  • Bundle size is measured for the entire 'dist' directory.
  • 📊 indicates links to detailed reports.
  • 🔺 indicates increase, 🔽 decrease, and ✅ no change in bundle size.

Copilot AI review requested due to automatic review settings December 4, 2025 07:19
@Raubzeug Raubzeug enabled auto-merge December 4, 2025 07:20
Copilot finished reviewing on behalf of Raubzeug December 4, 2025 07:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for cluster external names, allowing clusters to be referenced by an alternative name different from their internal cluster name. This feature is useful when clusters need to be accessed via a different identifier in external contexts.

Key changes:

  • Added cluster_external_name field to cluster settings API type and parsing logic
  • Extended cluster data structures to store and propagate the external name
  • Modified cluster path calculation to use external name when both clusterDomain and clusterExternalName are present

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/types/api/meta.ts Added optional cluster_external_name field to MetaClusterSettings interface
src/store/reducers/clusters/types.ts Added optional clusterExternalName field to PreparedCluster interface
src/store/reducers/clusters/utils.ts Extracts and stores clusterExternalName from parsed settings during cluster data preparation
src/store/reducers/cluster/parseFields.ts Added cluster_external_name to the Zod schema for settings validation
src/containers/Clusters/utils.ts Modified cluster path calculation to conditionally use external name instead of cluster name

{backend, clusterName},
{
backend,
clusterName: clusterDomain && clusterExternalName ? clusterExternalName : clusterName,
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The conditional logic clusterDomain && clusterExternalName ? clusterExternalName : clusterName may not reflect the intended behavior. This condition only uses clusterExternalName when both clusterDomain and clusterExternalName are truthy.

If the intent is to use clusterExternalName whenever it's available (regardless of clusterDomain), the condition should be simplified to:

clusterName: clusterExternalName || clusterName,

If clusterExternalName should only be used when clusterDomain is also set, consider adding a comment explaining this relationship, as it's not immediately obvious why both conditions are required.

Suggested change
clusterName: clusterDomain && clusterExternalName ? clusterExternalName : clusterName,
clusterName: clusterExternalName || clusterName,

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@Raubzeug Raubzeug added this pull request to the merge queue Dec 4, 2025
Merged via the queue into main with commit d196984 Dec 4, 2025
13 checks passed
@Raubzeug Raubzeug deleted the support-external-name branch December 4, 2025 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants