You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e3190b9
Browse filesBrowse the repository at this point in the historyBrowse files
fix(organizations)!: retire claimOrphanOrgRows — the first organization no longer adopts organization-less rows (#25246)
Fixes#25204
Clause-②: no (narrowing)
Metadata-protocol: none
The build of decision A (retire) on #25204, from the measurement
os-dev-report 6342754850 and the seat's decision 6342853688.
## What changes
- **`claimOrphanOrgRows` is retired.**
`packages/plugins/organizations/src/claim-orphan-org-rows.ts` and its
test (8 mock-engine cases) are deleted. In `organizations-plugin.ts`,
Middleware B's "Fallback A" is removed together with its `claimed N
orphan seed row(s) for first organization` log line, and header item 2b
is replaced by a statement of why both retired paths (the donor clone
and the orphan claim) must not come back. The false "Idempotent: a no-op
once an organization-tagged row exists" sentence lived only in the
deleted file's header.
- **The organization count read is gone.** It existed only to pick
Fallback A (`limit: 2` on `sys_organization`). A first organization with
no seed replay now logs the same "starts empty" line every later
organization already logs.
- **The export** `claimOrphanOrgRows` leaves
`@objectstack/organizations`'s `index.ts`, and its README row goes with
it.
- **Regenerated, never by hand:**
`scripts/engine-double-contract.pinned.json` (`node
scripts/check-engine-double-contract.mjs --write`: the deleted test's
row lost, the new pin's row added) and the tenant-audit census (`node
scripts/tenant-audit-census.mjs --write`: the `claim-orphan-org-rows.ts`
row leaves `counts.md`, 237 sites become 236). The census page's
hand-written prose counts were restated to match, as
`check-tenant-audit-census` requires (the historical carried figures in
the first column are left as quoted).
- **Prose, five sites:** `claim-org-seed-ownership.ts` header,
`org-scoping-engine.ts` header, plugin-security
`claim-seed-ownership.ts` header, `security-plugin.ts` (which also named
the retired `cloneOrgSeedData`), and the runtime `app-plugin.ts` passage
that quoted the plugin-security header (reworded rather than left
quoting text that no longer exists).
- `claim-org-seed-ownership.ts` changes in its header prose only. No
ceremony change, no `ORGANIZATION_OWNERSHIP_SHAPE_GENERATION` change.
## Pins
`packages/plugins/organizations/src/first-organization-orphan-rows.pin.test.ts`,
against the real plugin's Middleware B over an in-memory engine whose
`update()` opens with `assertEngineUpdateDispatch`:
- CONTROL: the store holds no organization and three organization-less
application rows the probe sees.
- With no seed replay, creating the first organization leaves all three
rows NULL and calls no `update`.
- With a seed replay, the first organization gets the app's seed row
(the replay ran once, for the new organization) and the
organization-less rows stay NULL.
- `claimOrgSeedOwnership` still re-owns exactly the rows the replay
reported, and touches no organization-less row.
**Ablation** (Fallback A put back through
`scripts/ablation-replace.mjs`, with `claim-orphan-org-rows.ts` restored
from `origin/main` under a trap; marker count 1 on disk before the run;
restore proven by blob == HEAD and an empty `git diff HEAD`): `Tests 1
failed | 3 passed (4)`, the failure being the seedless case, `expected
[] to deeply equal [ 'crm_account:acc_orphan', …(2) ]`: the claim wrote
all three rows. The replay case stays green under the ablation by
construction (the claim ran only when the replay landed nothing).
## Changeset
`@objectstack/organizations` `patch`, with a BREAKING banner, the
FROM/TO line for the retired export, and the ADR-0087 marker
`not-required (runtime-export-retired
@objectstack/organizations#claimOrphanOrgRows)`.
## Acceptance notes
- Local proof (package tests, typecheck, derived gates, R1/R4 boots and
the upgrade-harness legs) is recorded with commands and exit codes in
the os-dev-report on #25204.
- `check-governed-merges --branch`: 0 of 15 paths hit the register, not
governed; 691 changed lines.
---
_Generated by [Claude
Code](https://claude.ai/code/session_0146UznqonWCqNdiHePZ9Xy3)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(organizations)!: the first organization no longer adopts organization-less rows — `claimOrphanOrgRows` is retired
6
+
7
+
Clause-②: no (narrowing)
8
+
Metadata-protocol: none
9
+
10
+
<!-- adr-0087: not-required (runtime-export-retired @objectstack/organizations#claimOrphanOrgRows) The one author-reachable removal is a runtime export: the function `claimOrphanOrgRows` leaves `@objectstack/organizations`'s published entry. No key of any metadata schema is removed, renamed or re-shaped, so there is nothing for `objectstack migrate meta` to rewrite and no tombstone. -->
11
+
12
+
**BREAKING** for a walled store (`group` or `isolated`) that holds application rows with no `organization_id` when its first organization is created, and for code that imports `claimOrphanOrgRows`. It ships as `patch`: no metadata an author writes changes.
13
+
14
+
-**The first organization adopts nothing.** When the per-org seed replay landed no row and the new organization was the store's first, `OrganizationsPlugin` used to write that organization's id onto every organization-less row of every application object (`claimed N orphan seed row(s) for first organization …`). Being created first names no owner, so this was an owner by guess, which ADR-0131 D9 and D10 forbid. Under a wall, the only posture that mounts this plugin, the organization-ownership ceremony reports such a row, leaves it NULL and holds it against certification; the claim then gave the same row to whichever organization existed. Those rows now stay NULL.
15
+
-**A first organization with no seed replay logs that it starts empty**, the line every later organization already logs. The organization count the claim needed is no longer read.
16
+
-**Unchanged:** the per-org seed replay, the organization stamp on insert, the Default Organization bootstrap, and `claimOrgSeedOwnership`, which hands an organization's seeded rows to its owner.
17
+
18
+
**What an operator does.** On a store this release creates or certifies there is no such row, so nothing. On a walled store an earlier release created that holds organization-less application rows, run `os migrate organization-ownership`: it attributes every row an anchor names, and lists each row it cannot attribute with its remedy instead of guessing an owner.
19
+
20
+
The retired export:
21
+
22
+
- FROM `claimOrphanOrgRows` TO no replacement; run `os migrate organization-ownership` for organization-less rows.
Copy file name to clipboardExpand all lines: content/docs/permissions/tenant-audit-census.mdx
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,7 +122,7 @@ are reported as `undecidable` rather than assumed either way.
122
122
123
123
The same holds twice over for the context. An options argument spelled as a
124
124
literal can be read; one spelled `options`, `{ ...opts }`, or handed through a
125
-
forwarding shim cannot, and **51 of the 237 sites are spelled that way**. A
125
+
forwarding shim cannot, and **51 of the 236 sites are spelled that way**. A
126
126
context resolved from an inline literal or a local `const` can be tested for
127
127
`isSystem`; one arriving from a helper call cannot.
128
128
@@ -187,10 +187,10 @@ reproduce them. Where it disagrees, it disagrees on the page:
187
187
188
188
| carried figure | where it survives | this census |
189
189
| :--- | :--- | ---: |
190
-
| 175 write call sites | quoted in the merged changeset |**237**|
190
+
| 175 write call sites | quoted in the merged changeset |**236**|
191
191
| 24 carrying no tenant context | quoted in the merged changeset |**2** provable and tenancy-enabled; **29** more whose options argument is unreadable |
192
-
| 127 of 175 statically decidable, 48 runtime-parameter-name sites | restated on the `isSystem`-scoping card |**160 of 237** decidable, **77** undecidable |
193
-
| 135 (77%) silenced by the `isSystem` guard before the posture gate | the lost issue body — **no surviving corroboration**|**not reproduced**: 135 decidably elevated, 0 decidably not, 94 undecidable |
192
+
| 127 of 175 statically decidable, 48 runtime-parameter-name sites | restated on the `isSystem`-scoping card |**160 of 236** decidable, **76** undecidable |
193
+
| 135 (77%) silenced by the `isSystem` guard before the posture gate | the lost issue body — **no surviving corroboration**|**not reproduced**: 134 decidably elevated, 0 decidably not, 94 undecidable |
194
194
| 141 and 132, two independent re-derivations | the card that filed this work | — |
195
195
196
196
**The differences are not reconciled, and deliberately so.** The old census's
@@ -207,11 +207,11 @@ would report a smaller number and would not say so.
207
207
208
208
The fourth row is the one worth flagging to anyone citing it. **The 135 / 77%
209
209
figure has no surviving corroboration anywhere in the tree.** This census reads
210
-
135 of 237 (57%) as decidably elevated, with 94 more whose elevation is a
210
+
134 of 236 (57%) as decidably elevated, with 94 more whose elevation is a
211
211
run-time fact — so the claim is neither confirmed nor refuted, and the honest
212
212
answer is that a static reading cannot settle it.
213
213
214
-
⇒ **Cite `2 / 237`, and say what it is**: the sites whose options argument was
214
+
⇒ **Cite `2 / 236`, and say what it is**: the sites whose options argument was
215
215
READ and holds no tenant context, against a decidably tenancy-enabled object.
216
216
That is the control's provable yield surface. ⛔ Do not cite it as "the sites
217
217
without tenant context" — **29 further sites** have an options argument this
@@ -223,31 +223,31 @@ cannot read, and they are neither in nor out.
223
223
224
224
| what | count |
225
225
| :--- | ---: |
226
-
| write call sites on the application surface |**237**|
226
+
| write call sites on the application surface |**236**|
227
227
| …whose object name is statically decidable | 160 |
228
-
| …whose object name is chosen at run time |77|
228
+
| …whose object name is chosen at run time |76|
229
229
| …against an object with tenancy ENABLED | 159 |
230
230
| …against an object that declares tenancy off | 1 |
231
-
| threading a tenant context |178|
231
+
| threading a tenant context |177|
232
232
| PROVABLY carrying none (options read, no context key) |**8**|
233
233
| …of those, against a decidably tenancy-enabled object |**2**|
234
234
| options argument UNREADABLE — may or may not carry one | 51 |
235
235
| …of those, against a decidably tenancy-enabled object | 29 |
236
-
| threading a decidably ELEVATED (`isSystem`) context |135|
236
+
| threading a decidably ELEVATED (`isSystem`) context |134|
237
237
| threading a context that is decidably NOT elevated | 0 |
238
238
| threading a context whose elevation is a run-time fact | 94 |
239
239
240
240
| how the instrument reached the site | count |
241
241
| :--- | ---: |
242
-
| receiver carried a readable engine type |196|
242
+
| receiver carried a readable engine type |195|
243
243
| receiver erased, placed by the object NAME | 31 |
244
244
| receiver erased, placed by an `object: string` PARAMETER | 5 |
245
245
| receiver erased, placed by an `UNTYPED_RECEIVERS` row | 5 |
246
246
247
247
| object name spelled inline | 109 |
248
248
| object name spelled through a `const`| 51 |
249
249
| object name is an `object: string` parameter | 7 |
250
-
| object name is some other run-time expression |70|
250
+
| object name is some other run-time expression |69|
251
251
252
252
### Subtractions the census could NOT defend — enforced
253
253
@@ -297,7 +297,7 @@ holds still. They are required to be HERE and to say WHEN they were true;
297
297
their values are not compared. The reasoning, and the measurement behind it,
Copy file name to clipboardExpand all lines: packages/plugins/organizations/README.md
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,6 @@ Register it **before** `SecurityPlugin`, so the posture probe finds the service.
52
52
|`OrganizationsPluginOptions`| type | Constructor options — currently `ensureDefaultOrganization`. |
53
53
|`OrgScopingPlugin`| alias | Alias of `OrganizationsPlugin`, matching the package name. |
54
54
|`OrgScopingPluginOptions`| alias | Alias of `OrganizationsPluginOptions`. |
55
-
|`claimOrphanOrgRows`| function | One-time back-fill of `organization_id` on orphaned seed rows, for the first organization. |
56
55
|`claimOrgSeedOwnership`| function | Hands an organization's seeded rows to its owner (`owner_id` back-fill, scoped to one org). |
57
56
|`ensureDefaultOrganization`| function | Multi-org flavour of the default-org bootstrap; wraps the open `plugin-auth` helper and adds the per-org seed-ownership handoff. |
58
57
|`assertWalledMembershipPolicyDeclared`| function | The boot gate: throws unless a walled deployment declared its membership policy. |
0 commit comments