Skip to content

data: PATCH/DELETE of a nonexistent record answer 200 success instead of RECORD_NOT_FOUND #4435

Description

@baozhoutao

Found while verifying the 17.0.0-rc.1 checklist on #3909 (F3, the "silent drops became refusals" axis). Verified on main @ 1ee48bc60, showcase under os serve --dev, admin session.

The read path already answers honestly, but both single-record write paths report success for a record that does not exist:

GET    /api/v1/data/showcase_task/definitely_not_a_row
→ 404 {"error":"Record … not found in showcase_task","code":"RECORD_NOT_FOUND",…}   ✅

PATCH  /api/v1/data/showcase_task/definitely_not_a_row   {"progress":1}
→ 200 {"object":"showcase_task","id":"definitely_not_a_row","record":null}          ❌

DELETE /api/v1/data/showcase_task/definitely_not_a_row
→ 200 {"object":"showcase_task","id":"definitely_not_a_row","success":true}         ❌

The REST layer is a pass-through (rest-server.ts DELETE handler res.json(await p.deleteData(...))), so the 200s come from the metadata-protocol's update/delete answering success on a zero-row match.

Why this matters beyond symmetry:

Expected: PATCH/DELETE of a nonexistent id answer 404 RECORD_NOT_FOUND exactly as GET does (and a DELETE that does delete answers the declared deleted key). If idempotent-DELETE-200 is a deliberate posture, it should at least say deleted: false — but then PATCH, which has no idempotency story, still needs the 404.

Part of the #3909 rc.1 verification (section F3).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions