Skip to content

webui-rs 2/6: Port the read model — ClickHouse queries + typed rows in Rust, parity-tested against the FastAPI responses #27

Description

@GeorgePearse

Depends on #26.

Port the data layer of genesis/webui/backend_server.py (~707 lines) to the Rust service. Current endpoints to cover:

  • GET /api/experiments — run list
  • GET /api/experiments/{run_id}/programs — population for a run
  • GET /api/experiments/{run_id}/programs/{program_id} — program detail (code, metrics, parent/inspirations)
  • GET /api/experiments/{run_id}/stats — per-generation aggregates (feeds the fitness/novelty charts)
  • GET /api/experiments/{run_id}/lineage — parent-edge graph (feeds the lineage tree)
  • GET /api/database/info

Notes

  • Use the clickhouse crate with typed row structs. Watch the usual clickhouse-rs typed gotchas (nullable columns, (U)Int width mismatches fail at deserialize time, not compile time).
  • Parity test: golden-file comparison — run both backends against the same ClickHouse instance and diff JSON responses per endpoint. Keep the test around until cutover (webui-rs 6/6: Server-rendered SVG lineage tree + cutover (delete webui/frontend and backend_server.py) #31).
  • Decide and document: the legacy sqlite db_path mode (/list_databases, /get_programs) — port it or explicitly drop it. If ClickHouse has been the real store since the CLICKHOUSE_INTEGRATION work, dropping legacy sqlite in the rewrite is the simpler call; record it in the issue when decided.

These land as internal query functions returning typed structs; whether they stay exposed as JSON routes or become fragment-renderers only is settled by #28 (fragments are the product — JSON routes are only needed if something else consumes them).


Update 2026-08-05 (#32): the read model targets Turso embedded (in-process, turso crate), not the clickhouse crate — land the #32 spike first, then port these queries against the Turso schema. The golden-file parity idea survives: same data loaded into both stores, diff the responses. The legacy-sqlite question is resolved by #32 (superseded).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions