Skip to content

Fix #3370: row details overwrote the WHERE-clause id when the table has an id column - #3386

Merged
kodiakhq[bot] merged 5 commits into
ClickHouse:mainfrom
wanjinhao1:agent/fix-3370-row-id-where
Oct 19, 2026
Merged

kodiakhq[bot] merged 5 commits into
ClickHouse:mainfrom
wanjinhao1:agent/fix-3370-row-id-where

Conversation

@wanjinhao1

Copy link
Copy Markdown
Contributor

Summary

Fixes #3370.

In DBRowTable.tsx, the row-details object was built as { id: rowId, aliasWith: ..., ...row.original }. If the underlying table has an id column, the spread of row.original overwrote id with the raw column value, so expanding a row sent the raw value as the WHERE clause (e.g. WHERE (a5c1334f-9b43-...)), which ClickHouse parses as an invalid expression and fails with "Error loading row data".

The fix spreads row.original first and then sets id and aliasWith, so the WHERE clause identifier always wins — exactly the approach suggested in the issue by @karl-power.

Screenshots or video

Omitted — no visual UI change; the fix only corrects the query payload sent when expanding a row. (Bug symptom on main: "Error loading row data" banner; on this branch the row expands successfully.)

How to reproduce

Starting point: HyperDX OSS 2.41.0 (or main), a table whose id column is a string containing hyphens/periods, e.g. a5c1334f-9b43-44db-abc3-3412220272dd.0.0 (schema and details in #3370).

On main:

  1. Search the table and expand a row.
  2. Verify: "Error loading row data" is shown; the sent query contains WHERE (a5c1334f-9b43-44db-abc3-3412220272dd.0.0).

On this branch:

  1. Same steps.
  2. Verify: the row details load; the sent query keeps the proper WHERE clause on the internal row id.

How to test on Vercel preview

N/A — requires a custom table with a non-integer string id column, which the demo ClickHouse data does not provide; reproduction steps above cover the change.

References


🤖 This change was implemented with AI assistance under the direction of the contributor (@wanjinhao1), who reviewed and validated the change. Formatting checked with Prettier.

…in row details

The row details object spread row.original after setting id and aliasWith,
so a table with an uid=1000(wan) gid=1000(wan) groups=1000(wan),4(adm),20(dialout),24(cdrom),27(sudo),30(dip),46(plugdev),100(users),114(lpadmin),995(input) column overwrote the WHERE clause id with the raw
column value, producing invalid SQL when expanding a row. Spread the row
first so id/aliasWith always win.
@changeset-bot

changeset-bot Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5913984

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

@vercel

vercel Bot commented Oct 16, 2026

Copy link
Copy Markdown

@wanjinhao1 is attempting to deploy a commit to the HyperDX Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added external needs-vouch Author needs a maintainer to vouch for them labels Oct 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi @wanjinhao1, thanks for the pull request!

Before we review code from a first-time contributor, a maintainer vouches for them, and you're not on our list yet. There's nothing else to file and this PR stays open — a maintainer will look at it, usually within a day or two, and vouch for you right here if it's a genuine attempt at the problem.

To make that quick, check the PR description has:

  • The issue it addresses (ideally one labelled Accepting PR) and why the change is needed
  • Steps to reproduce the problem and verify the fix, starting from https://play.hyperdx.io or yarn app:dev:local connected to the demo server
  • Before/after screenshots if anything in the UI changed

More detail in our contributing guide.

canOpenSidePanel={canOpenSidePanel}
>
{renderRowDetails?.({
...row.original,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — No regression test pins that id/aliasWith override a same-named column in row details

Add a case to the existing inline-expand suite in packages/app/src/components/__tests__/DBRowTable.test.tsx (baseProps ~line 316). Use rows: [{ id: 'a5c1334f-...', col1: 'v' }] and a jest.fn() renderRowDetails, expand the row, then assert it was called with expect.objectContaining({ id: ROW_ID }). Without it, moving the spread back after id would bring #3370 back and every test would still pass.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

PR Review

✅ No issues found.

@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] Fixes row details query when table has an id column.

The code fix looks sound, but the remaining test requirement should be completed before merging.

Fix All in Claude CodeFindings

  1. P2 Spread order has no test ▶

Summary

Fixes row expansion when a table has its own id column.

  • Expanded rows keep the query id when tables have an id column.

Reviews (3) · Last reviewed commit: "Merge branch 'main' into agent/fix-3370-..." · Reviewed by Greptile

Comment on lines +1323 to 1326
...row.original,
id: rowId,
aliasWith:
row.original[INTERNAL_ROW_FIELDS.ALIAS_WITH],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Spread order has no test

This fix changes which id and aliasWith reach renderRowDetails, but adds no test. Existing expansion tests use rows without an id column, and their details callback ignores its argument, so they would pass with the old bug.

AGENTS.md requires tests alongside the implementation. Before merging, add a test that expands a row with a raw string id and checks that renderRowDetails receives the generated WHERE clause as id. Also check that computed aliasWith wins over a matching raw column.

Context Used: AGENTS.md (source)

Fix in Claude Code Fix in Conductor Fix in Cursor Fix in Codex

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

The core fix is sound. Reordering the row-details object to { ...row.original, id: rowId, aliasWith } makes the internal WHERE-clause id win over any raw column named id, resolving #3370. Correctness tracing confirms both consumers of renderRowDetails (DBSqlRowTableWithSidebar.tsx reads id/aliasWith; ClickhousePage.tsx reads the spread query) are correct under the new order, and the independent side-panel path is unaffected. The added regression test genuinely fails against the old spread order.

✅ No critical issues found.

🟡 P2 -- recommended

  • packages/app/src/components/__tests__/DBRowTable.test.tsx:397 -- the regression test proves the id override but not the symmetric aliasWith override, since the test row has no raw column named aliasWith, leaving the aliasWith: line at DBRowTable.tsx:1368 unexercised against a competing column.
    • Fix: add a row carrying a raw aliasWith column with a distinct value and assert renderRowDetails receives the computed aliasWith from generateRowId, mirroring the id assertion.
    • testing, previous-comments, correctness, kieran-typescript
🔵 P3 nitpicks (2)
  • packages/app/src/components/DBRowTable.tsx:1366 -- ...row.original spreads the internal tracking fields __hyperdx_id and __hyperdx_alias_with into the renderRowDetails payload alongside the public id/aliasWith (pre-existing; both current consumers ignore them).
    • Fix: destructure the INTERNAL_ROW_FIELDS keys out of row.original before spreading so consumers receive only real columns plus the explicit id/aliasWith.
    • maintainability, kieran-typescript
  • packages/app/src/components/DBRowTable.tsx:1365 -- the correctness of the fix depends on spread order, but the loose [key: string]: any payload type gives no compile-time guard and there is no inline note, so a future reorder could silently reintroduce the bug.

Reviewers (6): correctness, testing, maintainability, project-standards, kieran-typescript, previous-comments.

Testing gaps: The aliasWith raw-column override path (DBRowTable.tsx:1368) is untested; the added test covers only the id-column collision.

No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond

canOpenSidePanel={canOpenSidePanel}
>
{renderRowDetails?.({
...row.original,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — No regression test for the id-column overwrite this PR fixes

The RawLogTable inline-expand tests in packages/app/src/components/__tests__/DBRowTable.test.tsx (baseProps around line 316) already set up the table for this. Add a case with rows: [{ id: 'a5c1334f-...', col1: 'value1' }] and a jest.fn() renderRowDetails. Expand the row and assert the mock was called with expect.objectContaining({ id: ROW_ID, aliasWith: [] }). Without that test, nothing stops someone from moving the spread back after id later.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

@vercel

vercel Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
hyperdx-oss Ready Ready Preview Oct 19, 2026 12:22pm UTC
hyperdx-storybook Ready Ready Preview Oct 19, 2026 12:22pm UTC

Request Review

@kodiakhq
kodiakhq Bot merged commit f1bdd8f into ClickHouse:main Oct 19, 2026
30 checks passed

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — 59139845 Deployed Oct 19, 2026 by vercel[bot]
Preview – hyperdx-storybook — 59139845 Deployed Oct 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge external needs-vouch Author needs a maintainer to vouch for them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error loading row data if id field is not an integer

2 participants