Skip to content

fix(metadata-protocol): the customizations read lists a moved edit under the package that serves it - #31668

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-o96evq
Nov 8, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-o96evq

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #31656

Clause-②: no — what the customizations list holds for a moved edit; no accept set changes
Metadata-protocol: none

维护者速读

  • 改了什么:套件拆分(或回滚)把条目挪到同一 App 的另一个包后,"包的定制列表"(GET /packages/:id/customizations)现在把租户的修改列在实际生效的新包下,且只列在那里。
  • 为什么改:A tenant's edit of a packaged view stops applying when its item moves to another package of the same suite (composed upgrade, rollback) #31593 之后修改已在新包下生效,但列表仍按修改时声明的旧包来列:拆包后列在已不再发运该条目的 App 下、新模块下却没有;回滚后两边都列不出。列表改为读取与生效读取同一组候选与判定。
  • 风险与回滚:只读,不写任何数据;"同一 App"仍只由安装记录(appOf)判定。条目锁本就读取该条目的全部存储行,实测对挪动的修改与在新包下保存的修改给出相同答案,未改,只加了钉。回滚即还原本 PR。
  • 先看:packages/metadata-protocol/src/protocol-served-overrides.ts(逐条目按候选顺序选行,以及"旧包不再列"的排除)。
  • 两分钟验证:pnpm --filter @objectstack/runtime exec vitest run src/domains/meta-overlay-follows-suite.test.ts(需先构建 metadata-protocol),预期 12 个全绿。
  • 需要你做的:无,席位落地。

What changes

As measured on origin/main after #31653. The card read "listed under neither". Measured, it depends on the direction: after a flat → composed split the pair override declaring the App was still listed under the App (which no longer ships the item) and not under the module that serves it; after a composed → flat rollback it was listed under neither. Both are fixed.

The list reads the served reads' own candidates, one reading (seat ruling 1). listServedOverrides groups the pair's ACTIVE rows by item (folded type, name, bundle member) and picks each item's row through servedOverlayRowCandidates and holdsServedOverlayCandidate, in their order, with the item's shipping packages read the way the by-name read reads them (shippingPackageIds(shippedArtifactsOf(...))). So a package lists the pair's declared override of its item first, else the pair's override that isMovedOverrideRowOf holds as a moved edit. Same App is read only inside the predicates (appOf over installed manifests); no key list and no same-App test of its own.

Listed only where it is served (ruling 2). A declared override whose package no longer ships the item, which a package shipping it now holds as its moved edit (isMovedOverrideRowOf), is that package's and is not also listed under the former owner. A former owner that still ships the item keeps its edit, listed as today.

The list stays the pair's rows. A row bound to a package of the App itself (a Regime O save from before the ADR-0146 D11 close) is served at the new owner through isMovedBaseRowOf's candidate, but it is not a pair row: it is listed under no package, before or after the move, as such a row bound to its still-shipping owner is not listed today. Named in the report's open questions. Since the list reads no base-bound rows, "two former owners' rows, list neither" has no listed case; the served reads already serve neither.

Item lock (ruling 3): measured, unchanged. The lock's overlay layer reads every ACTIVE row of the item whichever package it is bound to (overlayLockLayerAt, no package filter), so a moved edit was already in its scope. A pin holds that a moved edit carrying a stamped lock answers at the module exactly what the module's own edit answers: the read's lock/editable/deletable/lockReason and the save door's ITEM_LOCKED. No save door refusal changes.

Files: protocol-served-overrides.ts, protocol.ts (one host member, shippedArtifactsOf, passed to the list), the test, a patch changeset. protocol.ts is outside the delta's named surface: the host-split pattern needs the member wired there, as #31653 did for the by-name read. No packages/spec/**, no ui/**, no docs/adr/**; served-override.ts and item-lock.ts are not edited. No forced test edits.

Tests

