Skip to content

Extract business logic from UI routes for dataset page#3763

Merged
shuyangli merged 2 commits intomainfrom
sl/refactor-datapoint-routes
Oct 1, 2025
Merged

Extract business logic from UI routes for dataset page#3763
shuyangli merged 2 commits intomainfrom
sl/refactor-datapoint-routes

Conversation

@shuyangli
Copy link
Copy Markdown
Member

@shuyangli shuyangli commented Sep 30, 2025

I would like to separate the UI components, routes and loaders, and business logic in the frontend. This takes one step forward (loaders and components are still together, but business logic is split out.

Not fully set on this approach, just want to send it out to get some feedback. If this looks good we can ask the models to do a refactor later.


Important

Extracted business logic from UI routes into datapointOperations.ts for better separation of concerns and maintainability.

  • Business Logic Extraction:
    • Moved validation (validateJsonOutput), transformation (transformOutputForTensorZero), and core operations (deleteDatapoint, saveDatapoint) to datapointOperations.ts.
    • Updated route.tsx to use extracted functions for handling datapoint actions.
  • Functionality:
    • validateJsonOutput checks JSON validity in outputs.
    • hasDatapointChanged checks for changes in input, output, and tags.
    • deleteDatapoint and saveDatapoint handle datapoint deletion and saving, respectively.
  • UI Route Changes:

Copy link
Copy Markdown
Member Author

shuyangli commented Sep 30, 2025

@shuyangli shuyangli marked this pull request as ready for review September 30, 2025 21:46
@shuyangli shuyangli changed the base branch from sl/add-table-item-text-component to graphite-base/3763 September 30, 2025 21:46
virajmehta
virajmehta previously approved these changes Oct 1, 2025
@shuyangli shuyangli force-pushed the sl/refactor-datapoint-routes branch from 1c8dcf9 to f2ab723 Compare October 1, 2025 02:36
@shuyangli shuyangli changed the base branch from graphite-base/3763 to main October 1, 2025 02:36
@shuyangli shuyangli dismissed virajmehta’s stale review October 1, 2025 02:36

The base branch was changed.

virajmehta
virajmehta previously approved these changes Oct 1, 2025
@virajmehta virajmehta enabled auto-merge October 1, 2025 13:38
@shuyangli shuyangli force-pushed the sl/refactor-datapoint-routes branch from f2ab723 to b2a05c3 Compare October 1, 2025 13:40
@shuyangli shuyangli disabled auto-merge October 1, 2025 14:35
@shuyangli shuyangli force-pushed the sl/refactor-datapoint-routes branch from c8d4556 to 1945f42 Compare October 1, 2025 14:56
@shuyangli
Copy link
Copy Markdown
Member Author

Ok, now it should build. I think what's irking me is that there are too many things happening in these routes - some is UI, some is calling the Rust gateway, and some is handling HTTP actions. I would like to generally separate them more to make FE easier to understand (and generally remove all direct calls to ClickHouse), but will think about the right approach.

@shuyangli shuyangli enabled auto-merge October 1, 2025 15:00
virajmehta
virajmehta previously approved these changes Oct 1, 2025
@virajmehta
Copy link
Copy Markdown
Member

Seems like some tests timed out in the docker build / compose step; we can rerun just these afterwards then merge.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 1, 2025

TensorZero CI Bot Automated Comment

Thanks for the refactor! CI is currently failing for two reasons:

  1. Prettier format check failed in the UI workspace:

    • ui/app/routes/datasets/$dataset_name/datapoint/$id/datapointOperations.server.ts
    • ui/app/routes/datasets/$dataset_name/datapoint/$id/route.tsx

    The validate job stops on this, so TypeScript checks and other validations don't even run. This is the one actionable item in the code right now.

  2. E2E ClickHouse and UI jobs hit Docker "DeadlineExceeded: context deadline exceeded" while building/starting containers. Because the build step failed, follow-up steps that create the fixtures .env were skipped, and later "Print logs"/"health" steps then complained about a missing ui/fixtures/.env file. There’s no code error indicated here; it looks like a flake/environment timeout. Once the Prettier issue is fixed and CI re-runs, these steps should proceed normally. If the timeouts persist after formatting passes, try re-running the workflow — we can’t adjust the CI timeouts in this PR.

Summary of what to do:

  • Fix formatting in the UI workspace (see command below) and push again.
  • Re-run CI. If the Docker compose steps still time out, re-run once; if it persists, we can dig deeper, but nothing in this PR appears to break those jobs.

@virajmehta virajmehta removed their assignment Oct 1, 2025
@shuyangli shuyangli force-pushed the sl/refactor-datapoint-routes branch from 1945f42 to 23d7f1a Compare October 1, 2025 16:12
@shuyangli shuyangli assigned shuyangli and virajmehta and unassigned shuyangli Oct 1, 2025
@shuyangli shuyangli added this pull request to the merge queue Oct 1, 2025
Merged via the queue into main with commit 10324a7 Oct 1, 2025
30 checks passed
@shuyangli shuyangli deleted the sl/refactor-datapoint-routes branch October 1, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants