Commit 9f423dc
fix(objectql): validate declared required organization_id/tenant_id (provenance, not name) (#1592)
`validateRecord` SKIP_FIELDS skipped required-checks for any field literally
named `organization_id`/`tenant_id`. That's correct only for the engine-INJECTED
tenant column (marked `system: true`, already skipped by the `def.system ||
def.readonly` provenance check). A genuinely DECLARED required business field
with that name — `sys_team.organization_id` (a `managedBy: 'better-auth'` table
where the column is NOT injected) — was silently bypassed → reached the driver
as NULL (SQLITE NOT NULL constraint instead of a clean `400 { organization_id,
required }`).
Fix: drop `organization_id`/`tenant_id` from the by-name SKIP_FIELDS set;
injected system columns stay skipped via provenance (`def.system`/`def.readonly`).
Regression test (declared required org_id/tenant_id now 400s; injected
system org_id still skipped). objectql suite 616 pass.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent d13df3f commit 9f423dc
3 files changed
Lines changed: 65 additions & 2 deletions
File tree
- .changeset
- packages/objectql/src/validation
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
33 | 42 | | |
34 | 43 | | |
35 | | - | |
36 | 44 | | |
37 | 45 | | |
38 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
0 commit comments