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 8596c80
Browse filesBrowse the repository at this point in the historyBrowse files
fix(runtime, cloud-connection): an upgrade replaces the package's seed datasets on the shared replay list (#35374)
Fixes#35109
Clause-②: yes (widening)
Metadata-protocol: none
## 维护者速读
1.
用户能看到什么变化:多组织部署里,运行中升级一个已安装的应用包后,之后新建的组织只拿到新版本的示例数据,不再混入旧版本的数据,也不用等重启。
2. 为什么做:来自"安装、升级与卸载可靠性"这条主线,是示例数据兜底语种功能评审时发现的升级后旧数据残留问题。
3. 出错会怎样:若有误,升级后新建的组织可能少了该应用的示例数据;撤回本次改动即可恢复原状。
4. 要你做什么:无,席位落地。
## What changes
- `packages/runtime/src/seed-datasets.ts`: `mergeSeedDatasets(ctx,
datasets, owner?)` takes an optional owner. Given, the owner's earlier
entries are taken off the SAME live array (by reference, one occurrence
each, latest first) and the new entries go where the first of them
stood; an empty `datasets` removes them; an owner with nothing to add on
a host with no list registers nothing. Omitted, today's append is
unchanged. The owner index rides on the array under
`Symbol.for('objectstack.seed-datasets.owners')`, non-enumerable, so the
inline fallback reads the same index.
- `packages/cloud-connection/src/marketplace-install-local-plugin.ts`:
`mergeSeedDatasetsIntoKernel` / `mergeSeedDatasetsInline` take the owner
and pass it on (the inline mirrors the helper); the one call in
`applySideEffects` passes the package id, so install, upgrade,
reinstall, reseed and rehydrate all replace. When the body's datasets
were read and are empty, the call is made with none, so a version that
ships no seed data takes its predecessor's off the list.
- Config apps (`AppPlugin`) are untouched: they merge un-owned, once per
boot.
## Tests
- `packages/runtime/src/seed-datasets.test.ts`, new top-level describe:
v1 then v2 of one package leaves v2 only, in place, on the same
reference; CONTROL two packages both kept; CONTROL the same version
merged again adds no duplicate; an empty version removes; an owned
replace never removes an un-owned copy of the same object; install v1,
upgrade v2, then the real `AppPlugin` replayer replays host + v2 only.
- `packages/runtime/src/app-plugin.seed-locale-producer.test.ts`, new
top-level describe (the carried N5 composition, real seed loader): a
`dependsOn` dataset on an object whose marked set changed between
versions, for a ja-JP organization no set lists, now loads.
-
`packages/cloud-connection/src/marketplace-install-local-seed-replayer.test.ts`,
new top-level describe through the real install route: install v1,
upgrade to v2, then the registered replayer replays v2's sets only;
CONTROL two packages through an upgrade of one; CONTROL reinstall of the
same version; a version with no seed data empties the package's entries;
the door hands the runtime helper the package id.
- Stale pins this change made false, updated:
`marketplace-install-local-sample-data-not-loaded.test.ts` and
`install-local-sample-data-not-loaded.dogfood.test.ts` asserted that a
reseed adds the package's datasets to the list a second time; both now
assert it holds them once. Two comments in
`app-plugin.seed-locale-producer.test.ts` now name the un-owned append
only.
## Acceptance notes
- The seed loader's duplicate-fallback refusal text (metadata-protocol
`seed-loader.ts`, `findDuplicateFallbackSets`, pinned by
`seed-loader-locale-scope.test.ts`) still names "an upgrade within this
process changed a package's marked set (the earlier version's datasets
stay on the replay list until the process restarts)" as a cause. After
this change the install door no longer produces that state. The text was
not edited here: that file is outside this card's surface and is being
edited by an in-flight sibling. Reported to the seat to carry.
- Uninstall still leaves the package's entries on the list until a
restart. The same rule would cover it, as one owner-keyed call with no
datasets on the uninstall path. Reported, not built (out of scope by
dispatch).
- The reseed control in
`marketplace-install-local-sample-data-not-loaded.test.ts` no longer
moves the `seedDatasets` axis, by design; the translations axis still
makes that control non-vacuous.
## Verification
Readings are below. Every assertion is against HEAD `8de43b35`.
<details><summary>Package tests and typecheck</summary>
- `pnpm --filter @objectstack/runtime test`: Test Files 625 passed
(625), Tests 11576 passed, 25 skipped. Run at `94d3a6bf`. No runtime
file changed after that commit.
- `pnpm --filter @objectstack/cloud-connection test`: Test Files 90
passed (90), Tests 1331 passed (1331). Run at `758ae1b0`; the only later
commit edits a dogfood test.
- `pnpm --filter @objectstack/dogfood exec vitest run --maxWorkers=2
test/install-local-sample-data-not-loaded.dogfood.test.ts`: 7 passed,
against a fresh build of the dogfood dependency closure.
- typecheck: runtime (tsc plus `check:test-typecheck` OK),
cloud-connection and dogfood, all exit 0 at `8de43b35`.
- `test:repo` was not run locally (CI-owned).
</details>
<details><summary>Red first: ablations, each landed on disk and restored
to HEAD by scripts/ablation-replace.mjs</summary>
- runtime: `replaceOwnedSeedDatasets(...)` changed back to
`list.push(...datasets)` (anchor 1 to 0, blob 19d4919 to 010f55a2). 6
failed of 52: the five new seed-datasets cases (CONTROL two-packages
stays green) and the N5 pin. Restored: blob equals HEAD, `git diff HEAD`
empty.
- cloud-connection inline: the owner index read replaced with an empty
list (blob fd57994 to 228c5ea5). 4 failed: upgrade replay, both
controls that go through an upgrade or reinstall, and the empty version.
Restored.
- cloud-connection helper leg: the owner argument dropped from the
helper call (blob fd57994 to dcceb504). The owner pin failed. Restored.
- N5 before the fix, on the appended list with the length assertion
removed: the replay answered errors `fallback` (price_book) and
`dependsOn` x2 (quote), and wrote no row.
</details>
<details><summary>Gates (derived set, local)</summary>
- `node scripts/pm/dispatch-gates.mjs --commands` derived 75 families
for this diff. All 75 were run one by one, each exit captured before any
pipe. 74 exited 0. `pnpm check:dual-build-cjs-loads` exited 3,
PREREQUISITE NOT MET: it needs repo-wide dist, so it is NOT MEASURED
locally and CI's Lint and Repo Gates runs it.
- `--ran` reconciliation: "75 derived famil(ies) accounted for, 74 run,
1 NOT-MEASURED (1 DERIVED from a recorded exit 3)".
- `node scripts/check-nul-bytes.mjs`: OK.
- `node scripts/pm/overlap-check.mjs --branch=HEAD` before each push:
VERDICT clean. Shares the plugin file with #35347, and both merge
cleanly.
</details>
## 席位核对
- Read first: `packages/runtime/src/seed-datasets.ts`
(`replaceOwnedSeedDatasets`, the removal loop);
`packages/cloud-connection/src/marketplace-install-local-plugin.ts`
(`mergeSeedDatasetsInline` mirror, and the `else if (datasetsRead)`
branch in `applySideEffects`);
`packages/cloud-connection/src/marketplace-install-local-seed-replayer.test.ts`
(the new describe).
- Two-minute check: `pnpm --filter @objectstack/cloud-connection exec
vitest run src/marketplace-install-local-seed-replayer.test.ts -t
35109`. Expected: 5 passed.
- Mechanism readings at `e4bfa339`: A1 holds (`list.push(...datasets)`,
nothing removes). A2 holds: no dataset entry carries a package identity
(`seedDatasetsOf` → `resolveStackCollection(body, 'data')` returns the
raw entries), so the caller tags them; `AppPlugin` left un-owned. A3
reproduced red: see the ablations.
- N5 (carried nit 6969452030): on the appended list the replay answers
three errors (`fallback` for `price_book`, then `dependsOn` twice for
`quote`) and writes no row. On the replaced list it answers no error,
and price_book, quote and account all seed. It changed, so it is pinned.
- File-surface deviations: the call site in `applySideEffects` (the
owner argument and the empty-version branch); the pins went into the
existing harness files as top-level describes (AGENTS.md: a new pin for
a component with a shared harness goes into that file), not a new file;
two stale pins outside the surface (one cloud-connection test, one
dogfood test) updated as consequences of this change.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01Utp6CaysxGzF62ACvZ1x9x)_
<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6CaysxGzF62ACvZ1x9x -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(runtime, cloud-connection): an upgrade replaces the package's seed datasets on the shared replay list
7
+
8
+
Clause-②: yes (widening)
9
+
Metadata-protocol: none
10
+
11
+
The shared `seed-datasets` list that per-organization seed replay reads was append-only. After a package was upgraded in a running process, the superseded version's datasets stayed on the list until a restart, so every organization founded in between replayed the old and the new version's seed sets. When the upgrade changed an object's `fallback: true` set, the two marked sets refused that object's fallback choice, and a dataset declaring `dependsOn` that object refused the whole load for an organization whose locale no set lists.
12
+
13
+
`mergeSeedDatasets(ctx, datasets, owner?)` takes an optional `owner`. Given, the owner's earlier entries are replaced on the same live array (in their place) instead of kept beside the new ones; an empty `datasets` takes them off. Omitted, the datasets are appended as before, which is what a config app's boot merge still does. The install-local door merges under the package id on install, upgrade, reinstall, reseed and rehydrate, so the list holds the installed version only: reinstalling the same version adds no duplicate, and a version that ships no seed data takes its predecessor's datasets off the list.
0 commit comments