Repository navigation
Fix #3370: row details overwrote the WHERE-clause id when the table has an id column - #3386
Conversation
…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 detectedLatest commit: 5913984 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
|
@wanjinhao1 is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
|
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:
More detail in our contributing guide. |
| canOpenSidePanel={canOpenSidePanel} | ||
| > | ||
| {renderRowDetails?.({ | ||
| ...row.original, |
There was a problem hiding this comment.
🔵 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
PR Review✅ No issues found. |
[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.
|
| ...row.original, | ||
| id: rowId, | ||
| aliasWith: | ||
| row.original[INTERNAL_ROW_FIELDS.ALIAS_WITH], |
There was a problem hiding this comment.
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)
Deep ReviewThe core fix is sound. Reordering the row-details object to ✅ No critical issues found. 🟡 P2 -- recommended
🔵 P3 nitpicks (2)
Reviewers (6): correctness, testing, maintainability, project-standards, kieran-typescript, previous-comments. Testing gaps: The 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, |
There was a problem hiding this comment.
🔵 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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary
Fixes #3370.
In
DBRowTable.tsx, the row-details object was built as{ id: rowId, aliasWith: ..., ...row.original }. If the underlying table has anidcolumn, the spread ofrow.originaloverwroteidwith 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.originalfirst and then setsidandaliasWith, 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 whoseidcolumn is a string containing hyphens/periods, e.g.a5c1334f-9b43-44db-abc3-3412220272dd.0.0(schema and details in #3370).On
main:WHERE (a5c1334f-9b43-44db-abc3-3412220272dd.0.0).On this branch:
How to test on Vercel preview
N/A — requires a custom table with a non-integer string
idcolumn, 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.