Commit e2debee
* fix(metadata-protocol): compare OCC version tokens as instants, not spellings (#13382)
On Postgres — the production default driver — every guarded save answered
409 CONCURRENT_UPDATE, including on records nobody had ever touched. The OCC
gate read `updated_at` through `String(v)`; on a Date-returning driver that is
`Sun Aug 30 2026 18:19:25 GMT+0800 (China Standard Time)` — milliseconds
dropped, process timezone baked in — compared as a string against the
`2026-08-30T10:19:25.947Z` the client echoed back from its own GET. One
instant, two spellings. SQLite returns canonical ISO text, so both sides
matched by accident and development environments stayed green.
Both tokens are now normalised to one representation — a canonical absolute
instant — before comparison, and the `currentVersion` a 409 publishes is that
same canonical instant: what the wire format documents, and the token the
conflict dialog echoes back as its next If-Match.
Strictly widening: when either side is not an instant the verbatim comparison
still runs, so no token accepted before is refused now.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F3jdziLbAPGeceVNmSox5L
* chore: record the new OCC engine double in the pinned ledger (#13382)
`check:engine-double-contract` retains a pin per (file, verb). The regression
suite added for #13382 carries a fake engine whose delete/update/findOne route
through the producer's own dispatch predicates, so the ledger has to learn
about it or it never protects the file. `--write`, 3 rows added, 0 lost.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F3jdziLbAPGeceVNmSox5L
* docs(permissions): re-anchor the isSystem census row onto the shifted line (#13382)
`content/docs/permissions/system-context.mdx` anchors elevation reads by line
number. The OCC fix added 158 lines above `stripReadonlyForInsert`, so row 21's
anchor into metadata-protocol rotted: the census found an unanchored read at
:1566 and an anchor at :1451 that is no longer a read site.
A PURE SHIFT, verified before repairing rather than assumed — the gate refuses
to guess a population change and rewrites only line rot: base :1451 and head
:1566 are the byte-identical `if (context?.isSystem) return data;` (sha256
db885f75…), the `isSystem` occurrence count in the file is 9 on both trees, and
:1566 is the first line of `stripReadonlyForInsert`, which is exactly what row
21 describes. Repaired with the gate's own `--fix`; one anchor rewritten, no
prose touched, nothing baselined or exempted.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F3jdziLbAPGeceVNmSox5L
* fix(metadata-protocol): keep an empty If-Match entity-tag opting OUT of OCC (#13382)
Contract review caught a regression this PR introduced. `If-Match: ""` is empty
only AFTER the RFC-7232 quotes come off, and the pre-fix seam returned the bare
string, so that case handed every caller the falsy `''` and they short-circuited
into "no token supplied". Wrapping the result in an object made it always
truthy, so the check began running and `''` mismatched verbatim: an
accept-to-refuse flip on a shipped API, falsifying this PR's own strictly-
widening claim.
Remedy is the conservative one — re-apply the emptiness test after the strip, so
the behaviour is byte-identical to `70fe54891e`. Whether an empty entity-tag
SHOULD be able to disable OCC is a contract question, filed separately; a p1
bug-fix PR does not silently install a new rejection.
The claim is no longer left as prose. A new block sweeps a corpus of 8 stored
shapes x 15 client tokens against the pre-fix comparison reproduced verbatim and
fails on any pair that was accepted before and is refused now. Run against the
unfixed tree it reports exactly the 5 `""` pairs and nothing else, so the review
finding was the whole regression rather than one instance of a class.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01F3jdziLbAPGeceVNmSox5L
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 09b0d7b commit e2debee
5 files changed
Lines changed: 674 additions & 14 deletions
File tree
- .changeset
- content/docs/permissions
- packages/metadata-protocol/src
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| |||
0 commit comments