Skip to content

fix(migrate): os migrate meta --stored judges a stored view's bulkActions with the declared actions, and is not green over a row served invalid - #39136

Merged
objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/issue-38923-stored-bulk-actions
Dec 2, 2026
Merged

objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/issue-38923-stored-bulk-actions

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #38923

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:运维在升级前跑「存储元数据检查」命令时,数据库里保存的列表视图若还带着已退役的批量操作配置,现在会被正确说明原因并判为不通过;能自动改写的会在应用模式下改写。
  • 为什么做:属于 18 升 19 的升级主线,替升级运维解决「检查结果显示全绿、升级后视图却被标为无效」的假绿问题。
  • 出错会怎样:最坏情况是检查结果偏严,某个与本次无关的无效存储行也会让检查失败,直到那一行被修好;改动只读判断和一处已有的改写路径,可以直接撤回。
  • 要你做什么:确认「任何被运行时判为无效的存储行都让检查不通过」这一范围(席位已按卡片预期裁定,保留你的否决权)。

What changes

A stored view's bulkActions, judged with the actions the deployment declares. os migrate meta --stored replays the conversion chain over each sys_metadata row on its own (applyConversionsToStoredItem wraps the row as { views: [row] }). So view-bulk-actions-to-action-selection saw no action and told every stored list its actions were "not declared as an action of that object", even where the package declares them. A new sibling module, packages/metadata-protocol/src/protocol-stored-view-selection.ts, runs the same entry again for such a row. It takes the entry from ALL_CONVERSIONS, the pattern collectDecisionModeReview uses, so the rule is not restated. This time the row has the deployment's declared objects (name, actions, actionLayout) and its object-bound standalone actions beside it, read from the registry the way the runtime's action listing reads them. The answer falls into three cases:

  • moves: the actions already carry selection and no arm is needed, so the entry writes only views[0].*. The row alone is the write: it is listed pending, and --stored --apply re-saves it through the existing saveMetaItem call;
  • declared: the entry would also write actions[i].locations or objects[j].actionLayout.selection. Those belong to the package, not to the row, so the row stays as stored. Its TODO says the actions ARE declared, names them, and gives both fixes: add 'selection' in the package source and deploy, or re-save the view without bulkActions;
  • left: an action is really undeclared, two lists order the bar differently, or the object already declares an arm. The entry's own reason stands, now given with the actions in view.

