Skip to content

Commit cd794f6

Browse files
committed
docs: restate the duplicates live condition, the NULL-safe bucket, the legacy-composite rule text and SharingRuleRow for ADR-0131
- cli.mdx / seed-tenancy-repair.mdx: the live condition is the record of which counter minted the duplicates; since the counter refuses an organization-less row on a tenant table wherever the organization object is registered, it no longer forecasts more. - schema.mdx: a tenant table holds no organization-less row wherever the organization object is registered. - unique/legacy-organization-composite: carry that same hedge. - SharingRuleRow: deploymentWide has no sys_sharing_rule column; the interface is no longer a 1-to-1 stored shape. Claude-Session: https://claude.ai/code/session_017ae4eMXWeERGrG6heTbwBX Co-authored-by: Claude <noreply@anthropic.com>
1 parent e21172f commit cd794f6

6 files changed

Lines changed: 25 additions & 15 deletions

File tree

‎content/docs/deployment/cli.mdx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,12 +1797,12 @@ this report reads. Half of what it can tell you does not survive that:
17971797
17981798
| Reported | Survives the repair? |
17991799
| :--- | :--- |
1800-
| **The duplicates themselves** — every value held across two partitions, with the id, organization and creation time of each holder | **Yes.** The repair deliberately refuses to adopt a row whose identifier is already taken in the destination partition, so those rows keep `organization_id = NULL` and stay visible |
1801-
| **The live condition** — an object still running a global counter beside an organization-scoped one, and therefore about to mint more duplicates | **No.** The repair merges the two counters and deletes the global one. Once that has happened, this line can never be produced again |
1800+
| **The duplicates themselves** — every value held across two partitions, with the id, organization and creation time of each holder | **Yes.** The repair deliberately refuses to adopt a row whose identifier is already taken in the destination partition, so those rows keep `organization_id = NULL` and stay findable by this report |
1801+
| **The live condition** — an object still holding a global counter beside an organization-scoped one: the record of which counter minted the duplicates above. Under 17.x it also forecast more; since the counter refuses an organization-less row on a tenant table wherever the organization object is registered, nothing mints from the global counter there | **No.** The repair merges the two counters and deletes the global one. Once that has happened, this line can never be produced again |
18021802
18031803
Running it afterwards is still worth doing — the inventory is what you act on,
1804-
and it is complete either way. What you cannot recover is the forward-looking
1805-
half.
1804+
and it is complete either way. What you cannot recover is the counter
1805+
evidence.
18061806
18071807
A deployment holding **more than one organization** is skipped by that repair
18081808
rather than guessed at: there is no derivable answer to which organization owns

‎content/docs/deployment/seed-tenancy-repair.mdx‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,9 @@ Be precise about what is lost, because the two halves behave differently:
302302
| | Survives the repair? |
303303
| :--- | :--- |
304304
| The inventory of identifiers **already** minted twice | **Yes.** Colliding rows deliberately keep `organization_id = NULL`, so they remain in two partitions and remain findable. |
305-
| The **live condition** — an install still holding a `__global__` counter beside an organization-scoped one, i.e. *about to mint more* | **No.** The repair deletes that counter row. Once it has run, this condition can never be produced again. |
305+
| The **live condition** — an install still holding a `__global__` counter beside an organization-scoped one: the record of which counter minted the duplicates. Under 17.x it also forecast more; since the counter refuses an organization-less row on a tenant table wherever the organization object is registered, nothing mints from that counter there | **No.** The repair deletes that counter row. Once it has run, this condition can never be produced again. |
306306

307-
The live condition is the only forward-looking line in the report, and it is the
308-
perishable one. On a deployment you have not yet restarted since discovering the
307+
The live condition is the perishable line in the report. On a deployment you have not yet restarted since discovering the
309308
problem, run the report first.
310309

311310
`os migrate duplicates` writes no row: it boots read-only, declares itself out

‎content/docs/protocol/objectql/schema.mdx‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,9 +606,13 @@ stays valid indefinitely; `'organization'` is simply the preferred spelling in
606606
new code.
607607

608608
**The organization key part is NULL-safe.** It materializes as
609-
`COALESCE(organization_id, '__global__')`, so rows carrying no organization —
610-
platform rows, and *every* row on a single-organization deployment — form one
611-
platform bucket that is unique among itself. A plain `(organization_id, field)`
609+
`COALESCE(organization_id, '__global__')`, so rows carrying no organization
610+
form one bucket that is unique among itself. Wherever the organization object
611+
is registered, a tenant table holds no such row (ADR-0131: every write is
612+
stamped with its organization — on a single-organization deployment, the
613+
Default Organization); the bucket is for a composition that registers no
614+
organization object, and for residue an uncertified pre-18.x database still
615+
holds. A plain `(organization_id, field)`
612616
composite would enforce nothing on those rows, because SQL `UNIQUE` treats every
613617
`NULL` as distinct. The value stored in the column is still `NULL`; the sentinel
614618
exists only inside the index key, so `WHERE organization_id = '__global__'`

‎packages/lint/src/data-model-rules.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,9 @@ export function lintUniqueDeclarations(objects: any[]): LocatedLintIssue[] {
594594
* UNIQUE is NULL-distinct, so on every row where the organization column is
595595
* NULL it enforces **nothing** (#5030, measured). A 17.x single-organization
596596
* deployment wrote *every* row that way; since ADR-0131 D9 a new row carries its
597-
* organization, so the gap now admits that residue. The `'organization'`
597+
* organization wherever the organization object is registered, so there the gap
598+
* now admits that residue (a composition that registers no organization object
599+
* still writes NULL-organization rows). The `'organization'`
598600
* respelling is what closes the hole: the driver makes the LISTED organization
599601
* column NULL-safe in place (`COALESCE(organization_id, '__global__')`), so the
600602
* NULL rows become one bucket that is unique among themselves.

‎packages/lint/src/rule-explanations.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2695,8 +2695,9 @@ const UNIQUE_LEGACY_ORGANIZATION_COMPOSITE_EXPLANATION: RuleExplanation = {
26952695
'predates the scope vocabulary (ADR-0120 S6). It reads as "unique per organization" but ' +
26962696
'materializes as a plain composite, and SQL UNIQUE is NULL-distinct: it enforces nothing on a ' +
26972697
'row whose organization column is NULL — every row a 17.x single-organization deployment ' +
2698-
'wrote. Since ADR-0131 D9 a new row carries its organization, so what the gap still admits is ' +
2699-
'that residue.',
2698+
'wrote. Since ADR-0131 D9 a new row carries its organization wherever the organization object ' +
2699+
'is registered, so what the gap still admits there is that residue; a composition that ' +
2700+
'registers no organization object still writes rows whose organization column is NULL.',
27002701
'Respelled `unique: \'organization\'`, the NULL rows become one bucket ' +
27012702
'(`COALESCE(organization_id, \'__global__\')`) that is unique among themselves, which is what ' +
27022703
'closes the hole. The respelling keeps `fields` exactly as they are: the driver makes the listed ' +

‎packages/spec/src/contracts/sharing-service.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,12 @@ export interface ISharingService {
475475
export type SharingRuleRecipientType = 'user' | 'team' | 'business_unit' | 'position' | 'unit_and_subordinates' | 'queue' | 'field';
476476

477477
/**
478-
* Stored shape of a sharing rule. Maps 1-to-1 to `sys_sharing_rule`
479-
* with `criteria` lifted out of the JSON column.
478+
* A sharing rule as the service serves it: a stored `sys_sharing_rule` row
479+
* (`criteria` lifted out of the JSON column), or a DECLARED rule's
480+
* projection. Every member but one maps to a `sys_sharing_rule` column;
481+
* {@link SharingRuleRow.deploymentWide} has no column there — it marks a
482+
* declared rule's deployment-wide projection and is absent on every stored
483+
* row.
480484
*/
481485
export interface SharingRuleRow {
482486
id: string;

0 commit comments

Comments
 (0)