Consolidate JSON stringify dependencies#251890
Conversation
The consolidation work changed from json-stable-stringify to safe-stable-stringify. These libraries format empty arrays differently: json-stable-stringify: Empty arrays span 2 lines ([\n]) safe-stable-stringify: Empty arrays are inline ([]) This results in 9 fewer lines (49 vs 40), which matches the test discrepancy (44 vs 35 unchanged lines).
jbudz
left a comment
There was a problem hiding this comment.
packages/kbn-optimizer/src/optimizer/diff_cache_key.ts LGTM
pmuellr
left a comment
There was a problem hiding this comment.
ResponseOps changes LGTM
davismcphee
left a comment
There was a problem hiding this comment.
Data Discovery changes LGTM 👍
azasypkin
left a comment
There was a problem hiding this comment.
Changes in ESO plugin, LGTM, thanks!
|
/oblt-deploy |
weltenwort
left a comment
There was a problem hiding this comment.
obs-exploration changes LGTM
sabarasaba
left a comment
There was a problem hiding this comment.
kibana management changes lgtm
|
@elasticmachine merge upstream |
rmyz
left a comment
There was a problem hiding this comment.
obs presentation changes LGTM
christineweng
left a comment
There was a problem hiding this comment.
Cases changes LGTM, code review only
nikitaindik
left a comment
There was a problem hiding this comment.
Found a minor visual regression in our diff UI when reviewing. While the diff is still technically correct, it now looks noisier in cases where an empty array becomes non-empty, or vice versa.
Old implementation
This PR
Let me take another look at it tomorrow and get back to you. As a raw idea, I guess we could pre-process JSONs to expand "[]" to "[\n]".
|
@nikitaindik I really appreciate the review and code changes. Thanks! |
|
@elasticmachine merge upstream |
⏳ Build in-progress
Failed CI StepsTest Failures
History
|
* commit '7dcc1fe3c205d2de0c3ca3f65804f21de09013c3': (285 commits) Enrich kbn-check-saved-objects-cli README with CI and manual usage docs (elastic#252557) [Discover] Add feature flag to make ESQL the default query mode (elastic#252268) Add maskProps.headerZindexLocation above to inspect component flyout (elastic#252543) [Security Solution][Atack/Alerts] Flyout header: Assignees (elastic#252190) Upgrade EUI to v112.3.0 (elastic#252315) [Fleet] Make save_knowledge_base async in streaming state machine (elastic#252328) Upgrade @smithy/config-resolver 4.3.0 → 4.4.6 (elastic#252457) [Lens as API] Add colorMapping support for XY charts (ES|QL data layers) (elastic#252051) [WorkplaceAI] Add Google Drive data source and connector (elastic#250677) [Scout] Move GlobalSearch FTR tests to Scout (elastic#252201) [EDR Workflows] Fix osquery pack results display when agent clock is skewed (elastic#251417) [Observability Onboarding] Apply integrations limit after dedup in parseIntegrationsTSV (elastic#252486) [Entity Analytics] Update `host.ip` aggregation to remove painless script (elastic#252426) Address `@elastic/eui/require-table-caption` lint violations across `@elastic/obs-presentation-team` files (elastic#251050) Consolidate JSON stringify dependencies (elastic#251890) [index mgmt] Use esql instead of query dsl to get the index count (elastic#252422) Add Usage API Plugin (elastic#252434) Cases All Templates page (elastic#250372) [Agent Builder] Default value for optional params in ESQL tools (elastic#238472) [Fleet] Add upgrade_details.metadata.reason to AgentResponseSchema (elastic#252485) ...




Resolves #233194
Moves all JSON stringification under
@kbn/stdwhere we already had an existing stringification utility. This also consolidates the implementation to a single third-party dependency, instead of 3.Important
Please test your UIs! Tests may not catch all regressions!
Consolidate JSON Stringification Dependencies
Background
The issue #233194 requests consolidating JSON stringification dependencies. After analysis:
Solution: Extend
@kbn/stdPackageExtend the existing
@kbn/stdpackage with new JSON stringify utilities, backed bysafe-stable-stringifywhich handles both circular references AND deterministic ordering.Why
@kbn/std?Already has related utilities:
safeJsonParse,safeJsonStringifyWidely used core package for general utilities
Avoids creating a new single-purpose package
Files to Modify in
@kbn/stdPurpose: What is this dependency used for? Briefly explain its role in your changes.
This is used for both stable and safe JSON stringification. It was already included as a transitive dependency. This promotes it to a top-level dependency.
Justification: Why is adding this dependency the best approach?
It allows us to consolidate JSON stringification use cases down to a single dependency.