-
Notifications
You must be signed in to change notification settings - Fork 17
fix: do not parse valid objects from meta #2785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
70602ea to
e6be5c2
Compare
|
/claude_review |
|
Claude finished @artemmufazalov's task —— View job Code Review: Handle Meta Version Field DecodingSummaryThis PR addresses a backward compatibility issue where new meta versions decode certain fields as objects while the UI expects strings. The implementation provides robust type-safe parsing with proper error handling. ✅ Strengths
🔍 Areas for Improvement
📋 Minor Observations
✅ Security & Best Practices
Overall AssessmentThis is a well-implemented solution that properly handles backward compatibility. The code is type-safe, well-tested, and follows all project conventions. The approach of checking types at runtime and parsing only when needed is correct for this scenario. Recommendation: Approved with minor suggestions. Consider implementing the trace_check parser if that field is used in the UI. |
There was a problem hiding this 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 fixes parsing of meta cluster fields to handle newer API versions that return already-parsed objects instead of stringified JSON. The UI was expecting strings and attempting to parse them, which caused issues when the API started returning valid objects directly.
- Updates type definitions to handle both string and object formats for meta fields (solomon, cores, logging, trace_view)
- Refactors parsing functions to check if data is already an object before attempting JSON.parse
- Consolidates parsing logic into dedicated utility functions with proper error handling
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/api/meta.ts | Updates cluster info types to support both string and object formats for meta fields |
| src/types/api/trace.ts | Removes trace view schema (moved to parseFields) |
| src/store/reducers/cluster/parseFields.ts | New utility module with parsing functions for meta fields |
| src/store/reducers/cluster/cluster.ts | Updates useClusterBaseInfo to use new parsing functions |
| src/store/reducers/cluster/test/parseFields.test.ts | Test coverage for new parsing functions |
| src/utils/monitoring.ts | Updates monitoring functions to handle object/string union types |
| src/utils/logs.ts | Updates logging interface to use proper type |
| src/services/parsers/parseMetaCluster.ts | Removes old parsing logic (replaced by parseFields) |
| src/containers/Cluster/ClusterInfo/utils/useClusterLinks.ts | Simplifies link preparation using parsed objects |
| src/containers/Cluster/ClusterInfo/utils/tests/prepareLinks.test.ts | Removes tests for old parsing functions |
Part of #2725
New meta version decodes some fields, while our UI expects them to be strings
CI Results
Test Status:⚠️ FLAKY
📊 Full Report
Test Changes Summary ⏭️2
⏭️ Skipped Tests (2)
Bundle Size: ✅
Current: 85.38 MB | Main: 85.38 MB
Diff: +0.46 KB (0.00%)
✅ Bundle size unchanged.
ℹ️ CI Information