Skip to content

feat: add deprecation reason to deprecated fields table in op view#2386

Merged
JivusAyrus merged 4 commits intomainfrom
suvij/add-reason-to-deprecated-fields-in-op-view
Dec 3, 2025
Merged

feat: add deprecation reason to deprecated fields table in op view#2386
JivusAyrus merged 4 commits intomainfrom
suvij/add-reason-to-deprecated-fields-in-op-view

Conversation

@JivusAyrus
Copy link
Copy Markdown
Member

@JivusAyrus JivusAyrus commented Dec 3, 2025

@coderabbitai summary

Checklist

image image

COMPLETES ENG-8616

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 3, 2025

Walkthrough

This pull request extends the GetOperationDeprecatedFields feature by adding a new deprecationReason field across the stack. Changes include proto definition updates, generated TypeScript code, backend service mappings in the response builder, type definitions, and UI table enhancements to display deprecation reasons alongside field paths.

Changes

Cohort / File(s) Summary
Proto & Generated Code
proto/wg/cosmo/platform/v1/platform.proto, connect/src/wg/cosmo/platform/v1/platform_pb.ts
Added deprecationReason string field (field number 4) to the DeprecatedField message definition and corresponding generated TypeScript class with property initialization and static field metadata.
Backend Services
controlplane/src/core/bufservices/analytics/getOperationDeprecatedFields.ts, controlplane/src/core/services/SchemaGraphPruner.ts
Enhanced response mapping to include deprecationReason field by matching against local deprecated field metadata; extended Field interface to support optional deprecationReason property.
Type Definitions
controlplane/src/types/index.ts
Added optional deprecationReason?: string property to the Field interface.
UI Components
studio/src/components/operations/deprecated-fields-table.tsx
Added "Deprecation Reason" column to deprecated fields table; adjusted layout widths (Field Path 80% → 30%, Deprecation Reason 50%, Actions 20%); updated table rows and footer to span 3 columns with fallback to "-" when reason unavailable.
Modal Navigation
studio/src/components/operations/operation-content-modal.tsx
Added "Run in Playground" button and "Copy operation" controls to modal header with dynamic URL construction from router/workspace context.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Backend service logic: verify correct matching logic for deprecationReason lookup and fallback behavior in getOperationDeprecatedFields.ts
  • Table layout restructuring: confirm responsive column width changes (30%/50%/20%) render correctly and maintain usability
  • Modal UI controls: validate that new action buttons are positioned correctly and Playground URL construction uses correct route parameters

Possibly related PRs

  • feat: operations overview #2331: Introduces the initial GetOperationDeprecatedFields feature that this PR extends by adding the deprecationReason field across proto, services, types, and UI layers.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: adding a deprecation reason field to the deprecated fields table in the operation view.
✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@034d6a1). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2386   +/-   ##
=======================================
  Coverage        ?   34.66%           
=======================================
  Files           ?      340           
  Lines           ?    33837           
  Branches        ?      251           
=======================================
  Hits            ?    11728           
  Misses          ?    21081           
  Partials        ?     1028           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 3, 2025

Router image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-8d7ed252337837906cfa166a8d7d6af9c29e5f9e

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
controlplane/src/core/services/SchemaGraphPruner.ts (1)

67-67: Consider consistency with response mapping.

The use of || undefined here contrasts with || '' used in the API response mapping (line 122 of getOperationDeprecatedFields.ts). While both approaches work, using || undefined is cleaner for optional fields and aligns better with the TypeScript type definition.

Consider applying the same pattern in the response mapping for consistency:

-        deprecationReason:
-          deprecatedFields.find(
-            (f) => f.name === field.deprecatedFieldName && f.typeName === field.deprecatedFieldTypeNames[0],
-          )?.deprecationReason || '',
+        deprecationReason:
+          deprecatedFields.find(
+            (f) => f.name === field.deprecatedFieldName && f.typeName === field.deprecatedFieldTypeNames[0],
+          )?.deprecationReason || undefined,
studio/src/components/operations/deprecated-fields-table.tsx (1)

124-128: Minor redundancy in fallback logic.

The fallback || "-" on line 126 is technically redundant since the data mapping at line 68 already ensures deprecationReason is never empty. However, this defensive coding approach is acceptable and doesn't cause any issues.

Optionally simplify to rely on the mapping:

-                      <span className="text-sm text-muted-foreground">
-                        {field.deprecationReason || "-"}
-                      </span>
+                      <span className="text-sm text-muted-foreground">
+                        {field.deprecationReason}
+                      </span>
controlplane/src/core/bufservices/analytics/getOperationDeprecatedFields.ts (1)

112-123: Consider consolidating duplicate field lookups.

The response mapping performs two separate .find() operations with identical predicates (lines 116-118 and 120-122). While functionally correct, this could be optimized for better performance, especially if the deprecatedFields array is large.

Apply this diff to consolidate the lookups:

       deprecatedFields: deprecatedFieldsUsedInOperation.map((field) => {
+        const matchingField = deprecatedFields.find(
+          (f) => f.name === field.deprecatedFieldName && f.typeName === field.deprecatedFieldTypeNames[0],
+        );
+        return {
           fieldName: field.deprecatedFieldName,
           typeName: field.deprecatedFieldTypeNames[0] || '',
-          path:
-            deprecatedFields.find(
-              (f) => f.name === field.deprecatedFieldName && f.typeName === field.deprecatedFieldTypeNames[0],
-            )?.path || '',
-          deprecationReason:
-            deprecatedFields.find(
-              (f) => f.name === field.deprecatedFieldName && f.typeName === field.deprecatedFieldTypeNames[0],
-            )?.deprecationReason || '',
+          path: matchingField?.path || '',
+          deprecationReason: matchingField?.deprecationReason || '',
+        };
       }),
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9be1a0e and 361feb6.

⛔ Files ignored due to path filters (1)
  • connect-go/gen/proto/wg/cosmo/platform/v1/platform.pb.go is excluded by !**/*.pb.go, !**/gen/**
📒 Files selected for processing (7)
  • connect/src/wg/cosmo/platform/v1/platform_pb.ts (2 hunks)
  • controlplane/src/core/bufservices/analytics/getOperationDeprecatedFields.ts (1 hunks)
  • controlplane/src/core/services/SchemaGraphPruner.ts (1 hunks)
  • controlplane/src/types/index.ts (1 hunks)
  • proto/wg/cosmo/platform/v1/platform.proto (1 hunks)
  • studio/src/components/operations/deprecated-fields-table.tsx (6 hunks)
  • studio/src/components/operations/operation-content-modal.tsx (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-19T11:44:31.726Z
Learnt from: JivusAyrus
Repo: wundergraph/cosmo PR: 2331
File: studio/src/components/operations/client-usage-table.tsx:66-72
Timestamp: 2025-11-19T11:44:31.726Z
Learning: In the Cosmo studio codebase (studio/src/components/operations/client-usage-table.tsx), the `lastUsed` field from the `getOperationClients` API response is always present, so no fallback value is needed when mapping client data.

Applied to files:

  • studio/src/components/operations/deprecated-fields-table.tsx
🧬 Code graph analysis (1)
studio/src/components/operations/operation-content-modal.tsx (1)
studio/src/hooks/use-workspace.ts (1)
  • useWorkspace (4-11)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: build-router
  • GitHub Check: build_push_image
  • GitHub Check: build_test
  • GitHub Check: image_scan (nonroot)
  • GitHub Check: build_push_image
  • GitHub Check: integration_test (./telemetry)
  • GitHub Check: build_push_image
  • GitHub Check: build_push_image (nonroot)
  • GitHub Check: integration_test (./events)
  • GitHub Check: image_scan
  • GitHub Check: integration_test (./. ./fuzzquery ./lifecycle ./modules)
  • GitHub Check: build_test
  • GitHub Check: build_test
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
🔇 Additional comments (7)
proto/wg/cosmo/platform/v1/platform.proto (1)

3020-3020: LGTM! Clean proto field addition.

The deprecationReason field is correctly added as field number 4 with an appropriate string type, following the existing field numbering convention.

controlplane/src/types/index.ts (1)

749-749: LGTM! Type definition aligns with the feature.

The optional deprecationReason field is correctly added to the Field interface, complementing the existing isDeprecated boolean flag.

studio/src/components/operations/deprecated-fields-table.tsx (4)

21-26: LGTM! Interface correctly defines the new field.

The deprecationReason field is added as a required string, which is appropriate since the mapping at line 68 ensures a fallback value is always provided.


63-69: LGTM! Clean data mapping with user-friendly fallback.

The mapping correctly extracts deprecationReason from the API response with a sensible fallback to "-" for missing or empty values.


101-103: LGTM! Well-proportioned table layout.

The column width distribution (30% / 50% / 20%) appropriately allocates more space to the deprecation reason, which is likely to contain longer descriptive text.


112-112: LGTM! ColSpan values correctly updated.

All colSpan attributes are properly updated from 2 to 3 to accommodate the new Deprecation Reason column.

Also applies to: 143-143, 157-157

connect/src/wg/cosmo/platform/v1/platform_pb.ts (1)

23614-23617: LGTM!

The new deprecationReason field is correctly added to the generated protobuf TypeScript bindings. The field number (4) is unique, the type (STRING/T: 9) is appropriate, and the implementation follows the established pattern for existing fields (fieldName, typeName, path).

Also applies to: 23630-23630

Comment thread studio/src/components/operations/operation-content-modal.tsx
Copy link
Copy Markdown
Contributor

@StarpTech StarpTech left a comment

Choose a reason for hiding this comment

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

LGTM

@JivusAyrus JivusAyrus merged commit 00cad53 into main Dec 3, 2025
44 checks passed
@JivusAyrus JivusAyrus deleted the suvij/add-reason-to-deprecated-fields-in-op-view branch December 3, 2025 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants