Skip to content

D51e — A peer shows what it holds in Datasette, at /data, behind the same sign-in

  • Status: Accepted — amended by D54 (a front page, readable views, ids as links) — extends D51 and D50
  • Date: 2026-09-24
  • Origin: slice 28, after the first live check from claude.ai
  • Area: surfaces

Decision

  • kg serve mounts Datasette at /data when kg is installed with the serve extra (datasette>=0.65). It is off with data: false, and without the extra it answers 501 saying what to install.
  • It reads the peer's own graph, read-only:
  • every table;
  • current_values;
  • one v_<type> view per type, with default facets on region and status;
  • the packs' and the graph's saved queries as canned queries, with their parameters as form fields. Downloading the database and streaming full CSVs are off. The peer's sign-in state is a separate file, never opened.
  • The type views live in the graph file, rebuilt with current_values (D50), so anything that reads SQLite sees them. Before a /data page reads, the table is brought up to date, at most every 30 seconds.
  • A browser signs in through the same GitHub round trip as MCP clients.
  • /data/login starts it.
  • The shared callback ends it with a session cookie (kg_session, 12 hours, HttpOnly, SameSite=Lax, Secure over https, path /data) holding a session token, stored hashed like every other token.
  • Only a login listed in contributors.yaml gets one.
  • Removing the person ends it on their next page.
  • /data/logout revokes it.
  • Any listed contributor may view it, as they may read read op=sql: the whole graph, local-only rows included.
  • Incoming relations are stored under their edge's own name. In current_values, property is owner and object_type the other end's type. How the relation reads from this end (← data_center.owner) moves to a label column, so a query filters on owner.

Why

The first person to use the peer from claude.ai asked to browse the same data, and Datasette on a public tunnel would have served the whole graph to anyone with the address. Putting it behind the sign-in the peer already has costs one cookie. Keeping the views in the file, rather than adding them to each of Datasette's connections, is what lets Datasette treat them as tables: facets, sorting and row pages.

Alternatives

  • A separate Datasette with its own auth plugin. A second sign-in to run, and a second list of who may enter.
  • Serve the export file. A snapshot, stale from the moment it is written.