No packages/spec/src/** edit was needed.

Rows the runtime serves invalid, judged by the runtime's own check. The boot hydration (loadMetaFromDb) registers convertStoredItem(type, body) and warns [metadata_spec_invalid] when computeMetadataDiagnostics answers valid: false; the reads badge the row with the same verdict. The pass now asks that function, with no second rule, about every row whose body it reads. Not judged: identity skips (a non-canonical stored type, an organization-scoped row) and a row the chain yields no item of. On --apply a rewritten row is judged as rewritten. New, additive fields:

  • StoredMigrationRow.servedInvalid?: { path, message };
  • StoredMigrationReport.servedInvalid: number;
  • storedMigrationClean also requires servedInvalid === 0. A report from an older protocol carries no field and reads as 0;
  • the formatter prints one line per such row with its id, type/name, the refused site and the fix;
  • runStored prints why the run is red and exits 1. --json gains servedInvalid beside clean; nothing is renamed or removed.

A row that converts nothing and is served invalid is now listed skipped with that reason, where it used to be counted canonical.

Cost, stated plainly: a deployment holding an unrelated invalid stored row now goes non-green (exit 1) until that row is fixed; the line names the row and its fix. This includes a row whose only finding is a TODO no conversion can rewrite, such as a refused controlled_by_parent object, which used to be skipped and left the run green. The scope was ruled option A by the seat (mailbox PR #38811, comment 7344505672), on the card's Expected 2 and its runtime-predicate pin; the maintainer's veto window is open.

Kept exactly as they were: ruling C on #15429 (the decision review list), ruling A on #36055 (the View All Fields review list) and option A on stored permission sets. Both lists are still REPORT ONLY and move no count and no verdict, and a test pins the second one.

Files outside the per-card grant, edited because the change forces them (the seat may veto any of them):

  • protocol.stored-migration.test.ts: two fixtures/pins. The legacy flow fixture lacked label/type/edges and the runtime served it invalid, so I added the declarations. The cbp pin asserted the old "no verdict flips" rule, and it now asserts the ruled one (servedInvalid: 3, not clean);
  • protocol.migrate-stored-noncanonical-type.test.ts: a select field without options, which the runtime serves invalid, gains options. It also gets a module-top import '@objectstack/lint', which check:test-source-alias asks for now that the pass reaches the diagnostics;
  • scripts/engine-double-contract.pinned.json: the three rows --write adds for the new test's double.

Tests

  • New packages/metadata-protocol/src/protocol-stored-view-selection.test.ts (8 cases), over the stub engine with a registry holding the package's object and actions:
    • the card's row: TODO names the actions declared plus both fixes, servedInvalid at list.bulkActions, not clean;
    • actions carrying selection: pending on preview, then rewritten on apply (stored body has no bulkActions), then a clean re-run;
    • an undeclared action keeps the entry's reason;
    • the formatter line carries the id and the fix;
    • agreement: for every seeded row, servedInvalid equals !computeMetadataDiagnostics(type, convertStoredItem(type, body)).valid;
    • the View All Fields list moves no count or verdict;
    • the module answers unchanged with no registry, or with no TODO of the entry.
  • New packages/cli/src/commands/migrate/meta.stored-served-invalid.test.ts (3 cases): exit 1 with the row line and the red line; --json carries clean: false, servedInvalid: 1 and the per-row field; a control with the same skipped row served valid stays green (exit 0).
Readings (local, on the branch before the main merge; the merge brought no change to these packages)
  • pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2 (whole package): 380 files passed. The 3 failures it showed were the pre-existing pins above, fixed in this PR, and those files then passed (73/73).
  • metadata-protocol pins: 8/8; CLI stored tests (4 files): 11/11.
  • pnpm --filter @objectstack/metadata-protocol typecheck exit 0; pnpm --filter @objectstack/cli typecheck exit 0.
  • Ablations, each through scripts/ablation-replace.mjs, with the mutation shown landed and then restored (blob equal to HEAD, git diff HEAD empty):
    • the re-judgement call site off: 3 of 8 red;
    • the servedInvalid term dropped from storedMigrationClean: 3 red;
    • servedInvalidVerdict always answering valid: 6 red;
    • the CLI red line off: 1 of 3 red.

Acceptance notes

  • The reproduction on origin/main at a533126fb4, before this change: one stored view, reported skipped with the "not declared" TODO, storedMigrationClean true, while computeMetadataDiagnostics answered valid: false at list.bulkActions.
  • The registry read takes every declared object and action, not only the view's object. The entry itself groups by object, and a view row may list several objects.

Verification

Gates derived by node scripts/pm/dispatch-gates.mjs for this diff: 84 families, 80 run with exit 0, 0 unrun. The 4 NOT MEASURED families exited 3 (PREREQUISITE NOT MET: a full pnpm build is absent in this container): check:dual-build-cjs-loads, check:i18n, check:i18n-coverage, check:i18n-walk-parity. These belong to CI. check:engine-double-contract, check:objectql-double-limit and check:test-source-alias went red once on the new test file; each was fixed and re-run with exit 0. node scripts/pm/overlap-check.mjs: clean against origin/main and against #39131, which shares meta.ts.

Two-minute check: pnpm --filter @objectstack/metadata-protocol exec vitest run src/protocol-stored-view-selection.test.ts. Expect 8 passed, including the case that says the actions are declared and the run is not clean.


Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc

…actions; served-invalid verdict

Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc
Co-authored-by: Claude <noreply@anthropic.com>
…d the served-invalid verdict

Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc
Co-authored-by: Claude <noreply@anthropic.com>
…e serves invalid

Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc
Co-authored-by: Claude <noreply@anthropic.com>
…te through the dispatch contract

Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc
Co-authored-by: Claude <noreply@anthropic.com>
…the caller's limit

Claude-Session: https://claude.ai/code/session_01QSeKYoSKoNUygbCoMBTbGc
Co-authored-by: Claude <noreply@anthropic.com>
…ored pass now reaches it

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

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/cli, @objectstack/metadata-protocol, touching 26 documentable anchor(s).

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

  • content/docs/api/client-sdk.mdx (via getTypes (sdk, the bare tail of client method meta.getTypes, bound to GET /api/v1/meta), meta.getTypes (sdk, the route ledger binds it to GET /api/v1/meta))
  • content/docs/concepts/metadata-lifecycle.mdx (via migrateStoredMetadata (symbol, a method of class ProtocolSaveFacet))
What this run could not see
  • 2 anchor(s) matched too much of the corpus to be a work list: os migrate meta (command, 44 pages), /api/v1/meta (route, 56 pages)
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 71 of 254 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 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; 124 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 — 48 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 ffda6dab9e8f7ae6141fae4dbf74b3d9c20561e2 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json ffda6dab9e8f7ae6141fae4dbf74b3d9c20561e2

⚠️ 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 ffda6dab9e8f7ae6141fae4dbf74b3d9c20561e2 → 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@os-justin · os-justin · session_01QSeKYoSKoNUygbCoMBTbGc

Final green head for review · 2026-12-02T13:42Z
Head-sha: 71185f8783
Check-runs at this head: 39 success · 18 skipped · 0 failure · 0 pending.
Files: 10 (+855/−11), inside claim 7344150668 and its amendments (seat grants 7344128829, 7344505672).
Owed: L1 (seat session). Landing: zone build after ACCEPT, if not governed.
Card #38923 · dev reports 7344431752 (round 1) and 7346571036.
Points for the reader:

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

L1 ACCEPT · PR #39136 (#38923) · head 71185f87835b27218fe37627322dde8313a3230c · read 2026-12-02T13:44Z

席位核对 · ACCEPT

ACCEPT · repo:objectstack@os-justin · head 71185f87835b27218fe37627322dde8313a3230c

  1. Shape. l1-face --pr 39136: 13 items, none flagged. Draft, base main, first line Fixes #38923; the PR delivers Expected 1–2 of the card, so Fixes is right. No keyword binds another card.
  2. Surface and review route. Files are inside claim 7344150668 and the seat grants 7344128829 and 7344505672. The three fixture/pin files outside the grant are named in the body with their reason (a fixture the runtime now judges invalid; a pin of the old rule; the gate's own --write rows), and the seat accepts them. None of the four contract faces is touched: no Clause-②: yes, no narrowing declaration, no packages/spec/src/**, no governed rule text. So this is CI plus the seat's own read; no L2 is owed.
  3. One judge each.
    • The bulkActions re-judgement takes view-bulk-actions-to-action-selection from ALL_CONVERSIONS and runs it with the registry's declared objects and actions beside the row, with atRest: true. The rule is not restated. Writes beyond views[0] are classed declared (the package's write, so the row stays as stored, and the TODO names the actions and both fixes). A row whose only write is views[0] is moves (pending, rewritten on --apply). Leftover TODOs keep the entry's own reason (left).
    • The served-invalid verdict asks computeMetadataDiagnostics over the body the boot hydration serves: the converted item, or the stored body for a flow, with the page type default. No second rule. The agreement case pins servedInvalid === !valid for every seeded row.
  4. Ruled scope, read. Option A (seat 7344505672): every row whose body the pass reads is judged, and storedMigrationClean adds servedInvalid === 0 (?? 0 for an older report). The cost is stated in the changeset and the body: an unrelated invalid stored row now turns the run red, and a no-conversion invalid row moves from canonical to skipped. The 速读 leaves the maintainer's veto open.
  5. Kept rulings. C on A decision node with no declared config.conditions takes EVERY out-edge whose condition holds, in parallel — nothing enforces or warns that intended-exclusive edges partition #15429 and A on security (v19 major): View All / Modify All stop voting on fields — ADR-0087 conversion adds viewAllFields: true beside them, superuserFieldVote and security-superuser-field-mask-inert retire (step 3 of #34365, behaviour change) #36055 / stored sets: both review lists are still report-only and move no count or verdict, and a test pins the second.
  6. Changeset, read sentence by sentence.
    • "re-runs the same conversion … with the deployment's declared objects and actions beside it": true (item 3).
    • The three cases: true against judgeStoredViewBulkActions.
    • "--json gains servedInvalid … no existing field is renamed or removed": true. Both report literals gain the field; nothing is removed.
    • "Not judged: a non-canonical type, an organization-scoped row, a row the chain yields no item of": true (servedBody === undefined ⇒ {}; the identity skips return before the read).
    • The cost paragraph: true.
  7. Tests and evidence. 8 module cases and 3 CLI cases. Four ablations each turn their pins red, with blobs restored. The whole package (380 files) passes locally; the CLI and package typechecks exit 0.
  8. Gates at this head. 39 success, 18 expected skip, 0 failed, 0 pending; the floor checks pass. git merge-tree against current origin/main is clean. landing-k: K = 4 < 15.
  9. Docs Drift Check. metadata-lifecycle.mdx:204 says migrateStoredMetadata reports job rows skipped. That stays true; such a row is now also listed when the runtime serves it invalid. client-sdk.mdx is listed through meta.getTypes, which this PR does not touch. No page is falsified.
  10. Nits (not REWORK).
    • StoredMigrationReport.servedInvalid is a required field on an exported interface, so a consumer that builds a report literal must add it. It is output-only, and the clean check reads ?? 0. Making it optional is a judgement for a later card, not this one.
    • The !overlayAllowed skip branch now converts the body once more to judge it. That is a cost per skipped row only.
  11. Landing. check-governed-merges --pr 39136: NOT governed, 0 of 10 paths. Size +855 / −11 = 866 lines; the card total stays ≤ 3000. No ! and no narrowing, so no dogfood battery is owed. The zone lands it.

Clause-②: no · Metadata-protocol: none

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYoSKoNUygbCoMBTbGc

Landing · 2026-12-02T13:45Z · head 71185f8783

  • L1 ACCEPT 7347397755 at this head (seat session); no L2 owed. No earlier landing comment on this PR.
  • check-governed-merges.mjs --pr 39136: NOT governed; +855/−11 ≤ 3000.
  • Check-runs at this head: 39 success · 18 skipped · 0 failure (comment 7347329387).
  • landing-k.mjs --pr 39136: K = 4 < 15, OK.
  • Action: pr_ready + automerge_enable.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 2, 2026 13:46
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 491ea82 Dec 2, 2026
58 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-38923-stored-bulk-actions branch December 2, 2026 14:12
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