Commit Graph

7 Commits

Author SHA1 Message Date
Ali Waseem a70264c8ad fix(studio): coerce index advisor cost values to numbers (#44397)
## Summary

- Coerces `before`/`after` cost values to `Number()` in
`QueryPanelScoreSection` and `calculateImprovement` before any
comparison or arithmetic
- Fixes contradictory index advisor display where correct cost numbers
showed 0% improvement and wrong arrow direction

## Root Cause

When `index_advisor_result` is prefetched from the Reports SQL query
(via `json_build_object`), cost values can arrive as strings instead of
numbers. JavaScript string comparison is lexicographic, producing wrong
results:

| Expression | Numbers | Strings |
|---|---|---|
| `after > before` (arrow) | `50 > 100` → `false`  | `"50" > "100"` →
`true`  |
| `costBefore <= costAfter` (improvement calc) | `100 <= 50` → `false` 
| `"100" <= "50"` → `true`  |

The direct fetch path (`retrieve-index-advisor-result-query.ts`)
validates through Zod and is unaffected. Only the prefetched path lacks
validation.




<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved numeric value handling in query performance calculations to
ensure more accurate and reliable improvement metrics.

* **Refactor**
* Enhanced type safety and numeric coercion for query performance score
comparisons, resulting in more consistent and robust metric
calculations.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-02 13:30:00 +00:00
Charis 4a0bb36ca8 style: require sorted imports in studio/components (#44408)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-04-01 10:22:37 +02:00
kemal.earth 4978d24adc feat(studio): update query pattern section in query details (#38876)
* feat: basic toggle test

* feat: first draft of query pattern revamp

* style: small styling tweaks
2025-09-22 16:43:52 +01:00
kemal.earth 4d91b0956c feat(studio): query details metadata tidy up (#38867)
* feat: move query details to sheet

This moves the click through on Query Performance to a sheet as opposed to a resizable area. This gives us more space to play with and sets us up for the Query details revamp.

* fix: tabs font size

* style: expand size of sheet

* feat: hasOverlay prop for sheets

* feat: add optional overlay for sheets

* fix: closing only when clicking outside of rows

* style: width of panel on different  viewports

* fix: horizontal scroll for table

* fix: query queries label check in metrics

* feat: tidying up metadata values in query details

* feat: tidy up ms values

* fix: query pattern heading
2025-09-22 13:35:58 +01:00
Jordi Enric a023a59ec5 fix crash in query performance (#37758)
* fix crash

* undo query perf

* fix crash
2025-08-08 09:55:01 +02:00
Ivan Vasilov 52735e38bf chore: Rename all uses of Tooltip_Shadcn_ to just Tooltip (#32860)
* Rename all uses of Tooltip_Shadcn_ to just Tooltip.

* Fix a leftover change.
2025-01-20 22:23:45 +01:00
Ivan Vasilov 5cf8f30e23 chore: Remove obsolete flags (#22915)
* Remove showS3Connection flag.

* Remove showAnonUserFilter flag.

* Remove   enableVercelConnectionsConfig flag.

* Remove indexAdvisor flag.

* Remove queryPerformanceV2 flag.

* Remove unused files.

* Remove unneeded packages.

* Remove the v2 suffix from the query performance folder.
2024-04-22 09:38:41 +02:00