Skip to content

fix(cloud-connection): a managed install or upgrade fills the stored computed fields it makes live - #35514

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-35390-upgrade-fills-stored-expressions
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-35390-upgrade-fills-stored-expressions

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Fixes #35390

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:应用包升级时,如果新版本把"随读随算"的公式字段改成"存起来的计算字段"(或新增了这样的字段),已有记录会在升级时一次性补算填好,所有组织都补,记录的最后修改时间不变。
  • 为什么做:HotCRM 想把线索姓名改成存储字段以便搜索、排序和报表;此前升级后所有已有线索的姓名都是空的,云端租户无法自行补救。
  • 出错会怎样:升级耗时随记录数增加;补算失败不会让升级失败,结果里会说明剩下多少行和补救办法;撤销这个改动即可回滚。
  • 要你做什么:无。

席位核对

  • Read first: the new capture step (2g, before register) and fill step (4d, after schema sync) in packages/cloud-connection/src/marketplace-install-local-plugin.ts, and marketplace-install-local-stored-expression-fill.test.ts.
  • Two-minute check: run that test file; expect 7 passed (two organizations filled, updated_at unchanged).
  • Seat landing: L1-a, then the area lands; no contract review owed unless L1-a reads the additive advisories answer key as a published-surface widening (see "Answer shape" below).

What changes

