Skip to content

Conversation

@Raubzeug
Copy link
Contributor

@Raubzeug Raubzeug commented Dec 18, 2025

closes #3247

Greptile Summary

Fixed bug where META_BACKEND value of undefined was coerced to the string "undefined" in URL construction, causing malformed meta request URLs like /cluster/undefined/proxy/....

  • Extracted META_BACKEND ?? '' into a metaBackendPrefix variable to ensure it's always a string before template literal interpolation
  • Reused the variable consistently in both proxy and non-proxy path construction
  • Prevents JavaScript's default undefined-to-string coercion behavior in template literals

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The fix is minimal, targeted, and directly addresses the reported issue. It prevents undefined from being coerced to the string "undefined" in URL construction by extracting the nullish coalescing check into a variable. The change is backwards compatible, doesn't alter any logic paths, and follows the same pattern already used for ENVIRONMENT handling.
  • No files require special attention

Important Files Changed

Filename Overview
src/services/api/baseMeta.ts Fixed undefined appearing in URLs by extracting META_BACKEND nullish coalescing into a variable

Sequence Diagram

sequenceDiagram
    participant Client
    participant BaseMetaAPI
    participant Store
    participant Window
    
    Note over Window: REACT_APP_META_BACKEND="undefined"
    Window->>Store: window.meta_backend = "undefined"
    Store->>Store: parseJson("undefined") returns undefined
    Store->>Store: META_BACKEND = undefined
    
    Client->>BaseMetaAPI: getPath(path, clusterName)
    BaseMetaAPI->>Store: Import META_BACKEND
    
    alt Before Fix
        BaseMetaAPI->>BaseMetaAPI: Template literal: ${META_BACKEND}/proxy/...
        Note over BaseMetaAPI: undefined coerced to string "undefined"
        BaseMetaAPI-->>Client: "/env/undefined/proxy/cluster/name/path"
    else After Fix
        BaseMetaAPI->>BaseMetaAPI: metaBackendPrefix = META_BACKEND ?? ''
        BaseMetaAPI->>BaseMetaAPI: Template literal: ${metaBackendPrefix}/proxy/...
        Note over BaseMetaAPI: Empty string used instead
        BaseMetaAPI-->>Client: "/env/proxy/cluster/name/path"
    end
Loading

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
384 380 0 2 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.59 MB | Main: 62.59 MB
Diff: +0.09 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 18, 2025 16:02
@Raubzeug Raubzeug enabled auto-merge December 18, 2025 16:02
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 refactors the getPath method in BaseMetaAPI to avoid repeating the nullish coalescing check for META_BACKEND. The change extracts META_BACKEND ?? '' into a single variable metaBackendPrefix that is reused in both conditional branches.

  • Introduces metaBackendPrefix variable to store the result of META_BACKEND ?? ''
  • Replaces duplicate inline checks with the new variable

@Raubzeug Raubzeug added this pull request to the merge queue Dec 18, 2025
Merged via the queue into main with commit 8267e16 Dec 18, 2025
13 checks passed
@Raubzeug Raubzeug deleted the ydb-meta-undefined branch December 18, 2025 16:12
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.

EM: undefined in meta requests

3 participants