fix: stringify JSON search sidebar filters#2551
Conversation
🦋 Changeset detectedLatest commit: 8b35ce0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@mfroembgen is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR fixes JSON-backed sidebar filters in the search page by switching from
Confidence Score: 4/5Safe to merge for standard OTel deployments; one edge case in the new expression parser affects underscore-prefixed JSON column names. The new packages/common-utils/src/core/metadata.ts — Important Files Changed
Reviews (22): Last reviewed commit: "fix: stringify JSON search sidebar filte..." | Re-trigger Greptile |
5116fd3 to
73196cd
Compare
fe66a5f to
424cc9a
Compare
424cc9a to
16061b0
Compare
🔴 P0/P1 -- must fix
🟡 P2 -- recommended
🔵 P3 nitpicks (6)
Reviewers (8): correctness, security, adversarial, julik-frontend-races, kieran-typescript, testing, maintainability, api-contract. Testing gaps:
|
d2d943e to
7f46a87
Compare
7f46a87 to
0d7e71d
Compare
Deep Review✅ No critical issues found. The core mechanics of this change hold up under review: the new 🟡 P2 -- recommended
🔵 P3 nitpicks (4)
Reviewers (4): security, testing, project-standards, learnings-researcher (plus orchestrator verification of Testing gaps:
|
545e99c to
64547ea
Compare
64547ea to
8b35ce0
Compare
| const isIdentifierStart = (char: string): boolean => | ||
| (char >= 'A' && char <= 'Z') || (char >= 'a' && char <= 'z'); |
There was a problem hiding this comment.
Add
_ to isIdentifierStart to match the set of bare-identifier first characters accepted by quoteIdentifierIfNeeded and ClickHouse itself. Without this, parseClickHouseIdentifier silently fails for underscore-prefixed column names such as _my_json_col, causing parseRenderedJsonStringExpression to return undefined and getAllKeyValues to fall back to rollupColumn = 'NativeColumn' — making Load More return empty results for those columns in MV-backed setups.
| const isIdentifierStart = (char: string): boolean => | |
| (char >= 'A' && char <= 'Z') || (char >= 'a' && char <= 'z'); | |
| const isIdentifierStart = (char: string): boolean => | |
| (char >= 'A' && char <= 'Z') || (char >= 'a' && char <= 'z') || char === '_'; |
Summary
toString(ResourceAttributes.\k8s`.`namespace`.`name`), instead of JSON map access or a fixed.:String` suffix.Load more.Why
toString(...)Testing against ClickHouse
26.5.1.882withJSON(max_dynamic_types=8, max_dynamic_paths=64)columns showed that.:Stringis only safe for JSON paths whose active dynamic type is actually String. Integer, boolean, and mixed-type paths can silently return no values with.:String, whiletoString(<JSON path>)returned usable values for all of these real path shapes:ResourceAttributes.k8s.namespace.name(string)ResourceAttributes.cloud.account.id(integer)LogAttributes.endOfBatch(boolean)LogAttributes.level(mixed integer/string)The same
toString(...)expression also worked for distribution/grouping queries.Manual verification
26.5.1.882, whereResourceAttributesandLogAttributesareJSON(max_dynamic_types=8, max_dynamic_paths=64)columns.toString(...).toString(ResourceAttributes.\cloud`.`account`.`id`)andtoString(LogAttributes.`endOfBatch`)`.ResourceAttributes['k8s.namespace.name']filters were canonicalized, results loaded without the ClickHousearrayElementJSON error, Show Distribution loaded, and selected/pinned facets refreshed with matching values plusLoad more.Automated verification
mise exec node@22.16.0 -- node .yarn/releases/yarn-4.13.0.cjs lint:fixmise exec node@22.16.0 -- node ../../.yarn/releases/yarn-4.13.0.cjs ci:lintinpackages/common-utilsmise exec node@22.16.0 -- node ../../.yarn/releases/yarn-4.13.0.cjs ci:unitinpackages/common-utilsmise exec node@22.16.0 -- node .yarn/releases/yarn-4.13.0.cjs workspace @hyperdx/app jest packages/app/src/components/__tests__/DBSearchPageFilters.test.tsx packages/app/src/components/DBSearchPageFilters/utils.test.ts packages/app/src/__tests__/searchFilters.test.ts --runInBand --coverage=falsemise exec node@22.16.0 -- bash -lc 'corepack enable >/dev/null 2>&1 || true; make dev-e2e FILE=filter-key-edge-cases'(18 passed)References
Fixes #2549.
Related to #2482 and #2537.