Skip to content

Commit ea530cf

Browse files
committed
chore(changeset): metadata-protocol OCC conflict caller visibility
Claude-Session: https://claude.ai/code/session_01YNquHRZKDpiKsgmHXSd9Jx Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2fea52d commit ea530cf

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
---
4+
5+
fix(metadata-protocol): an optimistic-concurrency conflict reports only what the caller may read
6+
7+
Clause-②: no
8+
9+
`updateData` and `deleteData` judge a caller's version token (`If-Match`, or the body/query `expectedVersion`) on the row their existence probe reads with a system context. On a mismatch they used to answer `409 CONCURRENT_UPDATE` with that system-read row as `currentRecord`, before the caller's row- and field-level security had run.
10+
11+
Now a mismatch re-reads the row under the caller's own context, and only then answers:
12+
13+
- **A row the caller cannot read:** `404 RECORD_NOT_FOUND`, the same answer the same request without a version token gets. It carries no `currentVersion` and no `currentRecord`.
14+
- **A row the caller can read:** `409 CONCURRENT_UPDATE` as before, with `currentRecord` read as the caller reads it, so a field hidden from the caller is absent from it. `currentVersion` is unchanged.
15+
16+
A request whose token matches, or that sends none, is unchanged and issues no extra read. Every door that renders the protocol's answer (`RestServer`, the runtime dispatcher's `/data` domain and the Hono hosts) gets the narrowed answer.

0 commit comments

Comments
 (0)