Skip to content

fix: don't wrap JSON filters in "toString" until query rendering#2344

Merged
kodiakhq[bot] merged 2 commits into
mainfrom
aaron/fix-json-logs
May 27, 2026
Merged

fix: don't wrap JSON filters in "toString" until query rendering#2344
kodiakhq[bot] merged 2 commits into
mainfrom
aaron/fix-json-logs

Conversation

@knudtty
Copy link
Copy Markdown
Contributor

@knudtty knudtty commented May 27, 2026

Summary

After changing filters to emit Lucene instead of SQL, JSON columns were trying to add "toString(Column.key)" as lucene, which is invalid syntax and broke things. That issue has been fixed.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview, Comment May 27, 2026 3:12pm

Request Review

@knudtty knudtty requested review from a team and fleon and removed request for a team May 27, 2026 14:56
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 27, 2026

🦋 Changeset detected

Latest commit: eb4abf0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Patch
@hyperdx/api Patch
@hyperdx/otel-collector Patch

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

@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label May 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

🔵 Tier 2 — Low Risk

Small, isolated change with no API route or data model modifications.

Why this tier:

  • Standard feature/fix — introduces new logic or modifies core functionality

Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns.
SLA: Resolve within 4 business hours.

Stats
  • Production files changed: 2
  • Production lines changed: 25 (+ 48 in test files, excluded from tier calculation)
  • Branch: aaron/fix-json-logs
  • Author: knudtty

To override this classification, remove the review/tier-2 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

<!-- deep-review -->

Deep Review

✅ No critical issues found.

🟡 P2 -- recommended

  • packages/app/src/components/EventTag.tsx:109 -- EventTag.onPropertyAddClick now unconditionally runs sqlExpression through cleanClickHouseExpression, but no test in this PR (or the existing suite) exercises that wrapping; the two production callers (DBRowOverviewPanel, DBHighlightedAttributesList) both feed in toString(...) expressions for JSON columns, so a future regression here would silently re-introduce the original Lucene parse failure.
    • Fix: Add a unit test that renders EventTag with a JSON-column sqlExpression like toString(ResourceAttributes.endpoint), clicks Add to Search, and asserts the callback receives the cleaned dot-form path.

Reviewers (4): correctness, testing, maintainability, kieran-typescript.

Testing gaps:

  • EventTag's new cleanClickHouseExpression wrap is not directly exercised; its correctness is only implied transitively by DBRowJsonViewer.test.tsx and the common-utils round-trip test.
  • The parsedJsonRootPath && !jsonQuery branch in DBRowJsonViewer.tsx (root-of-parsed-JSON click) lost its explicit toString wrapping; no test covers a click at that exact position to lock in the new behavior.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 27, 2026

E2E Test Results

All tests passed • 191 passed • 3 skipped • 1171s

Status Count
✅ Passed 191
❌ Failed 0
⚠️ Flaky 4
⏭️ Skipped 3

Tests ran across 4 shards in parallel.

View full report →

@kodiakhq kodiakhq Bot merged commit 55926e5 into main May 27, 2026
19 checks passed
@kodiakhq kodiakhq Bot deleted the aaron/fix-json-logs branch May 27, 2026 15:18
alex-fedotyev added a commit that referenced this pull request Jun 3, 2026
Resolved one conflict in `packages/app/src/components/DBRowJsonViewer.tsx`.

Origin: PR #2401 (rollback of #2344) restored the `isJsonColumn`
declaration and the `toString(...)` filter-wrapping logic that #2344
had removed. My branch was based on a main that included #2344, so
my HEAD had neither `isJsonColumn` nor the toString wrapping. The
merge produced a conflict at the `mergePath(...)` line because both
sides modified the same hunk: my side added `mapColumns` as the third
argument; main's side added back the `isJsonColumn` declaration.

Resolution: union both. Keep `mergePath(keyPath, jsonColumns, mapColumns)`
(HDX-4369 fix) and restore `const isJsonColumn = keyPath.length > 0 &&
jsonColumns?.includes(keyPath[0]);` so the four toString call sites
that main brought back compile and behave as on main.

Verified the HDX-4369 fix did not drift:
- mergePath suite (6 cases) green: numeric Map sub-key still emits
  Map['1'], not Map[2]; escape rules preserved; JSON-vs-Map precedence
  unchanged.
- buildJSONExtractQuery suite (4 cases) green: parsed-JSON Map sub-key
  still emits JSONExtractString(LogAttributes['1'], 'foo').
- deriveMapColumnsFromFields, getMapColumnNames, useMapColumns suites
  green; all mapColumns threading sites intact.
- 469 tests passed across 15 suites (all five files my PR touched plus
  neighbors).
- yarn workspace @hyperdx/app tsc --noEmit clean.
- yarn workspace @hyperdx/common-utils run build clean.
- yarn lint:fix clean (0 errors).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge review/tier-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants