Skip to content

refactor: add explicit dashboard read model - #284

Merged
ecarreras merged 1 commit into
fix/issue-260-explicit-migrationsfrom
feat/issue-260-dashboard-queries
Oct 8, 2026
Merged

ecarreras merged 1 commit into
fix/issue-260-explicit-migrationsfrom
feat/issue-260-dashboard-queries

Conversation

@giscebot

@giscebot giscebot commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • add DashboardQueries as the read-only persistence boundary consumed by FastAPI handlers, CLI job/status commands, monitoring, and session streaming
  • replace generic {column: value} SQL composition with typed, allowlisted JobListFilters
  • remove normal-path table_exists() / column_exists() compatibility branches now that migration history is validated explicitly
  • preserve the single-statement job listing and indexed dashboard ordering
  • collapse per-running-job worklog/progress lookups into one denormalized status query
  • add architecture, injection-boundary, and query-count regression tests

Stack

Depends on #283, which makes migration validation explicit and non-mutating. This PR intentionally targets fix/issue-260-explicit-migrations; after #283 merges, its base can be retargeted to main without changing this diff.

Validation

  • pytest -q — 535 passed, 1 pre-existing Starlette/httpx deprecation warning
  • job list executes exactly one read statement
  • existing EXPLAIN QUERY PLAN regression still proves idx_jobs_dashboard_order is used without a temporary ORDER BY B-tree
  • architecture test prevents SQL execution from reappearing in FastAPI handlers, CLI commands, or monitor orchestration

Risk

The read model now assumes the current migrated schema. Health/status reports schema_ok=false for missing or pending migration history; normal queries no longer guess around partial schemas. Public module-level query functions remain as compatibility shims for Python callers.

Requested by: @ecarreras

Related to #260

@ecarreras
ecarreras added this pull request to stack #290 October 8, 2026 10:23
@ecarreras
ecarreras requested a review from pilipilisbot October 8, 2026 10:24

@pilipilisbot pilipilisbot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the dashboard read model refactor against the persistence/read-only contracts. The split to DashboardQueries keeps HTTP/CLI/monitor orchestration off raw SQL, JobListFilters binds values through an allowlisted filter shape, and status/health now reports migration problems without creating or mutating the DB.

Checked the changed backend/CLI/monitor call sites, dashboard_data query paths, schema assumptions, and the new regression tests. Local validation from a dedicated clean worktree:

  • pytest -q tests/test_dashboard_queries.py tests/test_backend.py -k 'dashboard or job_list or jobs_can_filter or order_index' -> 76 passed, 1 deselected, 1 known Starlette/httpx warning
  • pytest -q -> 529 passed, 1 known Starlette/httpx warning

No blocking findings from my review.

@ecarreras

Copy link
Copy Markdown
Member

@giscebot resol els conflictes

Co-authored-by: ecarreras <ecarreras@users.noreply.github.com>
@giscebot
giscebot force-pushed the feat/issue-260-dashboard-queries branch from b7d39b4 to 0eaae6c Compare October 8, 2026 13:08
@giscebot

giscebot commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Conflictes resolts al commit 0eaae6c.

He rebasat el commit del read model sobre la base actual fix/issue-260-explicit-migrations (9841f33). L'únic conflicte era a docs/persistence.md; la resolució conserva tant la documentació nova de DashboardQueries com les garanties més recents de retry i drenatge acotat del subprocess.

Validació:

  • pytest -q: 535 passed
  • CI: dashboard, Python 3.11 i Python 3.12 en verd
  • GitHub marca el PR com a MERGEABLE

També he actualitzat el recompte de tests de la descripció del PR.

@ecarreras
ecarreras merged commit eb159d9 into main Oct 8, 2026
3 checks passed
@ecarreras
ecarreras deleted the feat/issue-260-dashboard-queries branch October 8, 2026 14:58
@pilipilisbot

Copy link
Copy Markdown
Collaborator

Post-merge sync completed for #284.

Verified PR state: MERGED at merge commit eb159d95e07d8c1474598af3ed3f727953398b55.

Workspace cleanup:

  • Removed clean dedicated worktree: /home/openclaw/projects/gisce-ti/worktrees/github-agent-bridge-pr-284
  • Ran git worktree prune
  • Re-scanned worktrees for PR 284, head branch feat/issue-260-dashboard-queries, head SHA 0eaae6cb15ce27104ec6183445324d2646e28d26, and old local SHA b7d39b4edaa793faac28d1697df22dbca02ddd69; no matching worktree remains.

No code changes were made.

@giscebot

giscebot commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Post-merge cleanup correction: the dedicated PR worktree was still present at (the earlier scan only checked the naming). It was clean, the remote branch was already gone, and it has now been removed and pruned. The merged commit remains ; no repository code or PR metadata was changed.

@giscebot

giscebot commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Correction to the cleanup note above: the dedicated PR worktree was still present at /home/openclaw/projects/gisce-ti/worktrees/github-agent-bridge-issue-260-dashboard-queries (the earlier scan only checked the pr-284 naming). It was clean, the remote branch was already gone, and it has now been removed and pruned. The merged commit remains eb159d9; no repository code or PR metadata was changed.

@giscebot

giscebot commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Verificació post-merge feta sobre el merge exacte eb159d9:

  • el range-diff entre el commit aprovat i el commit fusionat confirma que el rebase només va conservar a docs/persistence.md la garantia nova sobre els events de sessió; el patch del read model no va canviar
  • eb159d9 ja és ancestre d’origin/main
  • PYTHONDONTWRITEBYTECODE=1 python3 -m pytest -q -p no:cacheprovider: 535 passed, 1 warning conegut de Starlette/httpx

L’aprovació anterior continua sent vàlida i no cal cap acció addicional.

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.

3 participants