You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
POST /api/packets INSERTs on the server's read-only handle and always returns 500 #223
handlePostPacket (cmd/server/routes.go, POST /api/packets, behind requireAPIKey) writes transmissions, observers and observations through s.db.conn. The server opens that handle with mode=ro (Kpa-clawbot#1283).
In production every call fails with attempt to write a readonly database and returns 500, with the raw SQLite error text in the response.
Route tests pass only because they run against a writable test DB.
The handler also inserts without a by-hash lookup, so a repeated packet would violate transmissions.hash UNIQUE even on a writable DB.
This was confirmed in the #222 review with a probe: OpenDB (mode=ro) plus a POST with a valid key returns 500, and the DB stays unchanged. In practice the endpoint has been dead since the read/write split.
Options
(a) Hand the packet to the ingestor so the write happens where all writes live, e.g. via a queue or command table, or by republishing it over MQTT.
(b) Remove the endpoint and its OpenAPI entry, if nothing uses it.
In both cases:
remove routes.go from knownServerWriteSQL;
extend TestServerHasNoPacketTableWrites to forbid INSERT everywhere in cmd/server;
add a test that POSTs against an OpenDB (mode=ro) store.
Acceptance
No write SQL left in cmd/server outside the documented exceptions (ping_score_history.go, backup.go).
The endpoint either works through the ingestor or is removed, and the OpenAPI spec matches.
POST /api/packets and its handler, helpers, OpenAPI entry, docs, proto and tool references are removed. PayloadJSON in cmd/server is removed too. One unified guard now forbids INSERT, UPDATE, DELETE and REPLACE on the packet tables everywhere in cmd/server, and an OpenAPI orphan-description test was added.
Note: in production wiring, POST /api/packets now falls through to the SPA catch-all (200 index.html). That is tracked in #233.
Activity
Merge remote-tracking branch 'origin/master' into codex/issue-223-rem…
test(server): one packet-table write guard; drop dead PayloadJSON (#231…
Merge pull request #231 from dborup/codex/issue-223-remove-post-packets
dborup commentedon Oct 5, 2026
Fixed by #231 (merged as
2a7877ac).POST /api/packetsand its handler, helpers, OpenAPI entry, docs, proto and tool references are removed.PayloadJSONincmd/serveris removed too. One unified guard now forbids INSERT, UPDATE, DELETE and REPLACE on the packet tables everywhere incmd/server, and an OpenAPI orphan-description test was added.Note: in production wiring,
POST /api/packetsnow falls through to the SPA catch-all (200index.html). That is tracked in #233.