Skip to content

contract 1.18: scope the supersession lock and pin near-tie ranking (story 28.1) - #218

Merged
fabbrik merged 4 commits into
mainfrom
fix/28-1-scoped-lock
Oct 30, 2026
Merged

fabbrik merged 4 commits into
mainfrom
fix/28-1-scoped-lock

Conversation

@fabbrik

@fabbrik fabbrik commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Rest of story 28.1 (part 1 was #214).

  • Scoped supersession lock. The lifecycle's lock-supersession-rows locked a replacement row by ID with no scope predicate, so with row-level security off a caller naming another tenant's record took a row lock on it. .NET now locks only rows in the caller's exact scope (IS NOT DISTINCT FROM for optional fields); outcomes are unchanged. Contract 1.18 publishes the scoped statement (sql/lifecycle-1.18.sql), add-only; Python and Go switch to it. Lock tests in all three languages fail on the old statement and pass on the new, including the in-scope and NULL-scope cases, using lock_timeout, no sleeps.
  • Near-tie ranking fixture (retrieval-policy/ranking-near-tie): two pairs 1 ulp apart. It found two Go divergences: math.Pow misrounding and arm64 FMA fusion. Go now uses a correctly rounded exp2 (checked against a 320-bit math/big reference) and unfused products. Python already matched. 1.18 pins only the fixture's inputs: libm pow misrounds about 1 in 1,500 inputs, so rare near-ties can still order differently; quantized tie-breaking is logged as follow-up.

Tests: Storage.Postgres 933/933 default and RLS; contract 102/102 with both cross-language tests; Python 1777 passed, mypy strict; Go vet, staticcheck, race in all modules and the postgres legs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GPXz56QPQAzDSyJTxbQTTy

fabbrik and others added 4 commits October 30, 2026 16:55
…anking-near-tie pins near-tied order to the bit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GPXz56QPQAzDSyJTxbQTTy
…th a correctly rounded exp2 and unfused products

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GPXz56QPQAzDSyJTxbQTTy
…unds subnormals once, checked against a math/big reference; lock tests prove the in-scope wait, NULL scope fields included

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GPXz56QPQAzDSyJTxbQTTy
@fabbrik
fabbrik merged commit 30a2c1e into main Oct 30, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant