Uh oh!
There was an error while loading. Please reload this page.
disable deleting metrics that are in use - #3298
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request aims to prevent deletion of metrics that are referenced by experiment queries by surfacing “in-use” metadata from the backend and disabling the delete action in the metrics UI, while also avoiding unintended HTTP cancellations during navigation-triggered refreshes.
Changes:
- Add
hasQuerymetadata to the metrics catalog payload and use it in the UI to disable metric deletion with an explanatory tooltip. - Refresh the metrics catalog after experiment metric updates and experiment deletion.
- Add an opt-out mechanism for navigation-based HTTP cancellation for app-wide metrics catalog fetches.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/types/src/Experiment/interfaces.ts | Adds optional hasQuery flag to IMetricUnit for in-use signaling. |
| packages/frontend/projects/upgrade/src/assets/i18n/en.json | Adds tooltip copy for disabled metric deletion. |
| packages/frontend/projects/upgrade/src/app/features/dashboard/profile/components/metrics/metrics.model.ts | Adds isTopLevel marker used to constrain delete affordance to row roots. |
| packages/frontend/projects/upgrade/src/app/features/dashboard/profile/components/metrics/metrics.component.ts | Propagates isTopLevel and hard-blocks deletion when hasQuery is true. |
| packages/frontend/projects/upgrade/src/app/features/dashboard/profile/components/metrics/metrics.component.scss | Styles disabled delete icon state. |
| packages/frontend/projects/upgrade/src/app/features/dashboard/profile/components/metrics/metrics.component.html | Disables delete icon + tooltip when hasQuery, and limits delete to top-level nodes. |
| packages/frontend/projects/upgrade/src/app/core/http-interceptors/http-cancel.interceptor.ts | Introduces SKIP_NAVIGATION_CANCEL context token to bypass navigation cancellation. |
| packages/frontend/projects/upgrade/src/app/core/experiments/store/experiments.effects.ts | Dispatches actionFetchMetrics() after experiment metrics update and experiment deletion. |
| packages/frontend/projects/upgrade/src/app/core/experiments/store/experiments.effects.spec.ts | Adds unit coverage for updateExperimentMetrics$ emitting two actions. |
| packages/frontend/projects/upgrade/src/app/core/analysis/store/analysis.effects.ts | Adds defaultIfEmpty guards so canceled requests emit a failure action. |
| packages/frontend/projects/upgrade/src/app/core/analysis/analysis.data.service.ts | Sets SKIP_NAVIGATION_CANCEL on metrics catalog fetch requests. |
| packages/frontend/projects/upgrade/src/app/core/analysis/analysis.data.service.spec.ts | Updates fetchMetrics expectation (but needs stronger assertion of token behavior). |
| packages/backend/src/api/services/MetricService.ts | Fetches query-used metric keys and annotates top-level metrics with hasQuery. |
| packages/backend/src/api/repositories/QueryRepository.ts | Adds query to return distinct metric keys referenced by queries. |
| packages/backend/test/unit/services/MetricService.test.ts | Updates unit tests to validate hasQuery behavior on metric trees. |
| packages/backend/test/unit/repositories/QueryRepository.test.ts | Adds unit tests for getMetricKeysWithQueries(). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as resolved.
This comment was marked as resolved.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
No description provided.