Skip to content

fix(runs): accept any JSON in step/run output + paginate dashboard list#41

Merged
hoootan merged 3 commits into
mainfrom
fix/runs-list-output-and-pagination
May 2, 2026
Merged

fix(runs): accept any JSON in step/run output + paginate dashboard list#41
hoootan merged 3 commits into
mainfrom
fix/runs-list-output-and-pagination

Conversation

@hoootan
Copy link
Copy Markdown
Owner

@hoootan hoootan commented May 2, 2026

Summary

  • Server: StepResponse and RunResponse JSON-blob fields (input, output, error, tool_input, tool_output, agent_state, trigger_data) typed as Any instead of dict[str, Any]. The runner persists any JSON value to JSONB columns; the previous typing made GET /api/v1/runs/{id} 500 whenever a step output was a list/scalar, taking down the entire run-detail endpoint.
  • Tests: 15-case Pydantic regression suite at tests/unit/test_runs_schema.py covering lists, scalars, and nested round-trip.
  • Dashboard: runs list now drives server pagination (page_size=50) with prev/next controls, total count in the header, and resets to page 1 on filter change.

Test plan

  • ruff check server/src/flowforge_server/api/schemas/runs.py
  • pytest tests/unit/test_runs_schema.py -v — 15 passed
  • Manually verified pager flips Page 1/2 ↔ Page 2/2 in the dashboard with mock data
  • Hit GET /api/v1/runs/{id} against a run with a list step output — expect 200 with the list preserved

- StepResponse/RunResponse JSON-blob fields broadened from dict[str, Any]
  to Any, so list/scalar step outputs no longer 500 GET /runs/{id}
- Dashboard runs list now uses server pagination (page_size=50) with
  prev/next controls and total count
Copilot AI review requested due to automatic review settings May 2, 2026 08:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a server-side schema mismatch that caused GET /api/v1/runs/{id} to fail when JSONB-backed fields contained non-object JSON (e.g., lists/scalars), and updates the dashboard runs list to use server pagination.

Changes:

  • Server: widen Run/Step response “JSON blob” fields to accept non-dict JSON values.
  • Tests: add a regression suite to ensure RunResponse/StepResponse accept lists/scalars and round-trip through model_dump()/model_validate().
  • Dashboard: paginate the runs list with page_size=50, total count display, and prev/next controls.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
server/src/flowforge_server/api/schemas/runs.py Updates Run/Step response schemas to allow non-dict JSON values for JSONB-backed fields.
tests/unit/test_runs_schema.py Adds regression tests covering list/scalar JSON values and nested round-trips.
dashboard/src/app/(dashboard)/runs/page.tsx Switches runs list to server-driven pagination and updates the header + adds pager UI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


useEffect(() => {
let cancelled = false;
const fetch = async () => {
Comment on lines 8 to 10
import { api, type Run } from '@/lib/api';
import { VarStrip } from '@/components/ui/var-strip';

Comment on lines +16 to +18
input: Any | None = Field(None, description="Step input")
output: Any | None = Field(None, description="Step output")
error: Any | None = Field(None, description="Error details")
status: str = Field(..., description="Current status")
trigger_type: str = Field(..., description="How the run was triggered")
trigger_data: dict[str, Any] = Field(..., description="Trigger data")
trigger_data: Any = Field(..., description="Trigger data")
Comment on lines +39 to +41


def _run_kwargs(**overrides):
…tests

Addresses Copilot review:
- runs list now flips to loading state on filter/page change so the
  pager buttons disable and the spinner row renders during in-flight
  refetches; background polling stays silent
- regression tests now exercise RunResponse(trigger_data=...) with
  list/string/int values
@hoootan hoootan merged commit 6c9d124 into main May 2, 2026
4 checks passed
@hoootan hoootan deleted the fix/runs-list-output-and-pagination branch May 2, 2026 08:17
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