Six cases added to packages/runtime/src/domains/meta-overlay-follows-suite.test.ts (the suite-move harness #31653 added: one SQLite tenant DB, a fresh real kernel per version), as a top-level describe:

  1. flat → composed: the module lists the edit, the App does not.
  2. composed → flat (rollback): the App lists the edit, the uninstalled module does not.
  3. CONTROL: a former owner that still ships the view lists its edit as today; the module lists nothing.
  4. NEGATIVE: another App's pair declaring HotCRM's App, and HotCRM's pair declaring the partner App: never listed under the module, the App or the partner.
  5. CONTROL: a pre-close row bound to the App is served at the module and listed under neither, before or after the move.
  6. The item lock answers for a moved edit at the module what it answers for the module's own edit (pinned, holds on main).
Red on main first (529e535, fix sources restored from main, tests kept): 2 failed | 10 passed (12)
× flat → composed: the module lists the edit saved under the App, and the App no longer does
  AssertionError: expected { module: [], app: [ [ …(2) ] ] } to deeply equal { module: [ [ …(2) ] ], app: [] }
  (received app: [["x3677e_case.default", "6.1.0"]], module: [])
× composed → flat (rollback): the App lists the edit saved under the module, though the module is gone
  AssertionError: expected { app: [], module: [] } to deeply equal { app: [ [ …(2) ] ], module: [] }
Tests  2 failed | 10 passed (12)

The lock pin passes on main: the lock half of the premise does not hold.

Ablations (fix committed first; scripts/ablation-replace.mjs, dist preflight, restore proven blob == HEAD each leg)

The runtime test reads @objectstack/metadata-protocol through its dist/, so each leg rebuilt it; ablation-dist-preflight.mjs found the marker in 2 built files before the run and in none of 24 after the restore build, with the tree clean. The legs ran on a local commit over #31653's branch head 0fad163d (identical to its squash on main for every file it touched) whose protocol-served-overrides.ts blob 0b23b796 is the one at this PR's head.

  • A. Moved candidate not read by the list (blob 0b23b796 → 2f6f269e): Tests 2 failed | 10 passed (12), cases 1 and 2. Restored 0b23b796 == HEAD.
  • B. Former-owner exclusion removed (→ a53e1f98): Tests 1 failed | 11 passed (12), case 1, the App lists the moved edit too. Restored == HEAD.
  • C. Moved candidate admitted without its predicate (→ 7dfc0eba): Tests 2 failed | 10 passed (12), cases 3 and 4, the module lists the App's still-shipped edit and the pair row declaring the partner App. Restored == HEAD.

Case 5 and the lock pin hold on main and guard behaviour this diff does not change, so no ablation is owed for them.

Acceptance notes

  • The package upgrade plan's override advice (listOverrides in @objectstack/objectql, feat(objectql): the package upgrade plan lists, as advice, each .custom override that hides a change of the upgrade #31627) reads this list, so it follows the same rule; its tests pass unchanged (package-upgrade-environment.test.ts).
  • Lock prose ranking: among several rows declaring the strictest lock, the row bound to the address's own package ranks first. A moved base row is bound to the former owner, so it ranks as another package's row; the lock value is unaffected, and a pair row ranks the same moved or not. Not changed here.

Verification

Head a135e658 (branch claude/project-thread-o96evq): fix 28e7e921 cut from origin/main 529e5351 after #31653 merged, then origin/main merged in at a135e658 (merge, no rebase; the two incoming commits touch plugin-auth and metadata, not this surface).

  • Build: pnpm install 0; pnpm build 119/119 (on 28e7e921); turbo build --filter ./packages/** 81/81 after the merge.
  • Tests: the suite-move file 12/12, with packages-customizations, dispatcher-plugin.package-customizations-mount and meta-legacy-pair-served: 4 files / 41 tests passed on a135e658. @objectstack/metadata-protocol 328 files / 22595 tests passed (4 files / 26 tests skipped) on 28e7e921. @objectstack/objectql package-upgrade-environment and protocol-meta 101 passed. Heavy runs through os-verify-lock.sh (VERDICT command-exit 0).
  • Typecheck: metadata-protocol 0, runtime 0 (runtime's check:test-typecheck first reported organization-ownership-boot-guard.turso-remote.kernel.test.ts, a known prerequisite: the optional peer driver-turso had no dist; built, re-run 0).
  • Lint: eslint --no-inline-config over the 2 changed sources and the test, exit 0.
  • Gates: dispatch-gates --commands derived 72 families; all 72 run on a135e658, each exit 0 (also on 28e7e921, where two first exited 3 on container prerequisites: the teardown self-test's fixture commit, fetched; dual-build-cjs-loads needs every dist, after pnpm build 0). dispatch-gates --ran: 72 derived, 72 run, 0 NOT-MEASURED, 0 UNRUN. check-platform-checklist --changed-from origin/main: OK, 0 lost.
  • Dogfood: not owed (no ! in the title, no narrowing arm).
  • test:repo: declared to CI, not run locally.

Generated by Claude Code

…der the package that serves it

After a suite move (ADR-0130 D4) a tenant's edit is served at the package
that ships the item now, but listServedOverrides took the package from the
pair override's declaration: listed under the former owner after a split,
under neither after a rollback. The list now picks each item's pair row
through the served reads' own candidates and predicates
(servedOverlayRowCandidates, holdsServedOverlayCandidate,
isMovedOverrideRowOf), so a package lists the override its address serves,
and only there. The item lock already reads every stored row of the item;
a pin holds that it answers the same for a moved edit.

Claude-Session: https://claude.ai/code/session_01ADHkmPHUhgip3YbMfQh27s
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 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

6 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
  • the SDK route bridge reached 65 of 231 client-bound route-ledger rows — the other 166 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 166: 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; 107 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 — 10 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 8c9260f79c5d060dfed58a92cc8f9b10a1762a5b → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 8c9260f79c5d060dfed58a92cc8f9b10a1762a5b

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#2 · os-steve · session_01ADHkmQKZzp4DLtqiCkZZRM

维护者速读

席位核对 — ACCEPT · domain:server#2 · Head-sha a135e658c194682da5333f893760a07f2f5ce45d · 2026-11-08T21:43Z

  1. Shape: draft to main, Fixes #31656; Clause-②: no, Metadata-protocol: none; patch changeset for @objectstack/metadata-protocol. Files: protocol-served-overrides.ts (+81 −23), protocol.ts (+1, host member), the runtime suite test (+93), the changeset.
  2. Premise: listing premise held, with the dev's correction: on main a flat → composed move listed the edit under the App (which no longer ships it), not the module; a rollback listed it under neither. Lock premise did not hold: overlayLockLayerAt already reads every active row of the item at any binding, so a moved edit already answers the same lock and the same ITEM_LOCKED; pinned, item-lock.ts unchanged, no save refusal changes (ruling 3).
  3. Read of the diff: each item's pair rows are judged together through servedOverlayRowCandidates + holdsServedOverlayCandidate, the pair candidates only (moved: 'base' and non-pair places skipped), in the served reads' spelling and package order. Ships is shippingPackageIds(shippedArtifactsOf(type, name, undefined, member)), the same reading findServedOverlayRow takes. A declared override at a former owner that no longer ships the item, held by a current shipper as its moved edit, is dropped from the former owner (ruling 2, "only there"). Same App only through the predicates (appOf), no id prefix; served-override.ts untouched (ruling 1). Two former owners: the predicate already admits neither, so the list holds neither.
  4. Gates: red on main 2 failed / 10 passed; green 41/41 (4 files); metadata-protocol 328 files / 22595 tests; 3 ablation legs each red then restored. Dev: 72 derived gates, all exit 0 at this head, 0 UNRUN. Check-runs on this head: 35 success, 13 skipped, 0 failed (Lint & Repo Gates, TypeScript Type Check, Test Core 8/8 included).
  5. Accepted deviation: protocol.ts +1 line (shippedArtifactsOf on the served-overrides host), outside the named surface; a forwarding member the call needs, no behaviour of its own. Accepted.
  6. Open questions, ruled: (1) a pre-D11 row bound to an App package is served at the new owner but listed nowhere: keep. The list stays the pair's rows, as an unmoved base-bound row is not listed today; pinned as CONTROL. (2) lock prose ranking for a moved base row: leave.
  7. Landing: Clause-② no, no governed path, so no contract review face. Ordinary queue landing: pr_ready + automerge_enable.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 8, 2026 21:44
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 8, 2026 21:44
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 8, 2026
Merged via the queue into main with commit bdfed89 Nov 8, 2026
49 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-o96evq branch November 8, 2026 22:10
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