Skip to content

fix(cloud-connection): install-local seeds a composed bundle's package datasets on install, reseed, upgrade and restart - #34403

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-34336-composed-bundle-seeds
Nov 16, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-34336-composed-bundle-seeds

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread
Fixes #34336

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:install-local 的所有样例数据入口(安装、重新灌入、升级、重启自愈、清除、计数、已装应用列表)改为同一个读法,组合包(packages[])每个子包里的 seed 数据都能读到。
  • 为什么改:HotCRM 6.2 起发布的是组合包,没有顶层 data,托管租户装上后 订单与回款、项目交付 等模块一条演示数据都没有。
  • 风险与回滚:低。单包(平铺)读法不变,已有对照测试钉住;回滚即 revert 本 PR。
  • 先看:packages/cloud-connection/src/marketplace-install-local-plugin.ts 的 seedDatasetsOf 与 applySideEffects 第 2 步;marketplace-install-local-composed-bundle-seeds.test.ts。
  • 两分钟验证:pnpm --filter @objectstack/cloud-connection exec vitest run src/marketplace-install-local-composed-bundle-seeds.test.ts,预期 9/9 通过。
  • 需要你做的:无,席位落地。卡上第 2 条(升级时把新增 seed 补进所有已有组织)是新产品行为,未实现,见下方 Acceptance notes,待决定。

What changes

Every seed door of MarketplaceInstallLocalPlugin read the top-level data only. A composed bundle (dist/objectstack.json with packages[], ADR-0130 D4) has no top-level data, so all of them answered as if the package had no sample data.

They now share one reader, seedDatasetsOf(body), which is resolveStackCollection(body, 'data') from @objectstack/core filtered to datasets that name an object and carry records. It reads the top-level data when the body has one. Otherwise it reads every package body's data, in the artifact's package order (dependency order, the order the packages register in).

Seed door Before (composed bundle) After
install, POST install-local (applySideEffects step 2 + 3) seeded: skipped / no-datasets, nothing shared every package body seeded, merged into seed-datasets
upgrade (re-install of a newer version) same as install incoming version's datasets seeded into the caller's organization (single-tenant: the database), a package the upgrade adds included
reseed, POST …/reseed-sample-data 400 RESEED_SKIPPED no-datasets seeds every package body
restart rehydrate (applySideEffects with seedNow: false) nothing merged for the per-organization replay merged, so a new organization gets them
restart heal (maybeHealSampleData) nothing to heal heals an empty single-tenant database
purge, POST …/purge-sample-data 400 NOTHING_TO_PURGE matches every package body's rows
count, GET …/sample-data count: 0 counts every package body's rows
listing withSampleData false read from every package body

The unmanaged copy (installMode: 'unmanaged') is unchanged: its import refuses a multi-package artifact by name, and its doors read the seed receipt, not the body.

A malformed packages gets the resolver's ADR-0112 refusal, the same one the manifest service raises on those bytes. applySideEffects reports it in seeded (seed-datasets-unread: …) and does not throw, as its contract says. The listing answers withSampleData: false for that entry and logs it at warn. The heal logs it and skips.

Tests

New file packages/cloud-connection/src/marketplace-install-local-composed-bundle-seeds.test.ts, 9 cases. The composed fixture lists the order module before the core module it depends on, so package order is not array order:

  • install: the loader gets [core, o2c], and seed-datasets gets the same list;
  • reseed, count, purge, listing: each door is handed [core, o2c];
  • upgrade 6.3.0 to 6.4.0 adding a PSA package: the loader gets all three, core first;
  • restart: seed-datasets is refilled and the heal seeds [core, o2c];
  • controls: a flat bundle reads its top-level data unchanged; a composed artifact that still carries a flattened top-level data reads it once, not again per package; a composed artifact with no datasets still answers no-datasets.
Red on the base plugin source, green on the fix (HEAD f54ec13)

Red leg: marketplace-install-local-plugin.ts restored from 719b6b537 (base), the new test run, then restored with git checkout HEAD -- and the blob hash checked against HEAD.

× install seeds every package body's datasets … (expected { mode: 'skipped', …(1) } to match object { mode: 'inline', inserted: 3 })
× reseed loads them again ({"code":"RESEED_SKIPPED","message":"Reseed did not run: no-datasets"}: expected 400 to be 200)
× an upgrade that adds a package seeds the incoming version's datasets …
× the sample-data count and the purge match the rows of every package body
× the installed-apps listing reads the package's sample data from every package body
× a restart shares them for new organizations and heals an empty database from them
Tests  6 failed | 3 passed (9)

Green leg: Tests 9 passed (9).

Package: pnpm --filter @objectstack/cloud-connection typecheck (both tsc --noEmit programs) and vitest run: Test Files 84 passed (84), Tests 1236 passed (1236).

Acceptance notes

  • Card ask 2 is not built. The card says an upgrade replays new seed keys into existing organizations, and that sys_seed_landed_key already keeps a deleted row from coming back. Measured on this door, for a flat bundle as well as a composed one:
    • an upgrade seeds only the organization the request acts in (or the single-tenant database). No code path replays an upgrade's seed into other existing organizations. The per-organization replayer runs only when a sys_organization row is inserted;
    • runInlineSeed builds SeedLoaderService with no landedKeys option, so this door neither reads nor writes sys_seed_landed_key. On this door a row a tenant deleted comes back on reinstall or reseed (create-only ignore default).
      So ask 2 would be new behaviour, not a fix. After this PR a composed upgrade does what a flat upgrade does: a package the upgrade adds gets its rows in the upgrading organization. The question is open on the card.
  • Same family, not changed here: applySideEffects step 1 reads translations from the top level only. Measured on a scratch run: a composed bundle with a package-body translations answers translationsLoaded: 0, and the same translations on a flat bundle answer 1. The ADR-0120 D5e global-unique gate (evaluateGlobalUniqueGate) also reads manifest.objects from the top level only. That one is read from the code, not measured. Both are reported to the seat.
  • The seed locale's last fallback (appDefaultSeedLocale) still reads the composed artifact's top-level i18n, the same as AppPlugin.resolveSeedLocale does for a boot bundle. That is unchanged.

Verification

Local gates (HEAD f54ec13)
  • node scripts/pm/dispatch-gates.mjs --commands: 71 families derived. All 71 were run. Reconciliation with --ran and recorded exit codes: 71 derived famil(ies) accounted for — 70 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3).
  • 70 passed with exit 0. Among them: check:type-check-debt (0 raw tsc error(s) total), check:durability-log-level, check:startup-registry-verdict, check:test-source-alias, check:nul-bytes, check:route-envelope.
  • pnpm check:dual-build-cjs-loads: exit 3, PREREQUISITE NOT MET (it needs a full workspace build). NOT MEASURED locally; CI runs it.
  • Before push, a git merge-tree against the one open PR that touches marketplace-install-local-plugin.ts (fix(cloud-connection)!: install-local parses manifest.namespace through its declaration #34316, claude/area-A5-33922) produced no conflict.

Fix round 2 (head 543a53e54b)

  • Merged origin/main (9e67ea6cf4, no conflicts; none of the 17 incoming commits touches packages/cloud-connection).
  • L1 Should (6918284604): the purge (POST …/purge-sample-data) and the sample-data count (GET …/sample-data) now read a ledger entry's seed datasets through ledgerSeedDatasets. A body the resolver refuses (a malformed packages, ADR-0112 INVALID_ARTIFACT_PACKAGES) now gets the unreadable-entry answer the reseed already gives (500 MARKETPLACE_STORAGE_FAILED, naming the ledger file and quoting the refusal) instead of a throw into the route's error path. No row is matched or deleted. LocalManifestSource.fileNameOf names the file by the existing safeFilename rule.
  • Pins: two new cases in marketplace-install-local-composed-bundle-seeds.test.ts, red on f54ec13b (2 failed, thrown refusal), green at head (11/11).
  • Package: typecheck clean, 84 files / 1238 tests passed. Local gates: 72 derived, 71 exit 0, check:dual-build-cjs-loads not measured (exit 3, needs a full build; CI runs it).
  • CI on 543a53e54b: 35 success, 16 skipped, 0 failure. Dev report 6920915310 on marketplace install-local: a composed bundle's seed datasets (packages[i] data) are never loaded on install, reseed or upgrade, so a hosted tenant gets no demo data for a new module #34336.

Generated by Claude Code

…stall-local seed door (red on main)

Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL
Co-Authored-By: Claude <noreply@anthropic.com>
…y install-local seed door

Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL
Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/cloud-connection, touching 10 documentable anchor(s).

1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/deployment/cli.mdx (via MarketplaceInstallLocalPlugin (symbol, a top-level class))
What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 7 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 80cdbd4e0fe293696ab2ada350b5b348ff4ed172 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 9987d45bd56cc1c121ac2ca6cad0daf075ea0344 — the merge of head 543a53e54b37c0a6729a4234159511e3a6dea0dc into base 80cdbd4e0fe293696ab2ada350b5b348ff4ed172, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 9987d45bd56cc1c121ac2ca6cad0daf075ea0344 && git checkout 9987d45bd56cc1c121ac2ca6cad0daf075ea0344
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 80cdbd4e0fe293696ab2ada350b5b348ff4ed172 543a53e54b37c0a6729a4234159511e3a6dea0dc && git checkout -B drift-repro 80cdbd4e0fe293696ab2ada350b5b348ff4ed172 && git merge --no-ff 543a53e54b37c0a6729a4234159511e3a6dea0dc

node scripts/docs-audit/affected-docs.mjs --json 80cdbd4e0fe293696ab2ada350b5b348ff4ed172

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 80cdbd4e0fe293696ab2ada350b5b348ff4ed172 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5pHNFS9mn8hS13iGyL

Request: review · PR #34403 · area o1-B · Fixes #34336 · head f54ec13b444d4a671865a641dbbe8d07896fb686 (declared final, green) · 2026-11-16T13:47Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5kcNtBBExhz4DZqYbi

席位核对 · ACCEPT (L1, first read) · Head-sha: f54ec13 · 2026-11-16T13:49Z

L1 thread L1-a for area o1-B, on the final head declared in 6918245890. I read card #34336, the scope note 6917833544, dev report 6917684209, and the full diff against merge base 719b6b53 (4 commits, 3 files, +363/−18). No L2 is owed: Clause-②: no, Metadata-protocol: none, and the PR is not governed.

  • Card relation. The PR body says Fixes #34336. Card ask 1 (install and reseed read every package body, in package order) is built here. Ask 2 (an upgrade replays new seed keys into existing organizations) is not built here; it moved to install-local: wire landedKeys into the door's seed loads, so a seed row a tenant deleted does not come back on reinstall or reseed #34405 and Decision: should a managed upgrade replay a package's new seed keys into every existing organization (honouring landedKeys)? #34406 by scope note 6917833544. Same-family findings are on install-local: composed artifacts read package-owned collections from the top level only (translationsLoaded 0; global-unique gate sees no objects) #34407. So Fixes closes the card on ask 1 with ask 2 carried elsewhere. The area should confirm that the card's done condition reads that way, or say so on the card when it closes.

  • One reader. seedDatasetsOf(body) = resolveStackCollection(body, 'data') from @objectstack/core (stack-collections.ts), filtered to entries that have an object and records.

    • The top-level data wins whenever it is present, so a flat bundle, or a composed artifact that still carries the flattened union, is read once and never again per package. Otherwise each package body is read in packages[] order.
    • On this head, git grep in marketplace-install-local-plugin.ts finds no manifest.data / converted.data read left.
    • Every door goes through seedDatasetsOf: install, reseed and upgrade (applySideEffects), the rehydrate share and heal (maybeHealSampleData), purge, the sample-data count, and the listing's withSampleData.
  • Pins. The new test file marketplace-install-local-composed-bundle-seeds.test.ts pins:

    • install, with core seeded before the module that depends on it and the datasets shared for new organizations;
    • reseed;
    • an upgrade that adds a package;
    • count and purge;
    • the listing;
    • a restart, both sharing and healing.

    Its three controls are: a flat bundle unchanged, a composed artifact with a flattened data read once, and a composed artifact with no datasets still answering no-datasets. Per 6917684209 the file was red on base (6 failed, controls green) and is 9/9 at head.

  • Changeset. patch on @objectstack/cloud-connection. Each door it names matches a call site above.

    • The upgrade paragraph ("seeds the incoming version's datasets into the organization the request acts in … other organizations are not reseeded") states the flat-bundle behaviour, unchanged, and that matches the code.
    • It does not promise ask 2.
  • Checks on this head (check-runs): 51 names, 35 success, 16 skipped (path-filtered, opt-in and queue-only), 0 failed, 0 pending.

  • Base. PRBASE = 162fe54f (Test Core plan, Affected-set diff base), so K = 4 to origin/main, below 15. Nothing since touches cloud-connection/** or stack-collections.ts. The planned merge of origin/main after p0 4-hourly full run: red on main (CI) #34397 comes back to me as a merge-only delta.

Should (not blocking)

  • The purge and count doors do not catch the reader's refusal. seedDatasetsOf can now throw: stackPackageBodies raises the ADR-0112 refusal for a malformed packages. Three doors catch it and say why: the heal (warn, then skip), the listing (warn, then withSampleData: false) and applySideEffects (seed-datasets-unread in the summary). But handlePurge (seedDatasetsOf(entry.manifest), around line 6068) and handleSampleDataCount (around line 6369) call it bare, so a ledger body with a malformed packages reaches the route's error path instead of an answer that names the entry.
    • It is not reachable through install, because the manifest service refuses those bytes first. Only a hand-edited or older ledger body could carry them.
    • Either route both doors through the same reason the reseed gives for an unreadable entry (unreadableLedgerEntry), with a pin, or record it in ## Acceptance notes as accepted.

Landing: not Tier H. After the merge-only delta (if it comes) is read, area o1-B lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5pHNFS9mn8hS13iGyL

Request: review · PR #34403 · area o1-B · Fixes #34336 · head 543a53e54b37c0a6729a4234159511e3a6dea0dc (declared final, green) · 2026-11-16T15:35Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5kcNtBBExhz4DZqYbi

席位核对 · ACCEPT (L1, delta) · Head-sha: 543a53e · 2026-11-16T15:36Z

This is L1 thread L1-a for area o1-B, reading the final head declared in 6920968387. It is a delta read against my ACCEPT 6918284604 at f54ec13b. The delta has two parts: the merge of origin/main as 9e67ea6c, and fix commit 543a53e5 (3 files, +80/−2).

  • Merge 9e67ea6c: clean and mechanical. Since the previous merge base, no file changed on both sides. Relative to main's parent, the merge carries only this PR's three files (the changeset, the plugin and the pin file).
  • My Should is closed.
    • The purge (handlePurge) and the count (handleSampleDataCount) now read a ledger entry's datasets through ledgerSeedDatasets. When the resolver refuses the body, that helper catches the refusal and answers unreadableLedgerEntry, the same answer these doors already give an entry that fails to read. That answer names the ledger file and quotes the cause, and nothing is deleted.
    • LocalManifestSource.fileNameOf returns the on-disk basename (safeFilename), spelled the way SkippedManifestEntry.file spells it.
    • Pins: the purge and the count, run over a ledger body whose packages is 'not-a-list', each answer 500 MARKETPLACE_STORAGE_FAILED with the file name in the message. The purge pin also asserts nothing reached the purge (purgeCalls is empty). The area records both pins as red before the fix.
    • The other three doors (heal, listing, applySideEffects) are unchanged from my earlier read, so all five readers of seedDatasetsOf now handle a refusal.
  • Checks on this head (check-runs): 55 names, 36 success, 18 skipped, 0 failed, 1 still running (Check Changeset) when I read them. Landing needs it green.
  • Base. PRBASE is 80cdbd4e (Test Core plan, Affected-set diff base), so K = 5 to origin/main. Nothing since then touches cloud-connection/** or stack-collections.ts.

Landing: not Tier H, and no L2 is owed. Area o1-B lands it once Check Changeset is green.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5pHNFS9mn8hS13iGyL

Verdict: ACCEPT at 2026-11-16T15:37Z, and the landing rides this stroke. ACCEPT → PR #34403 comment 6921006456.

Reading Head 543a53e54b37c0a6729a4234159511e3a6dea0dc
L1 delta (L1-a) ACCEPT 6921006456 (first read ACCEPT 6918284604)
Contract review not owed (Clause-②: no, Metadata-protocol: none)
check-governed-merges --pr 34403 NOT governed, 463 changed lines, under 3,000
Dogfood battery n/a, no ! title
K (head → origin/main) 5, below 15
Check-runs 33 success, 18 skipped, 0 failure (Check Changeset success)

State: ready plus auto-merge through the merge queue. On MERGED, Fixes #34336 closes the card; ask 2 is carried by #34405 and #34406, same-family findings by #34407 (scope note 6917833544).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

1 participant