Repository navigation
Commit 31096af
test(organizations): a restart between the un-walled seed and the person's sign-up still fills the seed's person columns (#34581)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9J4L3bvmRRFrdqMXF1CMHSi)_
Fixes #34542
Clause-②: no
Metadata-protocol: none
The claim recorded `Clause-②: yes (widening)`; the diff is test-only, so
both lines are corrected to what it measures. On `origin/main`
(1e4656d) the card's premise does not hold for keyed datasets (`mode`
`ignore`, `upsert`, `update`): no contract change is made. For `insert`
/ `replace` datasets the first row stays NULL after a restart, measured
below; that is a different root cause and is filed as its own finding
(see Acceptance notes).
## 维护者速读
-
改了什么:只加了一个测试。在未开组织隔离墙的安装里,带键种子(upsert)写完、被引用的人还没注册时重启一次,再让这个人注册,断言种子行上的人员列被补上。
-
为什么改:卡上担心待补引用只在进程内存里,重启就丢。实测带键模式(ignore、upsert、update)不会丢:未开墙的启动每次都重放内联种子,第二个进程按键找回同一行,又遇到同一个没解析的人,重新挂起,注册时照样补上。持久的持有者就是种子声明本身,所以没有改
seed-settlement
契约。无键模式(insert、replace)重启后原行仍是空的,因为重放每次都另插一行(或被唯一约束拒掉),这是另一个根因,另立卡跟进。
- 风险与回滚:不改任何产品代码,无风险;回滚即 revert。
-
先看:packages/plugins/organizations/src/default-organization-seed-owner.wall.test.ts
末尾新加的 describe(两次启动共用一个 SQLite 文件)。
- 两分钟验证:pnpm --filter @objectstack/organizations exec vitest run
src/default-organization-seed-owner.wall.test.ts,预期 7 个用例全绿。
- 需要你做的:无,席位落地。
## What changes
-
`packages/plugins/organizations/src/default-organization-seed-owner.wall.test.ts`:
a new top-level `describe` in the existing harness file. It boots the
un-walled app over a SQLite file (`bootStack({ databaseFile })`), reads
the seeded row with NULL `assignee` / `reviewer`, stops the kernel
before the named person exists, boots a second kernel cold over the same
file, signs the person up, and asserts both columns now name the person
on the row the first process seeded (same row id). The file header gains
one paragraph saying what the leg shows.
No product file changes. For a keyed dataset the held-reference list
needs no persisted copy where #34516 put it (`SeedLoaderService`, held
by `AppPlugin`): the inline seed of an un-walled boot runs on every
start (`AppPlugin` runs it unless the wall is up or `skipSeedData` is
set), reference resolution runs before the write decision, and a row the
replay matches by its key still reports its landed id (`noteLanded` on
the `skip` / `update` paths), so pass 2 holds the same reference again
in the new process. That match exists only in the keyed modes
(`keyedMode` in `loadDataset`; `decideWriteAction` answers `insert` for
`insert` / `replace`), so the claim is limited to them.
## Tests
- New: the restart leg above, 2 cases (a PREMISE case and the fill
case).
- No existing test was changed.
## Acceptance notes
- Premise check on `origin/main` 1e4656d, before any edit, with the
same two-boot probe: `mode: 'upsert'` dataset, columns filled after the
restart; `mode: 'ignore'` dataset, filled too. `mode: 'update'` writes
no row on the first boot (nothing to match), so the window does not
arise.
- Unkeyed modes, same two-boot probe on the same code (product files
identical to `origin/main`), one record `{ name: 'Late task', assignee:
'Late Person', reviewer: 'Late Person' }`, the person signing up in the
second process:
- `mode: 'insert'` (with or without `externalId`) and `mode: 'replace'`:
the second boot inserts a second `Late task` row. After the sign-up the
new row names the person in both columns; the first process's row keeps
`assignee` and `reviewer` NULL.
- Same two modes with `name` declared `unique: true`: the second boot's
insert is refused by the database (`UNIQUE constraint failed:
seedowner_task.organization_id, seedowner_task.name`, logged at `warn`).
After the sign-up the one row keeps both columns NULL.
- So the card's symptom survives for `insert` / `replace` datasets. Its
cause is not the in-memory hold but the unkeyed replay itself, which
inserts the dataset again on every un-walled start. It is filed as its
own finding: #34613.
- Negative control (the probe can fail): the second boot mounting the
same app with no datasets leaves both columns NULL after the person
signs up (`AssertionError … to match object`, 1 failed). The fill
depends on the restart's own replay, which is what the pin holds.
- The card's second Done-when line ("one holder, the persisted record")
assumed a persisted seed-settlement record. `seed-settlement` is an
in-process probe (`ISeedSettlementService`); nothing persisted carries
that name. With the replay already re-deriving the hold, a persisted
copy would be a second holder of what the seed declaration already says.
- What still cannot fill after a restart: a reference whose dataset is
no longer declared on the restarted boot (the negative control). That is
the seed no longer naming the person, not a lost hold.
## Verification
<details><summary>Test file at 2bd14db</summary>
```
pnpm --filter @objectstack/organizations exec vitest run --maxWorkers=2 src/default-organization-seed-owner.wall.test.ts
Tests 7 passed (7)
os-verify-lock: VERDICT command-exit 0
```
</details>
<details><summary>Typecheck at 399d9b7 (the merge brought no change to
this package)</summary>
```
pnpm --filter @objectstack/organizations typecheck
os-verify-lock: VERDICT command-exit 0
```
</details>
<details><summary>Derived gate set</summary>
`node scripts/pm/dispatch-gates.mjs --commands` derives 53 families for
this diff. All 53 ran at 399d9b7 and answered exit 0; `--ran`
reconciles 53 run, 0 NOT-MEASURED. Two first answered exit 3 (shallow
clone; no full build) and were re-run after `git fetch --unshallow` and
`pnpm build`. The same 53 were re-run on 8f3e7e4 (53/53 exit 0) and
are re-run on 2bd14db, a header-comment change in the same file; the
dev report on the card carries that reading.
</details>
<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmPJxG4vBVaLCBWLcWJ -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 842637a commit 31096af
1 file changed
Lines changed: 84 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
27 | 36 | | |
28 | 37 | | |
29 | 38 | | |
| |||
35 | 44 | | |
36 | 45 | | |
37 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
38 | 50 | | |
39 | 51 | | |
40 | 52 | | |
| |||
293 | 305 | | |
294 | 306 | | |
295 | 307 | | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
0 commit comments