Skip to content

fix(frontend): enhance JSON object handling and rendering in testset#4510

Open
ashrafchowdury wants to merge 3 commits into
mainfrom
fix/testset-json-object-rendering
Open

fix(frontend): enhance JSON object handling and rendering in testset#4510
ashrafchowdury wants to merge 3 commits into
mainfrom
fix/testset-json-object-rendering

Conversation

@ashrafchowdury
Copy link
Copy Markdown
Contributor

Summary

Fix testcase table handling for stringified JSON values.

String values now remain strings throughout testcase table display/type detection:

  • stringified JSON stays a single column
  • stringified JSON renders as plain text
  • stringified JSON receives the string type chip
  • native objects still expand into nested columns and keep object behaviour

Testing

Verified locally

Added or updated tests

QA follow-up

Demo

image image

Contributor Resources

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

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

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jun 1, 2026 3:13pm

Request Review

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. Frontend labels Jun 1, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Customizable cell rendering for tables with smarter per-value rendering
    • Group header type chips now reflect sampled row values instead of a fixed type
    • Editor supports reliable nested-path projection and native array/object traversal
  • Bug Fixes

    • Stop treating stringified JSON as native nested data; string leaves remain strings
    • More robust extraction and update of nested values, improving empty/array/object detection

Walkthrough

Removes JSON-string parsing from column/path utilities, adds native-path traversal helpers, wires a renderCell hook for custom cell rendering, and computes group header type-chip variants by sampling native values from testcase entity data.

Changes

Transition from stringified JSON parsing to native column values

Layer / File(s) Summary
Path utilities and column extraction foundation
web/oss/src/state/entities/testcase/columnPathUtils.ts, web/oss/src/state/entities/testcase/columnState.ts, web/packages/agenta-entities/src/testcase/core/columnExtraction.ts, web/packages/agenta-entity-ui/src/testcase/TestcaseDataEditor.utils.ts
Stop parsing JSON strings during path traversal and column extraction. columnPathUtils removes JSON-string container parsing and simplifies array/object checks. collectColumnPaths now expands only native plain objects. New native-path helpers implement validated object/array traversal, setting, and projection for testcase editor operations.
Cell rendering infrastructure with native value extraction
web/oss/src/components/TestcasesTableNew/components/testcaseCellValueUtils.ts, web/packages/agenta-entity-ui/src/shared/EntityTable.tsx, web/packages/agenta-entity-ui/src/testcase/TestcaseTable.tsx
parseTestcaseCellJson short-circuits string inputs as non-JSON. EntityTable gains an optional renderCell prop and threads it into column construction. TestcaseTable adds getNativeColumnValue for dot/array paths, provides a renderCell that routes strings to TextCellContent and others to SmartCellContent, and updates type-chip sampling to use native-value access.
Group header type-chip inference from native values
web/oss/src/components/TestcasesTableNew/components/TestcasesTableShell.tsx
Adds getNativeColumnValue and replaces the default row-value provider for type-chip wiring to read from testcase entity data via Jotai. Computes groupHeaderTypeVariants by sampling up to 30 non-skeleton rows, detecting column types, and resolving header chip variants. Collapsed and expanded group headers now conditionally render inferred TypeChip variants instead of a fixed "json-object" variant.

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 60.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: improving JSON object handling and rendering in the testset/testcase table to keep stringified JSON as strings rather than expanding them.
Description check ✅ Passed The description is directly related to the changeset, explaining the fix for stringified JSON handling with clear before/after behavior and including demonstration images.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/testset-json-object-rendering

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
web/oss/src/components/TestcasesTableNew/components/testcaseCellValueUtils.ts (1)

3-9: ⚡ Quick win

Add a regression test for the native-vs-string split.

This helper now defines a key contract for the rest of the pipeline: "{}" should stay a string, while native objects/arrays should still flow through JSON-aware rendering. A small table-driven test here would make that behavior much harder to accidentally undo later.

web/packages/agenta-entity-ui/src/testcase/TestcaseTable.tsx (1)

77-107: ⚡ Quick win

Extract getNativeColumnValue into one shared utility.

This traversal logic now exists in at least three places in this PR (TestcaseTable, TestcasesTableShell, and columnPathUtils). Since rendering and type-chip inference need to agree exactly on native-path semantics, keeping one implementation will reduce drift risk the next time this behavior changes.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 423560df-6440-41be-ae00-d5aec18d30da

📥 Commits

Reviewing files that changed from the base of the PR and between d7c60c1 and 8aad572.

📒 Files selected for processing (7)
  • web/oss/src/components/TestcasesTableNew/components/TestcasesTableShell.tsx
  • web/oss/src/components/TestcasesTableNew/components/testcaseCellValueUtils.ts
  • web/oss/src/state/entities/testcase/columnPathUtils.ts
  • web/oss/src/state/entities/testcase/columnState.ts
  • web/packages/agenta-entities/src/testcase/core/columnExtraction.ts
  • web/packages/agenta-entity-ui/src/shared/EntityTable.tsx
  • web/packages/agenta-entity-ui/src/testcase/TestcaseTable.tsx

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Railway Preview Environment

Preview URL https://gateway-production-1e9d.up.railway.app/w
Image tag pr-4510-0714ff6
Status Failed
Railway logs Open logs
Logs View workflow run
Updated at 2026-06-01T15:22:23.112Z

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 45ba387a-3d69-4d13-b2fa-218441af3ed1

📥 Commits

Reviewing files that changed from the base of the PR and between 8aad572 and 79e1115.

📒 Files selected for processing (4)
  • web/oss/src/components/TestcasesTableNew/components/TestcasesTableShell.tsx
  • web/oss/src/state/entities/testcase/columnState.ts
  • web/packages/agenta-entity-ui/src/testcase/TestcaseDataEditor.tsx
  • web/packages/agenta-entity-ui/src/testcase/TestcaseDataEditor.utils.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/oss/src/components/TestcasesTableNew/components/TestcasesTableShell.tsx

@ashrafchowdury ashrafchowdury requested a review from ardaerzin June 2, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant