Skip to content

Conversation

@kodart
Copy link
Contributor

@kodart kodart commented Nov 7, 2025

Note

Standardizes DB enums and migrations, updates Pydantic schemas to v2, refreshes trace UI color tokens, and defaults the frontend API client to localhost.

  • Backend:
    • Migrations/DB:
      • Introduce explicit PostgreSQL ENUMs (finish_reason, item_type, optimization_status, evaluation_status, score_type) with create/drop in upgrade/downgrade (e.g., backend/migrations/versions/*).
      • Adjust schemas in evaluation/testing: drop execution_result.input and change task.response_schema to JSONB with proper downgrade.
    • Models:
      • Name SQLAlchemy enum: SQLEnum(FinishReason, name="finish_reason") in backend/app/models/executions.py.
    • Schemas:
      • Move to Pydantic v2: replace validator with field_validator, and use ConfigDict(from_attributes=True) in backend/app/schemas/optimizations.py and backend/app/schemas/providers.py.
  • Frontend:
    • Trace UI: Replace hardcoded color classes with semantic tokens (border-warning/success/primary/accent/destructive/secondary, etc.) in frontend/src/components/trace/InputItemRenderer.tsx and .../OutputItemRenderer.tsx.
    • API Client: Default API_BASE_URL to http://localhost:8000 in frontend/src/lib/api/client.ts.

Written by Cursor Bugbot for commit 751f459. This will update automatically on new commits. Configure here.

- Introduced `evaluation`, `evaluation_config`, `target_task_metrics`, and `test_case` tables with appropriate columns and constraints.
- Added `evaluation_status` enum for tracking evaluation states.
- Created indexes for efficient querying on key columns.
- Updated `execution_result` table to include an `input` column and altered `response_schema` type for compatibility.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 30

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 19 to 27
finish_reason_enum = postgresql.ENUM(
"STOP",
"LENGTH",
"TOOL_CALLS",
"CONTENT_FILTER",
"FUNCTION_CALL",
"ERROR",
name="finish_reason",
create_type=False,

Choose a reason for hiding this comment

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

P1 Badge Keep execution_result enum name consistent with ORM

This migration creates the Postgres enum as finish_reason, but the ExecutionResult.finish_reason column is still declared with SQLEnum(FinishReason) in backend/app/models/executions.py, which defaults to the type name finishreason. On a clean database the migration will define only finish_reason, yet inserts through SQLAlchemy will cast values to ::finishreason, causing ERROR: type "finishreason" does not exist when saving execution results. Either keep the original enum name or update the model to use name="finish_reason" so both sides agree.

Useful? React with 👍 / 👎.

- Updated `finish_reason` column in `ExecutionResult` model to specify enum name.
- Modified migration scripts to drop enum and adjust check constraint names for clarity and consistency.
- Replaced `@validator` with `@field_validator` in `OptimizationRunRequest` for improved validation.
- Updated `ModelResponse` and `ProviderResponse` classes to use `model_config` with `ConfigDict` for configuration management.
- Updated enum values in multiple migration scripts to use lowercase for consistency with OpenAI API standards.
- Adjusted `finish_reason`, `item_type`, `score_type`, `evaluation_status`, and `optimization_status` enums accordingly.
import axios from "axios";

const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || "https://api.r4u.dev";
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || "http://localhost:8000";
Copy link

Choose a reason for hiding this comment

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

Bug: Production API points to local development.

The default API_BASE_URL was changed from https://api.r4u.dev to http://localhost:8000, which appears to be a development configuration that was accidentally committed instead of production settings.

Fix in Cursor Fix in Web

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