Repository navigation
Commit cc5645c
test(dogfood): a walled leg of the sign-up organization census (#25241)
<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgCq1w2KRx6KxuLkmsCrYWrr)_
Fixes #25207
Part of #24343 (its ceremony half, the `advisory` count, is not
addressed here; #24343 remains open).
Clause-②: no
## What
A walled leg of the sign-up organization census, as a sibling file
beside the `single` one:
`packages/qa/dogfood/test/signup-organization-census-walled.dogfood.test.ts`.
Test-only; nothing outside `packages/qa/dogfood/` moves, and the
`single` file is untouched.
One boot per posture (`group`, `isolated`), `multiTenant:
'posture-only'` with `OS_TENANCY_POSTURE` selecting the posture, and the
audit and email plugins composed together. The journey:
1. the admin opens the audience (`open`, declared set `member_default`);
2. a stranger self-registers (verification mail) and creates an
organization (first membership);
3. they invite a second stranger (invitation mail), who signs up and
accepts (first membership).
Then a census of the STORE, not the registry: every sqlite table
carrying an `organization_id` column is read from `sqlite_master` plus
`PRAGMA table_info` at run time (39 tables on this boot, the date-named
`sys_activity` shard included), so a new table joins the census on its
own.
| assertion | reads |
|:--|:--|
| guard | posture is `group` / `isolated`, not degraded, isolation
active; both users' only membership is the journey's organization; the
census reaches the writers' tables |
| whole-store NULL census | 0 rows with NULL or empty `organization_id`
on every tenant-column table (boot rows included) |
| journey rows | every row the journey wrote on a tenant-column table
names the organization the users joined (17 rows: activity 10,
`sys_member` 2, `sys_user_permission_set` 2, `sys_email` 1,
`sys_invitation` 1, `sys_team` 1) |
| grant writer | the self-registrant holds exactly one `member_default`
grant, owned by the organization; the invitee, admitted by its
invitation, holds none |
| activity writer | activity about each grant and about the invitation
mail names the organization; no activity row about the org-less
`sys_user` records |
| mail writers | the invitation is tenant mail owned by the
organization; each verification mail is identity mail
(`sys_identity_email`, no column), none in `sys_email` |
## Why the existence legs matter
Measured on this boot: 38 of the 39 tenant columns are NOT NULL in the
store (`sys_sso_provider` is the one nullable column), and a stamp-less
system write on a walled posture is refused by the engine (ADR-0131 D9)
before it reaches the column. So "0 NULL rows" alone holds even when a
writer loses its stamp: the row is refused, not written NULL. The census
therefore also requires each writer's own row to exist and to name the
organization, and that is the leg the ablation turns red.
## Tests
At head `70551508`, through `os-verify-lock.sh`:
- `pnpm --filter @objectstack/dogfood exec vitest run --maxWorkers=2
test/signup-organization-census-walled.dogfood.test.ts
test/signup-organization-census.dogfood.test.ts`: `Test Files 2 passed
(2)`, `Tests 15 passed (15)` (walled 12/12 across both postures; the
`single` control 3/3). Lock VERDICT command-exit 0.
- `pnpm --filter @objectstack/dogfood typecheck`: exit 0; `tsc
--listFiles` includes the new file.
- `eslint --no-inline-config` on the new file: exit 0.
## Ablation (one-shot, never landed)
The grant writer's stamp: in
`packages/plugins/plugin-auth/src/auth-manager.ts`
`landSelfRegistrationGrant`, the anchor `setName, organization_id:
organizationId }` replaced by `setName, organization_id: (globalThis as
any).ABLATION_25207 }` (undefined at run time), through
`scripts/ablation-replace.mjs` (anchor 1 to 0, blob `ab76fa3c90e8` to
`4db63fdf74d3`), then `pnpm --filter @objectstack/plugin-auth build` and
`ablation-dist-preflight.mjs @objectstack/plugin-auth ABLATION_25207`:
marker present in 2 built files.
- Mutated: `Tests 4 failed | 11 passed (15)`. Red, in both postures: the
grant writer leg (`the declared grant: expected [] to deeply equal [
orgId ]`) and the activity writer leg (`the registrant's grants:
expected [ 'organization_admin' ] to include 'member_default'`). The
auth log names the cause: `Insert on 'sys_user_permission_set' was
REFUSED: a system-context write on a tenant-scoped object must carry an
organization, and this install runs the 'group' (resp. 'isolated')
tenancy posture`. The `single` control stayed green (the Default
Organization is derived there).
- Restored: blob back to `ab76fa3c90e8` (equal to HEAD, `git diff HEAD`
empty), rebuilt, preflight `--absent` (marker absent from all 20 built
files, tree clean), then `Tests 15 passed (15)`.
- A first attempt planted `void "ABLATION_25207"`, which the bundler
folds to `void 0`; the preflight read the marker ABSENT from `dist/`, so
that leg's run was void and is not counted.
## Gates
`dispatch-gates.mjs --commands` derived 56 families for this diff; all
run locally at `70551508` and reconciled with `--ran`: 55 exit 0, 1 NOT
MEASURED (`check:dual-build-cjs-loads`, exit 3: needs every package
built; CI reads it). `check:query-options-erasure` and
`check:type-check-debt` were re-run without the per-command 300 s cap
after a first timed-out pass; `check-plugin-teardown-shape --self-test`
after deepening the shallow clone.
## Changeset
None: `packages/qa/dogfood` is private and the diff is a test file;
nothing published moves (`skip-changeset`).
## Acceptance notes
- The new file boots twice (one stack per posture); run alone on a
shared box it read `Duration 33.90s` (import 25.10 s, tests 8.50 s),
above the 10 s report line. That line is report-only and none of the
declared budget classes fits a real-stack boot, so no budget is
declared.
- The invitee is admitted by the invitation, not by the open posture
(`decideAudienceAdmission`), so it is owed no declared set by design;
the file pins that reading instead of expecting a second grant.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01UQVH1PSsJbZT4VvCZqEiRu)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 279fdcf commit cc5645c
1 file changed
Lines changed: 251 additions & 0 deletions
| 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 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
0 commit comments