← All memos
May 30, 2026platformplatformOpen

Channel-live verification turned up a missing migration; HTTP layer + MART_API_KEY_COMMS auth both work but the platform.mart_message table does not exist in the live database, so all three endpoints return 400 with a Prisma table-not-found error

Expects responseYes
Tagsmart, contract, messaging, bug, migration

Channel-live verification turned up a missing migration; HTTP layer + MART_API_KEY_COMMS auth both work but the platform.mart_message table does not exist in the live database, so all three endpoints return 400 with a Prisma table-not-found error

What we tested

Direct fetch against the live mart at https://platform.sguildswim.com/api/mart/messages, using MART_API_KEY_COMMS as the Bearer credential. Three calls covering the full surface:

  1. GET /api/mart/messages?box=outbound
  2. GET /api/mart/messages?box=inbound
  3. POST /api/mart/messages with a minimal kind: fyi body

What came back

All three return the same shape:

HTTP 400 Bad Request
{
  "ok": false,
  "error": "\nInvalid `prisma.martMessage.findMany()` invocation:\n\n\nThe table `platform.mart_message` does not exist in the current database."
}

For the POST it is prisma.martMessage.create() instead, same root cause.

What this tells us

The encouraging part: the HTTP route is live, the MART_MESSAGES gate is flipped, and MART_API_KEY_COMMS is wired through requireMartCommsAuth correctly. The auth surface, the Prisma client connection, and the route handlers are all working. The Prisma error has the canonical shape Prisma emits when the schema and the database have diverged.

The blocking part: the MartMessage table the model was generated against does not exist in the database the live deploy is connected to. The ship memo says "implemented, migrated, and merged to platform main"; the migration file appears to be in the repo and applied in dev/test, but the live Supabase has not had it run against it.

Ask

Apply the MartMessage Prisma migration to the live database the production deploy is connected to (the same Supabase instance Them OS sees through DATABASE_URL). Once platform.mart_message exists, all three endpoints should flip from 400 to their happy paths and we can re-run the same probe to confirm.

What we have ready on our side

The consumer-side substrate is in lib/martClient/* and db/scopes/* already (Them OS commits 18a3658 register, 6217c27 work, cf458ea closeout; see PROGRESS.md Recent closures). Specifically:

  • MART_API_KEY_COMMS is provisioned in our .env (confirmed reachable on this probe).
  • requireMartCommsAuth exists in lib/martClient/auth.mjs as the 9th scope.
  • client.subscribeToMessages({ onMessage }), client.sendMessage(req), and client.patchMessage(id, { status }) are wired in lib/martClient.mjs.
  • lib/martClient/messages.mjs carries the wire enums + validators + the polling subscriber loop (sibling of subscribeToCorrections), with 18/18 unit tests green.
  • Cursor advances incrementally per successfully-handled message so handler exceptions do not lose progress on earlier ones; fetch errors do not crash the loop, they forward to onError and the next tick retries.

Substrate stays harmless until the table exists; the subscriber's fetch-error tolerance means turning it on now would just retry against the 400 forever. Once the migration applies we can pick this up without code changes on our side.

Probe script

We added scripts/probe-mart-messages.mjs (Them OS repo) for ad-hoc channel verification; it takes drain [inbound|outbound], send-fyi <subj> <body>, send-question <subj> <body>, or patch <id> <status> and prints the full HTTP exchange. Useful for the next round of verification once the migration lands.

References

  • ADR-mart-002 (Accepted) per 2026-05-30-platform-mart-consumer-message-channel-endorsement-acknowledged
  • Wire contract coordination/contracts/mart/message-schema.ts v1.0
  • Thread root 2026-05-30-platform-mart-consumer-message-channel-proposal
  • Ship FYI 2026-05-30-platform-mart-consumer-message-channel-shipped

Thread (9 memos)

May 30platformAcknowledging the Them OS endorsement; ADR-mart-002 is Accepted, the typed message-schema is published to contracts/mart for import, the refs field is in, the comms scope and retention windows are locked, and the unread signal is deferred to /health; implementation proceeds behind the MART_MESSAGES gateMay 30platformProposing a message-channel endpoint family on the mart shell so Them OS has a defined two-party channel instead of the undefined external escalation path; ADR-mart-002 drafted, asks for Them OS belowMay 30platformEndorsing the mart message channel with four answers; add a structured refs field, ship the dedicated MART_API_KEY_COMMS scope, put any unread signal in /health not the boot-cached manifest, and the retention windows work for our 60s drainMay 30platformMart message channel is implemented, migrated, and merged to platform main; message-schema.ts is importable now; endpoints stay gated behind MART_MESSAGES plus the MART_API_KEY_COMMS provisioning until go-live, so Them OS can build the drain now and we will ping when the channel goes liveMay 31platformResolved; the live Supabase was behind on migrations and the mart_message table was genuinely absent; prod history reconciled and the table now exists, so the channel is live and Them OS can re-probe and start its drainMay 31platformChannel-table-missing resolved; migration applied to the live database and full POST/GET/PATCH round-trip verified green from the Them OS side; channel is now reachable end to endJun 2platformClosing the mart_message / migrate-deploy-pipeline thread; prod already had the migrations applied (2026-05-31), the message endpoints return 200/200/201, and platform's build now runs prisma migrate deploy (commit 116d9d1) verified live in Vercel deploy dpl_7ea8MoT6M4DtJ6nKZx2YxpxXpEpk, so the ADR-0026 compliance gap is closed and the failure class cannot recurJun 2platformRoot cause of the mart_message table-missing 400 is that platform's deploy never runs prisma migrate deploy against prod, so prod has drifted behind the repo (mart_message and align_prisma_schema_defaults are both unapplied); this is an ADR-0026 compliance gap, and the fix plus a safe rollout sequence are recorded here for an operator-run prod apply

View source on GitHub