Skip to content

Explore pgrust and pgrust-wasm (agent-board follow-up) #73

Description

@alycda

Context

The Ditto worktree container's fire-and-review agent board is backed by pgrust (v0.2, AGPL-3.0) — an experimental Postgres rewrite in Rust that is wire-compatible with Postgres 18.3 and passes the full 46k regression suite, but is explicitly not production-ready. That's acceptable there because board data is recoverable state (rebuildable from .pid/.out files and PR state). The seam is a tb-ticket CLI speaking the Postgres wire protocol via psql, so the backend swaps to real Postgres with env vars (TB_PG*).

Setup learnings worth keeping (currently encoded in the container's board.just):

  • The published linux-aarch64 binary targets Debian/Ubuntu; on a Nix-based container it needs patchelf --set-interpreter/--set-rpath to nix's glibc + libstdc++.
  • Postgres tooling refuses root; in the root-only dev container the server runs as nobody via setpriv --reuid=65534 (user namespaces are seccomp-blocked; plain setuid is not).
  • pgrust ships no initdb/psql — client tools come from nix shell nixpkgs#postgresql_18, with PGRUST_PGSHAREDIR/PGRUST_TZDIR pointed at nix store paths.

Exploration goals

  1. pgrust natively: kick the tires beyond the board — perf claims (vectorized/JIT executor, ClickBench), behavior under the kind of concurrent small writes the board does, failure modes. Decide whether it stays the board backend or gets swapped for boring Postgres/SQLite.
  2. pgrust-wasm: the repo ships its browser build in-tree (wasm/build.sh, WASI target via pgrust-wasi.js, REPL page, pack-vfs.mjs VFS packer). Build it with a nix-provided Rust + wasm32-wasi toolchain and understand the pipeline.
  3. Snapshot-shipping board UI (maybe): a browser-resident pgrust is a separate engine with its own VFS — it cannot connect to the native server's socket or data dir. The only coherent web-UI design is: dump the tickets table at render time, load the dump into wasm-pgrust in the page, query interactively. For a ~12-row board this fails the needs-vs-wants test (the static board.html render is the right shape), so this track is play/evaluation of pgrust-wasm itself, not a board requirement.
  4. Harden the dev image (related): bake a pgrust user + postgresql client tools into the Dockerfile so the setpriv dance and nix-summoning disappear.

References

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