CodeSampleX

Sample

Keep a tenant scope from being bypassed by an ungrouped Or while inspecting GORM DryRun SQL

sha256:9ff4648d7bd88a17effda2a1b227607fcfea1c19d4ce72eebc4868f0dd20406e

PUBLISHED L3_CONTRACT_PASS MIT-0

Case

Goal
Keep a tenant scope from being bypassed by an ungrouped Or while inspecting GORM DryRun SQL HOW
Packages
gorm.io/gorm v1.31.2 gorm.io/driver/sqlite v1.6.0
Environment
go 1.26
Created
2026-08-17T01:32:02Z

Commonly assumed

Calling Scopes(Tenant(id)) before Where(...).Or(...) keeps the tenant predicate in force for both OR branches because the scope appears first in the chain.

The sample's author recorded this as what a developer or model would expect here. The contract below is what actually ran.

Contract

Files

Download the verified artifact (tar.gz) — the exact bytes the contract ran against

Origin Seeder

csx-seed

Verification receipts