The managed install-local door (POST /api/v1/marketplace/install-local, os package install) now executes the #32527 ruling (6816429574, letter A) at the install/upgrade door:

  • 2g (new), before the register: for every object the incoming body contributes to (its own objects and the objects its objectExtensions extend, every unit of a composed artifact, through the door's existing contributionsOf), the door asks the data engine for captureStoredExpressions(object) (an engine method; no metadata-protocol or objectql export changed).
  • 4b: a failed schema sync is now recorded (still a warn, as before).
  • 4d (new), after the sync, the NOT NULL relax, the datasource connect and the handler bind, before the seed: each capture's fillChanged() runs the engine's own walk (the one os migrate stored-expressions --changed --apply runs): every row, every organization, preserveAudit. A failed sync fills nothing and reports each changed field incomplete; a fill that throws is reported, never fails the install.
  • Answer: a new advisories key, omitted when empty, with the metadata doors' rule ids (stored-expression-filled / stored-expression-fill-incomplete) and element shape (rule, severity, where, path, message, hint).
  • Docs: content/docs/deployment/publish-and-preview.mdx gains "What an install or upgrade does with existing rows".

Answer shape: the install-local answer is the door's own JSON, not a Zod-declared response in packages/spec (no schema names hotLoaded, renamesCarried or any of its keys); advisories is one more additive key, omitted when empty, the pattern the answer's other optional keys follow. A widening of an undeclared HTTP answer, not of a published contract shape.

Tests

New file packages/cloud-connection/src/marketplace-install-local-stored-expression-fill.test.ts, on a real ObjectKernel + ObjectQLPlugin + SqlDriver (SQLite :memory:):

  1. v1 formula → v2 stored full_name: rows in org_a and org_b are filled, updated_at unchanged, one stored-expression-filled advisory ("3 rows of 3 written").
  2. An upgrade adding a second stored field fills it; the unchanged stored field beside it is not reported.
  3. CONTROL: an upgrade changing no stored computed field writes no row of the object and the answer has no advisories key.
  4. CONTROL: a refused upgrade (422 PLUGIN_REGISTER_FAILED) writes no row.
  5. CONTROL: a fresh install over a new empty table: no advisories key.
  6. A composed artifact (packages[]) whose unit turns the formula into a stored field: filled.
  7. A fresh install over a table that already holds rows: filled.
Runs: the new file 7/7 on 43fbfe4; after merging origin/main, on b1c6a5b: closure rebuilt, typecheck exit 0, package suite 92 files / 1348 tests
Test Files  1 passed (1)
     Tests  7 passed (7)
os-verify-lock: VERDICT command-exit 0

pnpm --filter @objectstack/cloud-connection test
Test Files  92 passed (92)
     Tests  1348 passed (1348)
os-verify-lock: VERDICT command-exit 0

pnpm --filter @objectstack/cloud-connection typecheck   (tsc --noEmit && tsc --noEmit -p tsconfig.test.json)
os-verify-lock: VERDICT command-exit 0
Ablation: the plugin file restored to origin/main 5bd7257 (the A1 red reproduction)

The test imports the plugin from src (relative import), so no dist is involved. The mutation was proved on disk (fill-step occurrences 3 then 0), the restore by git checkout HEAD -- with the HEAD blob hash compared (d1ff868) and git diff HEAD empty.

× v1 formula → v2 stored: every existing row of both organizations is filled once ...
  AssertionError: expected { l1: [ 'org_a', null, …(1) ], … } to deeply equal { l1: [ 'org_a', …(2) ], … }
× an upgrade adding a stored field fills it ...
× a composed artifact (ADR-0130 D4): the unit that turns the formula into a stored field has its rows filled
× a fresh install whose object already holds rows ... fills them
Tests  4 failed | 3 passed (7)

The three CONTROL cases are green both ways, as controls are.

Acceptance notes

  • Hosted face: a live hosted tenant is out of reach from this seat; the door was measured in-process, on the real engine and driver. A hosted tenant installs through the same door, so the measurement covers it unless a host composes its own install door.
  • Lenient path: when a cloud-fetched register throws without a 4xx, the door fills whatever the registry now serves that the capture did not; a register that served none of the new version fills nothing, and the restart that loads it is a boot, which never fills. Those rows are left to the boot's warning and os migrate stored-expressions.
  • Customization-pair installs already write through saveMetaItem in publish mode, which fills; untouched here. Unmanaged installs copy into a new base and were not measured.
  • Duplication: the advisory composer here mirrors fillStoredExpressionChange in metadata-protocol, which is not exported; exporting it was a stop-and-report per the dispatch. Carrier: none.
  • CLI print: os package install does not print advisories yet (outside this card's file surface). Carrier: none.
  • The os migrate stored-expressions row in content/docs/deployment/cli.mdx lists the metadata doors but not this one; still true, now incomplete. Carrier: none.

Verification

Gate list derived with node scripts/pm/dispatch-gates.mjs --commands; local results and the CI check-runs are in the report on the card.


Generated by Claude Code

…computed fields it makes live

The install-local door captures every contributed object's stored computed
fields before its register and, after the schema sync, fills the existing
rows of each field the version added or changed, every organization, under
preserveAudit, reporting each field on the answer's advisories.

Claude-Session: https://claude.ai/code/session_01Utp6CaysxGzF62ACvZ1x9x
Co-authored-by: Claude <noreply@anthropic.com>
…; docs and changeset

Claude-Session: https://claude.ai/code/session_01Utp6CaysxGzF62ACvZ1x9x
Co-authored-by: Claude <noreply@anthropic.com>
…ld filled at upgrade

Claude-Session: https://claude.ai/code/session_01Utp6CaysxGzF62ACvZ1x9x
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l 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 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

13 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • 4 name(s) were too generic to anchor anything (single lowercase words)
  • 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 895dd437f4b50402dddf6b147190c2b5d24e85ef → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 21aa703abe43162ef10dc70061733edcc8dc303b — the merge of head b1c6a5bc1211f02b4f156b954792c44f43d7cf16 into base 895dd437f4b50402dddf6b147190c2b5d24e85ef, 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 21aa703abe43162ef10dc70061733edcc8dc303b && git checkout 21aa703abe43162ef10dc70061733edcc8dc303b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 895dd437f4b50402dddf6b147190c2b5d24e85ef b1c6a5bc1211f02b4f156b954792c44f43d7cf16 && git checkout -B drift-repro 895dd437f4b50402dddf6b147190c2b5d24e85ef && git merge --no-ff b1c6a5bc1211f02b4f156b954792c44f43d7cf16

node scripts/docs-audit/affected-docs.mjs --json 895dd437f4b50402dddf6b147190c2b5d24e85ef

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CaysxGzF62ACvZ1x9x

Final head for review · area pkg-1 · 2026-11-19T13:33Z
Head: b1c6a5bc1211f02b4f156b954792c44f43d7cf16 — every check on it concluded success or skipped (40 success, 17 skipped).
Fixes #35390 (p1) · Clause-②: no · Metadata-protocol: none · +532/−0 over 4 files (install-local plugin, one new test file, the publish-and-preview docs page, one changeset), inside claim 7008109647. os-dev-report 7010586784: red first (restoring the plugin to base: 4 failed | 3 passed; the 3 CONTROLs green both ways), cloud-connection 92 files / 1348 tests green, two organizations filled with updated_at unchanged.
Area L1 note: executes #32527 ruling 6816429574 letter A at the install/upgrade door (capture before register, fill after schema sync, before seed; a refused install fills nothing; a fill that throws is reported, never fails the install). The answer gains one additive key advisories (omitted when empty) on the door's own JSON; packages/spec declares no schema for this answer — L1-a to confirm Clause-②: no reads right.
Follow-ups filed under #35390: #35517 (share the notice composer; p3), #35518 (CLI prints the advisories, cli.mdx names the install door; p3).
Review route: L1-a thread. Landing by the area.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 用户能看到什么变化:安装或升级一个包时,如果新版本新增了"自动计算并保存"的字段(或把公式字段改成这种字段),已有的数据会在安装时一次性算好填上,所有组织都会处理,不改动记录的"最后修改时间";以前这些旧数据会一直是空的。
  • 为什么做:按你之前的裁决,保存元数据时会补算,安装时也应该补算;托管环境上原来根本没有办法补。
  • 出错会怎样:补算失败不会让安装失败,安装结果里会列出哪些字段没补完,以及补算的命令。
  • 要你做什么:无。区域自行落地。

席位核对

L1-a: ACCEPT · head b1c6a5bc1211f02b4f156b954792c44f43d7cf16 · Fixes #35390 (#32527 ruling 6816429574 letter A at the install door) · 2026-11-19T13:35Z

Readings: K=3; check-governed-merges --pr 35514 not governed; merge-tree against main clean; CI 41 success / 17 skipped / 1 in progress / 0 failed. Land it on full green.

Code (marketplace-install-local-plugin.ts, +206).

  • Step 2g captures captureStoredExpressions(object) for every object the incoming body contributes to (contributionsOf: own objects and extension targets, every unit of a composed artifact). It runs BEFORE the register and reads definitions only. An engine without the member yields [].
  • Step 4d calls fillChanged() per capture. It runs after the schema sync, the datasources and the handler bind, and before the seed, so a fresh table answers clean and seeded rows compute through their own writes. The walk is the engine's, the one os migrate stored-expressions --changed --apply runs, under preserveAudit and over every organization.
  • A failed schema sync is recorded and nothing is filled; each changed field is reported unfilled, with "resolve the sync first".
  • A throwing fill is logged and reported per field. Neither case fails the install or stops the other objects.
  • stored-expression-filled (info) or stored-expression-fill-incomplete (warning) is emitted per field, the second naming what is left and the exact command. os migrate stored-expressions has --object, --field, --changed and --apply, checked against packages/cli/src/commands/migrate/stored-expressions.ts:80-96.
  • A register refusal returns before 4d, so it fills nothing.

Pins. …install-local-stored-expression-fill.test.ts, 7 cases:

  • v1 formula → v2 stored fills every row of both organizations once, keeps updated_at, and reports per field;
  • an added stored field is filled, while the unchanged one beside it is not re-walked;
  • a composed-artifact unit is filled;
  • a re-install over kept rows is filled;
  • CONTROLs: no stored change gives no row and no advisories; a refused upgrade gives 422 and no row; a fresh empty table gives no advisories.

The report shows red-first (7010586784).

The judgment asked: Clause-②: no is confirmed, and no L2 is owed. advisories is an optional key on this door's own JSON answer. It is left out when empty, so every existing answer keeps its key set. Its element type (InstallStoredExpressionAdvisory) is module-private, not exported, and no packages/spec schema declares the door's answer. It is the same posture as this door's renamesCarried, which shipped under Clause-②: no (cloud-connection CHANGELOG). The widening rule I apply to a published export gaining a member does not reach an undeclared, unexported answer key. Metadata-protocol: none, @objectstack/cloud-connection patch.

Changeset and docs: sentences checked against the diff.

  • The changeset's capture scope, fill timing, updated_at, every organization, the two rule ids, "omitted when there is nothing to report", the three no-write cases and "never fails the install" all match the code and the pins.
  • publish-and-preview.mdx: the rename bullet is the existing behaviour (--confirm-upgrade is at cli.mdx:3613), and the fill bullet matches the changeset.
  • Nit (non-blocking): "a boot or a restart never fills … and the boot log names the field" is half right. The boot sample (stored-expression-backfill.ts:954) names fields holding NULL, not rows holding an old expression's value. Narrow that sentence to the NULL case when convenient.

Routing. Not governed, no contract face: pkg-1 lands it. Follow-ups #35517 and #35518 (p3) are noted. A new push needs a fresh L1 only if it changes more than a main merge.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CaysxGzF62ACvZ1x9x

Landing · head b1c6a5bc12 · after L1-a ACCEPT 7010697020 (Clause-②: no confirmed, no L2 owed) · 2026-11-19T13:36Z

Probe Reading
Checks at head b1c6a5bc12 42 success, 17 skipped, 0 failed
check-governed-merges.mjs --pr 35514 NOT governed, 532 lines
K 3 (L1-a reading), merge-tree clean
Contract record none owed (Clause-②: no, Metadata-protocol: none)

L1-a docs nit (non-blocking): "the boot log names the field" holds only for rows holding NULL; the boot sample does not see rows holding an old expression's value. It rides with the docs half of #35518, not a push here.

Status: pr_ready + automerge_enable. On MERGED the area closes out #35390.

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/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants