Repository navigation
Description
Problem
Successful table operations can omit the generated row ID, timestamps and user columns from their HTTP 200 response. Legal user columns named ok and rows cause the generic runtime response encoder to select an unrelated Postgres result shape. Stored data remains intact.
Reproduction
At ef3e790, provision a table with ok:boolean, rows:json and title:text. Insert:
{"ok":true,"rows":[{"label":"ordinary nested value"}],"title":"Snapshot label"}The operation-specific encoder produces the complete row. RuntimeApi returns only the matched Postgres-result fields, for example:
{"ok":true,"value":{"ok":true,"rows":[{"label":"ordinary nested value"}]}}With an optional cursor column, cursor is retained too; it is not required to trigger the bug.
Independently exercised actual RuntimeApi HTTP serialization with real TableOperations, provisioning and PGlite, capturing raw response text. Proven affected operations: tables.insert, tables.get and tables.update. The same rows remain complete through tables.list, tables.getMany and tables.insertMany. Fourteen controls narrow the trigger to ok:true plus rows containing records or nulls; ok:false and nonmatching JSON shapes preserve the row. This is in-process HTTP-adapter proof, not browser/network end-to-end.
Minimal encoder reproduction, using the two actual codecs in that path:
import * as Schema from "effect/Schema";
import { RuntimeSuccess, runtimeOperations } from "./packages/api/src/runtime.ts";
const inserted = { id: "row-1", createdAt: "2026-09-21T00:00:00Z", updatedAt: "2026-09-21T00:00:00Z", ok: true, rows: [{ label: "ordinary nested value" }], cursor: null, title: "kept in storage" };
const operationValue = Schema.encodeSync(runtimeOperations["tables.insert"].response)(inserted);
const wireValue = Schema.encodeSync(RuntimeSuccess)({ ok: true, value: operationValue });
console.log(JSON.stringify({ operationValue, wireValue, lostKeys: Object.keys(operationValue).filter(key => !(key in wireValue.value)) }, null, 2));Save at the repo root and run node --import tsx --conditions=development runtime-response-probe.ts. lostKeys includes id, createdAt, updatedAt and title.
Cause and proposed scope
RuntimeSuccess unions all operation response schemas. Runtime.handler has already encoded against the selected operation, but RuntimeApi encodes it again through this overlapping union. A table row matching a Postgres Struct loses extra keys.
Keep the selected operation codec through serialization, or use a lossless JSON envelope after operation-specific encoding. Preserve per-operation validation and the current wire shape. Reordering the union only moves the ambiguity.
A tool storing ordinary response snapshots cannot reliably use the returned row ID for its next update/delete. This is response data loss, not observed storage loss.
Found and independently reproduced by separate GPT-6 Astra agents in Oh My Pi. Ordinary offline product testing only.
Activity
fix(runtime): table rows shaped like a Postgres result keep every column
fix(runtime): table rows shaped like a Postgres result keep every col…