Repository navigation
fix(runtime): table rows shaped like a Postgres result keep every column - #359
Conversation
Astra reviewReviewed StandardsP2 · Method: fix the shared success schema instead of adding a route-local replacementRuntimeApi.ts:19-21 introduces a second success-envelope schema while leaving the lossy This is observable data loss, not just duplication. The generated Make the existing shared No merge-blocking YAGNI finding. SpecNo separate intent finding. Issue #320 explicitly permits "a lossless JSON envelope after operation-specific encoding." The raw HTTP path now follows that approach, preserves the wire shape, and leaves operation-specific validation in place. No unrequested functionality found. Verification
Summary: Standards 1 blocker, the shared API decoder still loses row fields; Spec 0 separate blockers. |
|
Reviewed StandardsOne finding.
ADR-0002 decision 1 says every body the server sends on
The union strip is real. Replacing Effect service conventions otherwise hold. Namespace imports, No separate Fowler smell. The duplicated success shape is the ADR finding. The shell needs no matching edit. SpecCompared with issue #320. (a) Missing or partial. The proof is partial. The new test calls (b) Scope creep. None. (c) Implemented but wrong. None found.
MethodThe envelope is the right method for this bug.
Every honest operation response is already JSON after The second walk checks that the value is JSON, so Encoding with
YAGNIThe runtime change is already small. No new type, helper, parameter, or branch. The comment states the constraint: the union matches The test is one collision row through The SummaryStandards: 1 finding, the private success schema beside |
|
Review response, pushed as Fixed:
Kept as is:
|
7d84a29 to
13b39dd
Compare
A row with user columns `ok: true` and `rows` lost its id, timestamps and other columns in the 200 body. Runtime.handler had already encoded it with the operation's own response schema, then RuntimeApi encoded it again through RuntimeSuccess, whose value is a union of every operation's response; the Postgres result struct matched first and stripped the rest. The success body now goes through a lossless envelope that only checks the value is JSON. Per-operation validation stays in Runtime.handler and the wire shape is unchanged. Closes #320 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The previous commit only fixed the server's encode. RuntimeSuccess in packages/api still unioned every operation response, so the generated client's `call` decoded a row with `ok` and `rows` columns as a Postgres result and dropped its id, timestamps and other columns. RuntimeSuccess's value is now Schema.Json, and RuntimeApi encodes through the shared schema again instead of a private envelope. Per-operation validation stays in Runtime.handler. docs/API.md is regenerated. The test now decodes insert, get and update through the real runtime group's client. Co-Authored-By: Claude Opus 5.5 <[email protected]>
60c539b to
0c56d74
Compare
…across versions (#360) Stacked on #359 (branch fix/320-runtime-success-encoding). Omitting a table from a later manifest keeps it in the inventory, but that manifest could still add a file store with the same name (or add a table with an omitted store's name). The publish succeeded and left one name holding both a table and a store, which the product rule forbids. Closes #333. Now, before running any DDL, the provisioner's diff refuses a new store whose name belongs to a table in the inventory, and a new table whose name belongs to a store. It reports this with the existing `not_additive` error and tells the user to pick a different name. The check inside a single manifest is unchanged, and omitted resources are still kept. I also updated the publish route description, `docs/API.md`, `docs/product.md` and the `patchy-tables` project skill. **Test evidence** - New contract test `crossKindNames`, run on Postgres and PGlite. It failed on both before the fix, where version 2 provisioned the store and kept the table. After the fix it passes and shows no DDL and an unchanged inventory. - `Tables.test.ts` 18/18, `pnpm typecheck` and `pnpm lint` clean. - Full `pnpm test`: 947 passed, 1 failed. The failure was `packages/integrations/src/postgres/Runtime.test.ts` hitting its 5s timeout under machine load, which is unrelated to this change. It passes when run alone. Implemented by Claude Opus 5.5 via Claude Code (foreman run orchestrated by Claude Fable 5.1).
Stacked on #357 (branch fix/317-runtime-mutation-deadline).
If a table had user columns named
ok(set totrue) androws,tables.insert,tables.getandtables.updatereturned a 200 without the row'sid, timestamps or other columns. The generated API client'scalldropped them the same way on decode. The stored row was fine, but a tool couldn't use the returned id for its next update or delete. Closes #320.RuntimeSuccessinpackages/apidescribedvalueas a union of every operation's response.RuntimeApiencoded through that union afterRuntime.handlerhad already encoded the value with its own operation's schema, and the client decoded through it. In both steps the Postgres{ ok, rows }struct matched first and dropped the row's other keys.RuntimeSuccess'svalueis nowSchema.Json, and the server and client both use that shared schema. Each operation is still validated inRuntime.handler, and the wire shape is unchanged.docs/API.mdis regenerated, soRuntimeSuccess.valuenow renders asunknown. The endpoint description already lists what each operation returns.Tests:
RuntimeApitest: real per-operationRuntime.handlercodecs fortables.insert,tables.getandtables.updatereturn the ticket's row. The test calls each one through a client built from the realRuntimeGroupand requires the decoded result to keep every column. It failed on the private-envelope commit with onlyokandrowsleft after decode.truefrom a handler that skipsRuntime.handler. It now returns1nand checks that a value that isn't JSON is still a 503source_unavailable.pnpm typecheckandpnpm lintare clean. In a fullpnpm testat load average 8, 7 tests in 4 unrelated files failed: two were confirmed 5s timeouts, and I didn't check the others' reasons. None of the four files goes through this path, and together they pass when run alone (214/214).Implemented by Claude Opus 5.5 via Claude Code (foreman run orchestrated by Claude Fable 5.1).