Skip to content

Decide: the daemon/UI data contract #56

Description

@aksOps

Question

What exactly does the daemon serve to the browser, and in what shape?

  • Endpoint style: a small set of purpose-built REST endpoints, or one general query endpoint the UI parameterises.
  • Payload shapes: reuse internal/report's existing JSON shapes, or define UI-specific ones. Reuse means one definition and one place to keep honest; divergence means the UI is not constrained by what a CLI table needed. Note that the report JSON contract was only just made honest for machine consumers (raw ledger values, provider_label carrying the human string) - whatever is chosen must not undo that.
  • Where aggregation happens: SQL, Go, or the browser. This decides whether the wire carries buckets or events, and it is the single biggest lever on both payload size and perceived speed.
  • Pagination and limits for anything event-shaped, and what the server does when a range would return an unreasonable number of rows.
  • Error and empty-state semantics: what a request gets when the ledger is empty, when a range holds only unpriced rows, and when the daemon is mid-cycle.
  • The WebSocket message format, its endpoint path, and whether the socket is versioned alongside the REST surface. The mechanism is decided (Decide: live-update posture #57); the wire shape is not. It carries a change notification, never data.
  • Whether the contract is versioned, and what happens to an old page held in a browser tab after the binary is upgraded underneath it - the daemon now restarts itself into a new build without being asked.

Hard constraint, not negotiable: no endpoint may return raw. There is no authentication in front of these hostnames (#58), and 45,615 rows predate the usage-object-only allow-list and hold whole transcript lines. ListEvents hardcodes COALESCE(raw,'') today, so anything event-shaped needs explicit column projection before it exists.

Deliverable: a specified contract - endpoints, shapes, and the aggregation boundary - that execution can be written against.


Part of #51

Blocked by: #55, #59

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions