Skip to content

feat(spec)!: actions that act on many records are placed at selection; a list view's bulkActions is retired - #38550

Merged
os-zhuang merged 26 commits into
mainfrom
claude/project-thread-kko9wu
Nov 30, 2026
Merged

os-zhuang merged 26 commits into
mainfrom
claude/project-thread-kko9wu

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Fixes #36496

Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: #38552

维护者速读

  • 用户能看到什么变化:同一对象的每个表格视图里,勾选多条记录后出现的批量操作栏都一样了,按对象统一配置的顺序排列;以前只在个别视图里出现的批量按钮,现在其它表格视图也会出现。表格里的内置「批量删除」改为跟随对象的删除权限,不再跟随视图清单:有 4 个视图以前清单里没写 delete、所以不显示批量删除,现在会对有删除权限的人显示——showcase 的 showcase_field_zoo 的 default 和 gated_columns(仅管理员),HotCRM 的「All Leads」和「All Contacts」(Sales Manager 与 System Administrator)。这是按你的裁决(7268555255「接受并写明」)接受并写明的变化。非表格的列表(看板、日历等)现在要接上行删除(operations.delete / onDelete)才会出现批量删除;两个仓库里现有的非表格视图没有一个受影响。
  • 为什么做:批量操作以前要在每个视图上各写一份清单,容易漏、顺序也不一致;现在由操作自己声明「可用于多选」,对象统一排序,替作者省掉逐个视图维护的麻烦。
  • 出错会怎样:旧写法在加载时会被拒收并给出改法,升级工具能自动搬迁源码,并逐个点名上面这类会多出批量删除的视图;已存进数据库的视图记录不会自动改,会列为待办;按钮出现得比以前多属于预期,可回退本次合并撤回。
  • 要你做什么:无。

What changes

  • Spec. New action location selection (one dispatch per selected record). New third arm on the object's actionLayout: selection: { pinned, more } orders the multi-select bar. view.list.bulkActions and object.listViews.*.bulkActions are retired with retiredKey() tombstones (parse and tsc refuse them with the prescription). bulkActionDefs stays on the view, unchanged.
  • Where selection is refused. A record:quick_actions bar's own location excludes record and selection (RecordQuickActionsLocationSchema). An action written on a page component (action:button / action:icon locations, an action:group member's locations, and the group's own location filter) takes the new PageComponentActionLocationSchema, which is every action location but selection: such an action runs once, with no selection. Each refusal carries a prescription naming the places it takes.
  • Retirement kit (ADR-0087). Protocol-19 conversion view-bulk-actions-to-action-selection: it adds 'selection' to each listed action's locations, strips the key, and writes the selection arm only when the lists' order differs from the default order. A list that names delete on a view with authored bulkActionDefs gets a { name: 'delete', operation: 'delete' } def so the view keeps its Delete. A view that gains the built-in Delete is named in a notice. Also: two RETIRED_KEYS_BY_MAJOR entries, the D3 semantic entry view-bulk-actions-declared-on-the-action, liveness rows (view list.bulkActions dead/REMOVED, object actionLayout.selection.* added), and regenerated baselines, docs, metadata form and i18n bundles.
  • Lint. action-dispatch-contract-mismatch judges actions placed at selection against execution; validate-object-action-layout checks the selection arm; validate-action-name-refs / validate-action-locations stop walking the retired key.
  • objectui. selectionBarActions() builds the bar from the object's actions placed at selection, ordered by the arm (pinned, then more, then order and served order); an authored bulkActionDefs entry claims its name first. ObjectGrid, SelectionBar, ListView (non-grid bar) and the app-shell header/toolbar/tabs read it. ListViewSchema.bulkActions is never; the list-view block's bulkActions input is removed. Studio's location dropdown offers selection; the action:group location enum and the quick-actions dropdown do not.
  • Built-in bulk Delete (ruling 7268555255). A grid draws it wherever the object allows a delete, on every view whose authored bulkActionDefs are empty after the permission filter (the same count main used). A view with defs that remain draws it only through a { name: 'delete', operation: 'delete' } def. actionLayout.selection.pinned: [] moves it into 「More」.
  • Left as they are (seat ruling 05:06Z): the object-grid page component's bulkActions / batchActions keys, now on their own z.array(z.string()) schema (same describe) instead of a reference to the retired view slot.

Per-object list: views that gained the bar or the Delete

  • showcase_task: 8 grid views, none sets selection, so multi-select is on for all. The 7 views other than bulk_actions (default, in_progress, urgent, done, legacy_row_actions, tabular, grid) now draw showcase_mark_done and showcase_recalc_estimate; bulk_actions draws the same two in the same order as before.
  • showcase_field_zoo: inline_bulk_defs gains the 10 predicate-gate actions; showcase_zoo_visible_string is drawn once, by that view's aggregate bulkActionDefs entry, which claims the name. default and gated_columns listed actions but not delete and have no defs, so they now draw the built-in bulk Delete (administrators only).
  • HotCRM (sister repo, not touched here; ported by hotcrm#2860): crm_lead all_leads and crm_contact all_contacts gain the built-in bulk Delete for Sales Manager and System Administrator. crm_opportunity's 6 grid views are unchanged.

Rework round (contract review 7268177634)

  • M1, built-in bulk Delete. Fork measured: a list naming delete beside authored defs = 0 views; views gaining Delete = 4 (listed above); unchanged = HotCRM opportunity's 6 grids and showcase_task bulk_actions. Ruled option 1 (7268555255, accept and declare). The renderer rule stays. The changeset, the D3 entry, the tombstone prescription and every conversion TODO state the rule, the bulkActionDefs exception and the operation: 'delete' route. The conversion appends the delete def where it is needed and names each gaining view.
  • Confidence gap. Resolved by counting authored defs after the verdict filter, as main did, not before it. Pinned by plugin-grid/src/__tests__/bulkImplicitDeleteVerdict-36496.test.tsx (red on the old count): with delete but no edit permission an update def is filtered out and the built-in Delete stays; with both, the def draws and Delete gives way.
  • S1. "bulkActionDefs lead the bar" now says what happens with and without the arm: without it, the defs lead the bar; with it, only pinned names are buttons and the defs lead 「More」. Changed in the changeset, the D3 entry, the tombstone, object-action-layout.ts, the metadata-form helpText (en, zh-CN, ja-JP, es-ES) and the liveness note.
  • S2. PageComponentActionLocationSchema (see What changes), with a new isomorphic alias pin (881).
  • S3. Dogfood rerun at the new head (Tests below); the stale block-config.test.ts:365 note is gone, since the quick-actions exclusion landed in c2b58680e0.
  • N3. The ui-action.ts comment no longer points at the retired bulkActions list.
  • Merges. Main merged into the branch again, merge only (latest d2caaec40d, feat(spec,ui): object pinOverview keeps the wide record page from pinning its overview #38679 pinOverview), no rebase; generated artefacts taken from main and regenerated from the merged tree. The last merge's only hand resolution: four *.source-hashes.generated.ts files keep both sides' keys, and the translation census counts both new rows (870).
  • Changeset. Adds @object-ui/components and @object-ui/plugin-detail (patch) for the location enums.

Tests

Head aceacfe469 unless a line names another. Since e743d38e58 the branch has only merged main (merge only, generated artefacts regenerated). Before that, ca26068250 was the head before the merge that brought #38679.

  • @objectstack/spec test: 1008/1008 files, 30527 passed (1 todo), at e54ad9700c before the docs-only ba1cb7df90 and the main merge. Conversions alone at the head: 27 files, 838 passed. Typecheck 0.
  • @objectstack/platform-objects test: 130/130 files, 2221 passed.
  • objectui from ui/, --maxWorkers=3: plugin-grid, components (action renderers and __tests__), app-shell metadata-admin, plugin-list, plugin-view, plugin-detail, types: 2084 files passed / 2 skipped, 21260 tests passed / 26 skipped. plugin-grid type-check 0.
  • Gates derived by dispatch-gates --commands on this round's paths: 143 commands, all exit 0 after fixes. Three were red on first run and fixed: check:spec-parsed-alias (new alias pin), platform-objects (an i18n extract had reverted authored translations; restored), and the UI suite (timeout, rerun green above).
  • After the last main merge (e743d38e58): check:generated, check:docs, check:i18n, check:spec-parsed-alias and check-sdui-manifest exit 0; platform-objects translations 625 passed; spec src/data/object, src/conversions, src/ui: 238 files, 8093 passed. objectui plugin-detail (from ui/, --maxWorkers=3): 423 files passed / 1 skipped, 4007 tests passed / 18 skipped.
  • Dogfood battery (pnpm --filter @objectstack/dogfood test, under the verify lock, no shard, no path) at the head aceacfe469, closure rebuilt first: VERDICT command-exit 0, Test Files 495 passed / 3 skipped (498), Tests 4187 passed / 68 skipped (4255), no failures. Same reading at e743d38e58 and 29fb45c64b.

Acceptance notes

  • Q1, Delete in the bar: maintainer ruling 7268555255 (accept and declare). The built-in Delete follows the object's delete permission wherever a view has no authored defs left after the filter. The four views above gain it, and that is expected. actionLayout.selection.pinned with Delete left out moves it into 「More」. The alternative, actions placed at selection suppressing the implicit Delete the way an authored bulkActionDefs entry does, was not taken.
  • Ordering. With pinned set, a view's own bulkActionDefs entries sort into 「More」.
  • Behaviour change, non-grid. Before, a non-grid ListView could offer grid bulk Delete through a list. It now needs the row delete wiring (operations.delete / onDelete). No non-grid list view lists any bulkActions: objectstack has 0 (at 9e5be7bb4612; all 3 lists are on grid views) and HotCRM has 0 (at 2b74490b9f25; all 8 lists are on grid views).
  • Q2, kept by ruling, not by use. bulkActions stays in the objectui#5097 host-composition exemption (27 keys, a maintainer ruling), relayed off the host node only. ListView no longer reads it. Dropping it changes the ruled count; that question is carried by ListView no longer reads bulkActions after #36496, but it stays on the objectui#5097 host-composition exemption list (OBJECT_VIEW_HOST_COMPOSITION_KEYS) #38554.
  • Header pins panel. The Studio header pins panel still arranges only the two header arms. A save keeps a held selection arm (new test). Arranging the selection arm in Studio is not in this PR.
  • Checklist. records-forms.action-location-matrix gains the selection variant (revision 20, enumSource.expect 7). The new leg has not been run in a browser.
  • Not browser-measured. The bar on non-grid views. Those draw the same set only where their renderer offers multi-select.
  • The record:quick_actions bar does not take selection (seat repo:objectstack#5 ruling A). Done: the bar accepts the same set as before Bulk actions declared on the action (selection) with a selection arm in the object action layout, moved from view bulkActions #36496 (record_page, record_row, record_related, record_section, list), and location: 'selection' is refused with a prescription naming those places. The Studio dropdown and the SDUI manifest follow; the bar's Clause-② is unchanged.
  • Stored rows. A stored view row arrives without its object's actions, so the conversion leaves it as stored and reports a TODO.

Verification

Files to read first (by risk):

  1. ui/packages/plugin-grid/src/resolveBulkActions.ts — selectionBarActions(), the ordering and the name-claim rule.
  2. ui/packages/plugin-grid/src/ObjectGrid.tsx — the implicit Delete counted after the verdict filter.
  3. packages/spec/src/conversions/entries/19/view-bulk-actions-to-action-selection.ts — when the arm and the delete def are written, the gaining-view notices, and the TODO cases.
  4. ui/packages/plugin-list/src/ListView.tsx — the non-grid bar now built from selection plus a permitted Delete.

Two-minute check: pnpm --filter @objectstack/spec exec vitest run src/conversions should report the conversion fixture passing; in the showcase, open Tasks → any grid view, select two rows: the bar shows Mark Done and Recalc Estimate.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JQwxbXrFACZU7uBEGoSEVd

…d keeps the selection arm as held

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5oz5vp6AYi9MqMxvmK
…data-form bundles after the main merge

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5oz5vp6AYi9MqMxvmK
…LOCATIONS has seven words)

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5oz5vp6AYi9MqMxvmK
…out.selection row

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

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/lint, @objectstack/platform-objects, @objectstack/spec, touching 84 documentable anchor(s). ⚠️ 20 changed file(s) yielded no anchor (packages/lint/src/validate-list-view-field-refs.ts, packages/spec/api-surface/ui.json, packages/spec/authorable-surface/ui.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

33 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 95ffacc2c51903a4553108455c688133c22b044d.

⛔ 9 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 20 changed file(s) yielded no anchor (packages/lint/src/validate-list-view-field-refs.ts, packages/spec/api-surface/ui.json, packages/spec/authorable-surface/ui.json, …) — pages documenting those are invisible to this run
  • 19 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 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 — 182 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 95ffacc2c51903a4553108455c688133c22b044d → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 95ffacc2c51903a4553108455c688133c22b044d

⚠️ 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 95ffacc2c51903a4553108455c688133c22b044d → 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#5 · os-project-manager · session_01FEkQ5oz5vp6AYi9MqMxvmK

CI on head 6fee5a08a9 · 2026-11-29T09:30Z: Test UI (2/16) is red, and the failure belongs to this PR. ui/packages/app-shell/src/views/metadata-admin/previews/__tests__/block-config.test.ts:365 ("record:quick_actions location: offers exactly the locations the spec declares") expects the Studio dropdown to equal ACTION_LOCATIONS. This PR adds selection to ACTION_LOCATIONS, and the dropdown (block-config.ts:628) does not offer it. 449 of 450 files passed on that shard.

What blocks the fix: the bar's location is ActionLocationSchema, so the spec now also accepts location: 'selection' on a record:quick_actions bar. Whether that bar may take selection at all is a contract question, and it is with the area and seat now. #38541 changes the same schema and dropdown (RecordQuickActionsLocationSchema = ActionLocationSchema.exclude(['record'])), so the fix lands on top of it. No fix is pushed until that ruling.

@os-zhuang
os-zhuang added this pull request to the merge queue Nov 30, 2026
Merged via the queue into main with commit acf3b33 Nov 30, 2026
87 checks passed
@os-zhuang
os-zhuang deleted the claude/project-thread-kko9wu branch November 30, 2026 11:30
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 30, 2026
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…ce.documentBy`); record search groups by it by default (objectstack-ai#38564)

<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XDXvJPPtrTGfdDYhWWpihq5)_

Part of objectstack-ai#38537
Clause-②: yes (widening)
Metadata-protocol: added

## 维护者速读

- 用户能看到什么变化:知识源可以声明“文档单位”(指向父记录的字段);AI
按记录检索时,同一份父记录(如一份制度)下的多条子记录(条款)只返回一条命中,原来是每条子记录各一条;Studio
知识源表单多了一个“文档单位”选择框。
-
为什么做:属于“知识源声明文档单位、按父记录计数与聚合”专题,替把段落写成子记录的应用(例如制度下的条款)解决按记录检索时同一份制度刷屏的问题,也是云端按父记录计文档数的前置。
- 出错会怎样:只有声明了该字段的知识源受影响,索引内容不变、不触发重建;若分组有误,AI 检索会多返回或少返回命中,删掉该字段即恢复原行为。
- 要你做什么:无。

## What changes

PR 1 of 2 for the card. This PR lands the key, its parse rule, its
save-time refusal and its first reader; the `os validate` rule (in the
lint package, held by another seat until it is released) is PR 2, which
closes the card.

- **Spec** — `ObjectKnowledgeSourceSchema` gains `documentBy?: string`.
A refinement refuses a value that `metadataFields` does not list, with a
message that names the field, the list, and the fix (add it to
`metadataFields`, name a listed field, or remove the key). The
refinement is a cross-key rule JSON Schema cannot state, so it is
ledgered in `dropped-refinements.baseline.json` (two schemas plus the
four installed-package response schemas that embed a source; header
totals updated).
- **Parent-link rule, exported** — `knowledge-search-scope.ts` now
exports `parentLinkRule(schema)` (the rule `scopeTermsFor` already used,
factored out of the private `parentLinksOf`, which now calls it; scope
behaviour unchanged) and `documentUnitOf(field, schema)` (the rule plus
"not `multiple: true`"). Both are pure functions of the object
definition, so PR 2 can call them with no knowledge service.
- **Save door** — `admitAuthoredSource` refuses a `documentBy` that
`metadataFields` lists and that is not a single-valued parent link: `400
VALIDATION_ERROR`, `field` set, after the "does not exist" arm and
before every permission arm. The sentence is built by
`documentUnitRefusalText` in `knowledge-source-admission.ts`, one
wording per reason (undeclared, withheld, not a link, no readable
target, multiple). A `documentBy` that `metadataFields` does not list is
left to the parse, which already names that fix.
- **Reader (ADR-0049, ADR-0161 K4)** — in `searchByKey`, with record
granularity and no `groupBy`, `groupKeyOf` now asks `documentKeyOf(hit,
documentBy)`: `parent:SOURCE#VALUE` when the hit's source declares
`documentBy` and the hit carries a parent, else the existing per-record
key. The explicit `groupBy` path, `sourcesGroupableBy` and chunk
granularity are untouched.
- **Tool** — `hitOf` sets `groupValue` to the parent under the default
grouping too (absent for a record with no parent). `documentUnitValueOf`
is the one predicate both the service key and the tool read. Like its
`groupBy` arm, the tool serves the parent only for a source that lists
`documentBy` in `metadataFields`.
- **Hashes** — `documentBy` is in neither the index fingerprint nor the
recipe hash (both enumerate their inputs explicitly);
`__tests__/index-fingerprint.test.ts` is unchanged and green.
- **Form** — the form-coverage gate
(`metadata-form-zod-reconciliation.test.ts`) refused the key without a
form row, so the single picker is added beside `metadataFields`
(`widget: 'field-ref'`, `dependsOn: 'object'`) with its form test.
**This folds in the form half of objectstack-ai#38538**; the docs and `skills/**` half
stays there. The row brings its regenerated translation bundles (ja-JP,
es-ES and zh-CN authored, the rest the extractor's fill) and the
catalog's positive-control count (866 to 867).
- Regenerated: authorable-surface, the reference page, the liveness
ledger row and counts.
- **Changeset** — `minor` for `@objectstack/spec` (the new authorable
key), `@objectstack/service-knowledge` (the reader and the save refusal)
and `@objectstack/platform-objects` (the form row's translated label and
help), with `Metadata-protocol: added`: a new key a metadata author can
write.

## Zone 2 choices

- **Where the parent value is read from:** the hit's own
`metadata[documentBy]`, the value assembly stored beside the passage.
The parse holds `documentBy` in `metadataFields`, so every hit of such a
source carries it; grouping runs over the hits the adapters already
answered and reads no record (SQL first: no per-hit read was added). The
freshness check and the permission re-check are unchanged.
- **Default key spelling:** `parent:` + index key of the hit's source +
`#` + `String(value)`. The source key keeps two sources apart on equal
parent ids; the `parent:` prefix keeps it apart from `record:` and
`document:` keys; `String()` compares values as a scope term does. A
value that is absent, null, empty, or not a string or finite number
falls back to the per-record key, so those records are never dropped.
- **Form row:** forced by the gate (it reported
`knowledge_source.source: accepted by the Zod but unauthorable in the
form — documentBy`), so it is in this PR.

## Acceptance

| Card acceptance line | Test |
|:--|:--|
| Parse refuses `documentBy` absent from `metadataFields` |
`knowledge-source.test.ts` › "refuses a `documentBy` that
`metadataFields` does not list…", "…when `metadataFields` is omitted…" |
| Save refuses a text field, a `user` field, an `internal` lookup and a
`multiple` lookup, each naming the fix | `document-by-38537.test.ts` ›
"refuses a text field / a user field / an internal lookup / a multiple
lookup, 400 VALIDATION_ERROR, naming the field and the fix" (+ positive
controls: lookup and master_detail admitted) |
| 6 records under 2 parents + 1 null parent, record granularity, topK 10
→ 3 hits | `document-by-38537.test.ts` › "6 records under 2 parents plus
1 with no parent…: 3 hits" |
| Explicit `groupBy: 'clause_hash'` unchanged; a source without
`documentBy` unchanged | `document-by-38537.test.ts` › "an explicit
groupBy is answered as before…", "a source without documentBy is
answered as before…", "chunk granularity is answered as before" |
| Fingerprint pins unchanged | `index-fingerprint.test.ts` unchanged and
green; `document-by-38537.test.ts` › "the fingerprint and the recipe
hash are the same with and without documentBy" |
| Default key includes the source; `hitOf` sets `groupValue` | "two
sources never share a group…", "search_knowledge: each hit carries its
parent as groupValue…" |

## Ablation

Both legs run with `scripts/ablation-replace.mjs` (mutation verified on
disk, restore verified as blob equal to HEAD and an empty `git diff
HEAD`). No build was needed: both suites import the subject from `src/`.

<details><summary>Reader reverted (default key back to the per-record
key): 4 red</summary>

Anchor `if (groupBy === undefined) return documentKeyOf(...)` replaced
with `return recordKeyOf(hit)` in `knowledge-service.ts`.
`document-by-38537.test.ts`: 4 failed / 12 passed — the 3-hit test, the
empty-parent test, the two-sources test and the `groupValue` test.
Restored: blob c98a036 equals HEAD.
</details>

<details><summary>Parse rule removed (the refinement dropped): 2
red</summary>

Anchor `.superRefine(refuseDocumentByOutsideMetadataFields)` removed
from `knowledge-source.zod.ts`. `knowledge-source.test.ts`: 2 failed /
35 passed — both refusal tests. Restored: blob 211cb6d equals HEAD.
(A first attempt was refused by the tool before running anything,
because its replacement text already occurred in the file; it was re-run
with a distinct replacement.)
</details>

<details><summary>Delta round 1: the tool's metadataFields guard
removed: 1 red</summary>

The condition `&&
objSource.metadataFields?.includes(objSource.documentBy)` removed from
`hitOf` in `knowledge-tools.ts` (on-disk count 0).
`document-by-38537.test.ts`: 1 failed / 16 passed, the stub-service test
("expected … to not have property groupValue"). Restored from a copy
(on-disk count 1) before commit `12cd7dc8a6`, whose blob `e49165a005`
carries the condition. This leg used a copy-and-restore, not
`ablation-replace.mjs`.
</details>

## Tests

**Delta round 1 (contract review 7254573293, PASS with S1 open), head
`e0ebb9ad8e`.** S1: the `documentBy` docblock names the save refusal
alone, and says a source registered in code or installed with a package
meets no save and is not judged yet. N1: the docblock and the changeset
say where each surface carries the parent: `metadata[documentBy]` on
`IKnowledgeService.search`, and also `groupValue` on a
`search_knowledge` hit. N2: the form help reads "Setting it rebuilds
nothing; adding the field to Filter fields does." The changeset says the
same, and the zh-CN, ja-JP and es-ES help is retranslated. The eleven
bundles are regenerated: `check:i18n` reports all in sync, and
`check:i18n-stale-fill` finds no new stale fill. N3: the `hitOf` guard,
pinned by one stub-service test with a positive control. Claim widening:
the contract TSDoc and the tool description above. Readings on
`e0ebb9ad8e`:
- `@objectstack/service-knowledge`: test 23/23 files, 803/803 tests; the
new test file 17/17 after its type fix; typecheck exit 0.
- `@objectstack/spec` test: 913/913 files, 28896 passed, 1 todo.
- `@objectstack/platform-objects` test: 130/130 files, 2218/2218 tests.
- spec `check:generated`: all 14 artifacts up to date, against a dist
built after the spec edits.
- Changeset and byte gates, each exit 0: `check-changeset-no-major` with
this body as its event payload (level axis `yes (widening)` / `added`),
`check-empty-changeset`, `check-adr-0087-registration`,
`check-changeset-fixed`, `check-nul-bytes`,
`check-spec-docblock-symbol-anchors`.
- overlap-check: origin/main merges cleanly; it conflicts only with
objectstack-ai#38550 and objectstack-ai#38497, on the hand-maintained counters as before.

**Delta round 1, second commit, head `43de68d58f`.** The claim was
amended to add the `topK` TSDoc and the tool's `granularity` input
description. Both now say what the fixed docblocks say: "for a source
that declares `documentBy` (its document unit), one hit per parent
record instead". So do the other record-unit sentences in the two files
(see Acceptance notes). Readings on `43de68d58f`:
- `@objectstack/service-knowledge`: test 23/23 files, 803/803 tests;
typecheck exit 0. This covers the `granularity` refusal sentence: no
test pins its text.
- spec `check:generated`: all 14 artifacts up to date, against a dist
built after the edit.
- `check-spec-docblock-symbol-anchors` and `check-nul-bytes`: each exit
0.
- overlap-check: unchanged (origin/main clean; conflicts only with
objectstack-ai#38550 and objectstack-ai#38497 on the counters).

The `@objectstack/mcp` knowledge-tool tests compare the listed
description with the definition itself and pin no text, so they were not
re-run here.

Earlier, the head was `5bbac4b457`, a clean merge of main that brings in
objectstack-ai#38509 (the record sync change in `knowledge-service.ts`). Re-checked on
that head: `@objectstack/service-knowledge` test 23/23 files, 802/802
tests; its typecheck exits 0; `@objectstack/spec` `check:generated`
reports all 14 artifacts up to date; overlap-check finds origin/main
merges cleanly. Below it, `231e7c6339` changes only the changeset (level
`minor`, `Metadata-protocol: added`); the changeset families were re-run
there (`check-changeset-no-major` with this body as its event payload,
`check-empty-changeset`, `check-adr-0087-registration`, all exit 0). The
gate union was re-run after the last code commit, at `a92874657e` (the
translation commit landed while it ran, and the families that read it,
`check:i18n`, `check:i18n-stale-fill` and `check:nul-bytes`, were run
again on `a92874657e`).

<details><summary>Package suites and typecheck</summary>

- `pnpm --filter @objectstack/service-knowledge test` — Test Files 23
passed (23), Tests 788 passed (788). `typecheck` (tsc + test layer) —
exit 0.
- `pnpm --filter @objectstack/spec test` — Test Files 912 passed / 1
failed (913), Tests 28895 passed / 1 failed: the dropped-refinements
ledger's header totals; corrected, `scripts/dropped-refinements.test.ts`
re-run 30/30. `typecheck` — exit 0.
- `pnpm --filter @objectstack/platform-objects test` — Test Files 130
passed (130), Tests 2218 passed (2218). `typecheck` — exit 0.
- `pnpm --filter @objectstack/spec check:generated` — two stale
artifacts found (reference page, liveness counts), regenerated with
`--fix`, re-checked green.
</details>

<details><summary>Derived gate families (dispatch-gates --commands,
120)</summary>

`node scripts/pm/dispatch-gates.mjs --ran` — "120 derived, 120 run, 0
NOT-MEASURED, 0 UNRUN"; every family exit 0 on the re-run. On the first
run three families refused with exit 3 (prerequisite not met: no built
CLI, client-react or package dists); each was built and re-run green,
and `check:i18n` then reported the form row's bundles drifted,
regenerated in this PR.
</details>

Not run locally: `check:i18n-coverage` (not derived for this diff;
prerequisite needs the example apps built) and every CI-only family; CI
reports them on this PR. Dogfood: n/a (no `!` in the title, no
`(narrowing)` arm).

## Acceptance notes

- **Files beyond the original claim's list, each forced by a Zone 1 line
(recorded by the claim amendment on the card):** the save refusal is
wired in `admitAuthoredSource` in `knowledge-service.ts` (the save-time
admission lives there, not in `knowledge-source-admission.ts`, which
holds the sentence); `dropped-refinements.baseline.json` (the parse rule
is a refinement, which the spec build refuses unledgered); the
platform-objects translation bundles and the catalog positive control
(forced by the form row the gate required).
- **Spec contract prose:** with the widened claim, this PR now updates
the TSDoc of `KnowledgeSearchOptions.granularity` and `groupBy`
(`packages/spec/src/contracts/knowledge-service.ts`) and the
`search_knowledge` description: a source's `documentBy` sets the unit
for record-level results. After the claim's second amendment, every
other sentence in those two files that stated the record-level unit as
"record" now names the document unit too: the `topK` TSDoc and the
`groupBy` "instead of by record" line in the contract; in the tool, the
`topK`, `granularity` and `groupBy` input descriptions, the matching
`SearchKnowledgeInput` and `SearchKnowledgeOutput.hits` TSDoc, and the
`granularity` refusal sentence. Left for objectstack-ai#38538, outside those two
files: `content/docs/ai/knowledge-rag.mdx` (the `granularity` row) and
`content/docs/protocol/knowledge.mdx` (the record-level paragraph).
- **Not judged:** a source registered in code passes the parse
(membership in `metadataFields`) but no save door, so the parent-link
rule does not judge it; PR 2's `os validate` rule covers packaged
sources.
- **For PR 2 (the `os validate` rule), left undecided here:**
`@objectstack/lint` does not depend on `@objectstack/service-knowledge`,
and `parentLinkRule` / `documentUnitOf` are pure over the object
definition (they read `@objectstack/core`'s withheld-field collectors
and the spec's `referenceTargetOf`). Two ways for PR 2 to call them: (A)
add the `@objectstack/lint` to `@objectstack/service-knowledge`
dependency and import the functions, which first need a line in that
package's `index.ts`: today they are module exports only, not on its
`exports` surface; (B) move the pure rule to a package lint already
reads (for example `@objectstack/core`) and have
`knowledge-search-scope.ts` import it from there. PR 2 chooses.
- **Live check:** no pgvector or turso live suite touches record
granularity or `groupBy` (grouping runs in the service over adapter
answers), so no live cluster was started.
- **Overlap:** `overlap-check` is clean against `main` and objectstack-ai#38509
(shares `knowledge-service.ts`). It reports textual conflicts with two
open drafts on hand-maintained counters: objectstack-ai#38550 (the dropped-refinements
ledger and the catalog positive control) and objectstack-ai#38497 (the positive
control). Whichever lands second re-applies its lines.

## Read first

1. `packages/services/service-knowledge/src/knowledge-service.ts` —
`groupKeyOf` / `documentKeyOf` (the reader) and the new arm in
`admitAuthoredSource`.
2. `packages/services/service-knowledge/src/knowledge-search-scope.ts` —
`parentLinkRule` replaces the body of `parentLinksOf`; check the scope
still behaves the same.
3. `packages/spec/src/ai/knowledge-source.zod.ts` — the key and its
refinement.

**Two-minute check:** `pnpm --filter @objectstack/service-knowledge exec
vitest run src/__tests__/document-by-38537.test.ts` — 16 passed,
including "…: 3 hits, each parent's best and the orphan".

Session: https://claude.ai/code/session_01FEkQ5oQLfL8thb6wtUHnTb

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- signed: repo:objectstack#5 · os-project-manager ·
session_01FEkQ5oQLfL8thb6wtUHnTb -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…the engine accepts it (objectstack-ai#38635)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9JeHmqv6CKCkW8ewrPBLekk)_
Refs objectstack-ai#38433 (items 1, 2)
Clause-②: no
Metadata-protocol: none

## 维护者速读

- 作者与智能体在校验或保存看板视图时看到的修复建议变了:分组字段是多值、JSON
存储或公式字段时,不再建议改用表格分组,而是建议改用表格列;普通文本、数字、日期字段的建议不变。
- 属于看板分组字段校验规则的复核跟进:原建议会把作者引到一个打开即报错的表格分组。
- 只是提示文字和规则说明变了,不改任何校验结论或严重级别;出错时作者只会读到不准确的建议,可直接撤回。
- 无。

## What changes

`list-view-kanban-group-field-uncategorical` now offers the
grid-grouping remedy only on the branch where it holds.

- **Hint** (`checkKanbanGroupField`,
`packages/lint/src/validate-list-view-field-refs.ts`): the tail is keyed
on the engine's own refusal set, read from the same spec predicates the
two `engine.aggregate` doors use:
- multi-valued (`isMultiValueField`, the multi branch) and
structured-JSON (`STRUCTURED_JSON_TYPES`) are refused by
`assertGroupByNamesNoJsonStoredField`;
- virtual `formula` (`isVirtualSearchField`) is refused by
`assertGroupByTargetsAreStored`;
- both answer `400 INVALID_FIELD`. A list view `grouping` compiles to
that group-header query (`compileListViewGroupQuery`), which the grid
sends.
- For those three classes the hint now ends `or show "FIELD" as a grid
column (a list cannot be grouped by REASON)`; every other warned field
(text, number, date and the rest of the stored single-valued scalars)
keeps `or show "FIELD" as a grid grouping`.
- **Explanation** (`rule-explanations.ts`, this rule's entry only): the
fix paragraph now says the same, branch by branch: stored single-valued
field gives grid grouping; multi-valued, JSON-stored or `formula` gives
grid column only, with the reason.
- Measured from the rule's code: before this PR a JSON-stored or
`formula` group field already warned, on the **single-valued** branch
(it is not in `KANBAN_CATEGORICAL_TYPES`), and got the grid-grouping
tail. No finding, severity or accept set changes.
- **N2 (item 4), decided: keep the short list deliberately.** `select`,
boolean and lookup are the heads of the three families the rule accepts
(`select`/`radio`, `BOOLEAN_VALUE_TYPES`, `REFERENCE_VALUE_TYPES`).
Naming each member would hand-copy `KANBAN_CATEGORICAL_TYPES` into prose
that drifts from it, and would lengthen a hint held to 200 characters.

Read first, by risk:
1. `packages/lint/src/validate-list-view-field-refs.ts`, the
`ungroupable` / `gridRemedy` hunk in `checkKanbanGroupField`: this is
where the set is keyed.
2. `packages/lint/src/validate-list-view-kanban-lanes.test.ts`, the new
per-field `it.each`.

Two-minute check: `pnpm --filter @objectstack/lint exec vitest run
--maxWorkers=2 src/validate-list-view-kanban-lanes.test.ts`. Expect 34
passed. The `tags`, `watchers`, `meta`, `address` and `score` rows
assert a grid column; `amount`, `due_date` and `subject` assert a grid
grouping.

## Tests

At head `e0e643722a`:

<details><summary>@objectstack/lint: full suite and typecheck</summary>

- `pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2`: Test
Files 246 passed (246), Tests 9962 passed, 5 skipped (9967).
- `pnpm --filter @objectstack/lint typecheck`: exit 0;
check:test-typecheck OK.
- `src/validate-list-view-kanban-lanes.test.ts`: 34 passed.

</details>

<details><summary>Ablation</summary>

Forced `gridRemedy` to always take the grid-grouping arm, on disk, then
ran the target file: 5 failed / 29 passed. The failures were exactly the
five ungroupable rows (`tags`, `watchers`, `meta`, `address`, `score`).
Restored with `git checkout HEAD --`, tree clean.

</details>

## Acceptance notes

- Item 3 of the card (a finding of its own for a
`grouping.fields[].field` naming a multi-value, JSON-stored or
non-stored field) is not in this PR. It is a narrowing and stays on the
card.
- `engine.aggregate` also refuses a `groupBy` on a credential or
`internal`-flagged column (`rejectCredentialEvaluation`,
`rejectInternalFieldEvaluation`). The hint is not keyed on those,
because the refusal comes from a flag and not from the storage class. A
kanban board grouped by a password field is not a realistic producer.
Noted only.

## Verification

<details><summary>Derived local gates (dispatch-gates --commands, 70
families)</summary>

- `dispatch-gates --ran`: 70 derived, 67 run with exit 0, 3 NOT MEASURED
(exit 3, prerequisite), 0 unrun.
- NOT MEASURED: `check-plugin-teardown-shape --self-test` (shallow clone
cannot reach its pinned fixture commit), `check:dual-build-cjs-loads`
and `check:lean-entry-closure` (need dist of packages outside this
diff's closure). Left to CI.
- `check:docs-transcript-drift` was re-run after building
`@objectstack/lint`: exit 0. `check:type-check-debt` and
`check:query-options-erasure`: exit 0.
- `overlap-check --branch=HEAD`: clean against origin/main and objectstack-ai#38628,
objectstack-ai#38605, objectstack-ai#38594, objectstack-ai#38550.

</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B)_

<!-- signed: repo:objectstack#3 · os-steve ·
session_01ADHkmSwS4mQyXWrddL4r6B -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…ng declares (objectstack-ai#38648)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9JeHmqv6CKCkW8ewrPBLekk)_
Fixes objectstack-ai#38623
Clause-②: no
Metadata-protocol: none

## 维护者速读

- 在 Studio、元数据接口或 AI
助手里保存或发布一条翻译时,如果它指向一个已经不存在的对象、字段、校验规则、里程碑或权限集,保存结果里会多出一条提示;以前保存显示一切正常,什么都不说。
- 属于“错误的元数据要被明确指出”这项构建能力:本地校验早就会报这类问题,线上保存却静默通过,这次替在 Studio 和 AI
助手里写翻译的作者补上这个缺口。
-
出错的最坏情况是对一条其实有效的翻译多报一条提示,保存本身照常成功、不会被拒;应用的导航菜单和应用名这类翻译这次仍不检查,可以直接撤回这次改动。
- 无。

## What changes

A `translation` item saved (active) or published over the metadata API
now runs `validateTranslationReferences` at the runtime publish gate. An
orphan key comes back as a `translation-target-unknown` **advisory** on
the save and publish answer (`advisories`, severity `warning`). Before
this, no rule ran on a `translation` write
(`runtimeAuthoringRulesFor('translation')` was `[]`): the item was
accepted as valid while `os validate` refused the same key.

**Never a refusal.** Every finding on a translation write is a
`warning`, so it lands in `advisories` and never in the 422 `errors`. A
published item that names a key an upgrade removed still loads and
saves. `os validate` keeps reporting the same key at `error`.

**Families the door judges** (the ones the per-write snapshot carries,
`RuntimeStackContext`: objects, permissions, books, datasets):

- `objects.NAME`, only when the gate did not narrow `objects` to the
write's package closure. The i18n layer is process-wide, so a
translation may legitimately name an object outside its package's
closure.
- `objects.NAME.fields.FIELD`, and the field's `options` keys, only for
a field that declares options inline. A picklist-bound field's served
options are not in the snapshot.
- `objects.NAME._validations.RULE`
- `objects.NAME._milestones.FIELD.VALUE`
- `permissions.NAME`

**Not judged at the door:** apps and their navigation
(platform-contributed nav items included), `_views`, `_sections`,
`_tabs`, `_relatedLists`, `_actions`, `globalActions`, `dashboards`,
`forms`, `pages`, `picklists`, `positions`, `reports`, `mappings`,
`books` (the implicit per-package book is named by a package id the
snapshot never sees), `flows`, `hooks`. Each resolves into a collection
no per-write snapshot carries, so the door never guesses a key there
unknown; `os validate` still judges all of them. Judging apps and
navigation at the door would mean carrying served apps in the snapshot.
That is a separate decision and not this card.

The changes:

- `authoring-rules.ts`: the `validateReferenceIntegrity` entry's
`runtimeTypes` gains `translation`, so a translation write dispatches
the suite.
- `reference-integrity-suite.ts`: the `validateTranslationReferences`
member gains `runtimeTypes: ['flow', 'translation']` and still hands its
run context straight through.
- `validate-translation-references.ts`: the rule reads `runtimeWriteType
=== 'translation'` off that context as its save-door reading. That is
the signal the suite's other members already read for `wholeCollection`.
In that reading the rule treats the entry as one item (keyed by its own
`locale`), reduces the item to the judged families, and maps every
finding to `warning`.
- `runtime-gate.ts`: `TYPE_TO_STACK_KEY` gains `translation:
'translations'`. No context row is added, and no metadata-protocol
source changes.
- `scripts/engine-double-contract.pinned.json`: the three engine doubles
the new protocol pin uses (`delete`, `findOne`, `update`) are recorded,
written by `check-engine-double-contract --write`.
- `content/docs/deployment/validating-metadata.mdx`: the "Reference
integrity" row's runtime-publish cell gains `translation`
(`✓ᶠᵛᵒᵈᵗʳᵖᵃᶜᵗ`), and its text says what a translation write runs. The
superscript legend gains `✓ᵗ` `translation`, and the longest-first note
now covers it. Nothing else on the page changes.

The CLI reading is byte-identical: without `runtimeWriteType` the rule
takes its old path, the whole rule at its own severities.

**Control pins moved** (each held `translation` as the ungated control;
it now crosses, so the control moves to a type that stays ungated;
`tool`'s own control is untouched):

- `packages/lint/src/authoring-rule-wiring.test.ts` ("a type nobody
gated returns nothing"): `translation` → `doc`
- `packages/lint/src/runtime-gate.test.ts` ("runs nothing for a metadata
type no rule gates"): `translation` → `doc`
- `packages/lint/src/runtime-gate.test.ts` ("returns null for an
unmapped type"): `translation` → `doc`
- `packages/lint/src/runtime-gate.inert-type-writes.test.ts` ("crossing
these five widened no OTHER type s roster"): `translation` →
`capability`
- `packages/lint/src/runtime-gate.datasource-writes.test.ts` ("the types
still awaiting their own readings are untouched"): `translation` →
`capability`, and the comment says `translation` crossed on its own
reading

The seat's reading (7260663888 on objectstack-ai#38623) takes this card as the
`translation` reading that the ADR-0049 group B line defers the wiring
to.

**Read these first** (ranked by risk):

1. `packages/lint/src/validate-translation-references.ts`:
`doorJudgedSubset` and the `localeEntries` / `atSaveDoor` lines in
`validateTranslationReferences`. This hunk decides what the door may
judge; a family added here without its collection in the snapshot is a
false advisory on every save.
2. `packages/lint/src/reference-integrity-suite.ts`: the member's
`runtimeTypes`.
3. `packages/lint/src/authoring-rules.ts`: the entry's `runtimeTypes`.

**Two-minute verification:** `pnpm --filter @objectstack/lint exec
vitest run --maxWorkers=2
src/runtime-gate.translation-writes-38623.test.ts` shows 9 passing. The
removed field key, the orphan object, rule and milestone, and the orphan
permission set come back in `advisories` with `errors` empty. Live keys
and the unjudged families come back with neither.

## Tests

New files, named for this card:

- `packages/lint/src/runtime-gate.translation-writes-38623.test.ts`,
through the gate's own entry (`runRuntimeAuthoringRules`):
  - the dispatch: suite on `translation`, exactly the translation member
  - a removed field → advisory, `errors` `[]`
  - an orphan object, validation rule and milestone → advisories
  - an orphan permission set → advisory
  - live keys → none
- apps, navigation, global actions, positions, views and sections → not
judged
  - a picklist-bound field's option keys → not judged
- under a package closure, an object outside it is not judged while its
sibling's removed field still is
  - the CLI reading is unchanged (a bundle, at `error`)
-
`packages/metadata-protocol/src/protocol.translation-target-door-38623.test.ts`,
through the real `saveMetaItem` / `publishMetaItem` write path over a
stub engine:
- an active save naming a removed field → `success`, the advisory, and
the row landed
- a draft save says nothing (D1), and its publish answers with the
advisory
  - a permission-set orphan → advisory
  - live keys → none
- an already-published orphan neither blocks nor rides on an unrelated
translation write

<details><summary>Test runs: the new files at 8775b06; the
whole-package readings at 66c22be (before the main merge, which
brought no lint or metadata-protocol file)</summary>

- At head 8775b06, under the verify lock, after a fresh build of the
`@objectstack/metadata-protocol...` closure:
`protocol.translation-target-door-38623.test.ts` Tests 5 passed (5),
`runtime-gate.translation-writes-38623.test.ts` Tests 9 passed (9),
`VERDICT command-exit 0`. The later docs commit changes no code.

- `pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2`
(whole package): Test Files 247 passed (247), Tests 9977 passed (9977)
- `pnpm --filter @objectstack/lint typecheck`: exit 0 (`tsc --noEmit`
and `check:test-typecheck` OK)
- `pnpm --filter @objectstack/metadata-protocol typecheck`: exit 0
- `pnpm --filter @objectstack/metadata-protocol exec vitest run
--maxWorkers=2 src/protocol.translation-target-door-38623.test.ts`:
Tests 5 passed (5)
- The 29 metadata-protocol test files that mention `translation`: Test
Files 29 passed (29), Tests 862 passed (862)

</details>

<details><summary>Ablation: the entry widening reverted</summary>

`'translation'` removed from the entry's `runtimeTypes` through
`scripts/ablation-replace.mjs`:

- The anchor hit once and the mutation landed (blob 663f139 →
3068dd8e9df2).
- lint was rebuilt, and `ablation-dist-preflight.mjs @objectstack/lint
'"page", "action", "translation"]' --absent` confirmed the marker absent
from all 20 built files. It had been present in the pristine
`dist/runtime.js` and `dist/index.js`.

Results on the mutant:

- lint file: 5 failed / 4 passed. The dispatch case, the removed field,
the orphan object, rule and milestone, the permission set and the
closure case went quiet. Live keys stayed clean, and so did the
unjudged-families, picklist and CLI cases.
- protocol file: 4 failed / 1 passed. The active save, the draft publish
and the permission set went quiet. The live-key save stayed clean. The
already-published-orphan case also fails, because its first save asserts
the advisory as a precondition.

Restored: blob == HEAD (663f139) and `git diff HEAD` empty. lint
was rebuilt, and the protocol file then read 5 passed (5).

</details>

## Acceptance notes

- **False positives, measured on `examples/app-showcase`'s real
`ShowcaseTranslationBundle`** (en + zh-CN; context = the showcase's
objects, permissions, books and datasets):
  - whole-stack `validateTranslationReferences`: 0 findings
- the rule unrestricted on the door's snapshot: 85 phantom
`translation-target-unknown`. By family: `_views` 28, `_sections` 19,
positions 10, flows 10, dashboards 6, `_tabs` 4, reports 4,
`globalActions` 2, apps 1, mappings 1. That is why the door judges only
the families listed above.
- this PR, through `runRuntimeAuthoringRules({ type: 'translation' })`
per locale: errors 0, advisories 0
- the lit control on the same context (a removed `showcase_project`
field) comes back as one `warning` advisory
- A draft save is still never gated (objectstack-ai#4463 D1). The advisory appears on
an active save and on publishing a draft, not on the draft save itself.
- Found while measuring, not changed here: `os validate` refuses a
bundle key under the platform `studio` app at the app level, whatever
the navigation id (`translations[0]["zh-CN"].apps.studio`, "which this
stack neither defines nor contributes into"), even for a live id such as
`nav_api_console`. The lint's apps rung has no platform-app ladder; the
objects rung has `isPlatformProvidedObjectName`. Reported to the seat
with the CLI reproduction.

## Verification

<details><summary>Local gates, derived with dispatch-gates
--commands</summary>

At head 9b075e6. Gates were derived with `node
scripts/pm/dispatch-gates.mjs --commands` (105 families) and each exit
code was captured before any pipe. The `--ran` reconciliation reads: 105
derived, 103 run, 2 NOT MEASURED (derived from a recorded exit 3), 0
unrun.

- 68 code families were read at the code head: 266bea7, then
8775b06 for the ledger. The docs commit 9b075e6 changes only the
page.
- 37 families the docs path adds, all at 9b075e6: exit 0. They
include `check-adr-links` with its self-test (the local half of Check
Documentation Links; lychee runs only in CI, and the edit adds no link),
`check:doc-anchors`, `check:doc-frontmatter`, `check:docs-redirects`,
`check:docs-single-h1`, `check:docs-spec-enumerations`,
`check:docs-audit-scope` and `@objectstack/spec` `check:docs`.
- `@objectstack/spec` `check:skill-examples` first exited 3
(PREREQUISITE NOT MET: client SDK not built). After building
`@objectstack/client-react...` and `@objectstack/client...` under the
lock, it exits 0: "352 prose examples type-check across 3 surface(s)".
- `pnpm check:engine-double-contract`: exit 1 before the ledger commit,
exit 0 after it at 8775b06.
- `pnpm check:objectql-double-limit`: exit 0 ("none new").
- `node scripts/check-nul-bytes.mjs`: exit 0.
- `node scripts/pm/overlap-check.mjs --branch=HEAD` at 9b075e6:
`VERDICT clean exit 0`. The branch merges cleanly with origin/main and
with objectstack-ai#38643, objectstack-ai#38642, objectstack-ai#38594, objectstack-ai#38550 and objectstack-ai#38497.
- NOT MEASURED:
- `node scripts/check-plugin-teardown-shape.mjs --self-test`: exit 3
(shallow checkout).
- `pnpm check:dual-build-cjs-loads`: exit 3 (needs a full `pnpm build`).
- `pnpm check:dts-closure`: exit 1. The self-test passed. The scan's red
came from a local build that skipped declaration output in an earlier
worktree. `@objectstack/lint` and `@objectstack/metadata-protocol` were
not among the packages it named. CI's fresh build gives the real
reading.

The families CI runs (the repo-wide lint, `test:repo`, Check
Documentation Links' lychee step, the artifact roster) are read from
this PR's check-runs. They were not re-run here.

</details>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ADHkmSwS4mQyXWrddL4r6B

<!-- signed: repo:objectstack#3 · os-steve ·
session_01ADHkmSwS4mQyXWrddL4r6B -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
… a flow the deployment does not hold (objectstack-ai#38594)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Jianguo** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbJg9RAhiuDxvothojbXXC9Z)_
Fixes objectstack-ai#35143

Supersedes objectstack-ai#38241 (closed, 7256687325)

Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up objectstack-ai#38259 — skills/objectstack-automation/SKILL.md
(the `subflow` row says `os validate` warns `flow-subflow-unknown`; it
does not say the publish refuses a call to a flow nothing in the
deployment holds),
skills/objectstack-automation/evals/flows-triggers-approvals.json (the
eval that names `flow-subflow-unknown`)

## 维护者速读

- 用户能看到什么变化:搭建者(包括
AI)发布一个流程时,如果其中“调用子流程”或“逐项调用流程”的步骤写了一个整个环境里都不存在的流程名,发布现在会直接被拒并说明原因;以前能发布成功,但每次运行到这一步都会失败。命令行校验仍然只给警告。
- 为什么做:属于“开源框架先拦住云端构建检查才拦得住的问题”这一族收尾(流程族最后两条),替写流程的搭建者挡住“发布成功、运行必失败”。
-
出错会怎样:这是一次收紧——以前能发布的这类流程下次发布会被拒;被调用的流程只要以草稿形式存在、或在同一批次发布、或在同一个软件包安装里(顺序不限)、或由已安装的软件包提供,都不会被拒;用另一个命名空间安装的软件包副本若有流程调用同包流程,安装会被整体拒绝并回滚(改名没有改到调用处,以前装得上但这一步必失败);撤回本改动即恢复原样。
- 要你做什么:无

## What changes

The card's last two open lines, re-verified on `main` (1208460) first.

**F1, option label in decision-node and edge conditions: already covered
on `main`, no change here.** `flow-condition-option-label` reads every
edge condition and every `decision` node's `conditions[].expression`
(and query filter operands) since objectstack-ai#37491 (`optionLabelsBeyondStart` in
`validate-flow-trigger-readiness.ts`, at `error`, same id, runtime gate
and CLI). Its positive and negative pins are in
`flow-publish-checks-second-batch.test.ts`, describe "past the start
condition". The card gets a line saying so.

**F6, a `subflow` / `map` step calling a flow that does not exist: now
refused at the publish gate.** It was a CLI-only warning because the
gate's per-write snapshot holds just the written flow. The gate now
judges the call against the names of every flow the deployment holds,
which the host states on a flow publish:

- every installed package's flows (the registry, read with
`includeDisabledPackages`, so a disabled package's are included);
- the stored flow rows of **every state**, drafts included, so two new
flows that call each other can still be published one at a time;
- the flows the same publish batch carries (`pending.flows`), so a
package that ships a flow with its caller publishes;
- the flows the same unmanaged package install writes
(`copyPlanFlowNames`, new in this head), so a package whose flow calls a
sibling it declares later installs;
- every flow the automation engine holds (`listFlows`), so a flow
registered straight into the engine with no metadata row resolves.

A call that names none of them, and is not the written flow itself, is
an `error` (`flow-subflow-unknown`): `execute` answers `Flow 'X' not
found` on every run.

Severity per door:

- **CLI** (`os validate` / `lint` / `compile` / `build`): `warning`,
unchanged. The stack is one app, and another installed package may ship
the called flow.
- **Runtime publish gate, names stated and non-empty**: `error`. The set
is the whole deployment, so "held nowhere" is decided, the objectstack-ai#24668
reading of a whole collection.
- **Runtime publish gate, no names or an empty set**: no verdict. That
covers no automation service, a failed store read or a failed
`listFlows` (each logged once at `warn`) and an empty set. A missing
`sys_metadata` table is no stored flow: the other sources still decide.
An empty set with no closure is no universe (objectstack-ai#24668).
- **Package closure**: the set is never narrowed to the written
package's closure. So a call the engine's package-scoped resolution
would refuse (ADR-0150 D3, `outside-closure`) is not judged here. This
rule never refuses a call the engine would accept.

Wiring:

- `@objectstack/lint`: `validateFlowSubflowTargets(stack, {
deploymentFlowNames })`, the `AuthoringRuleContext.deploymentFlowNames`
input, and `runRuntimeAuthoringRules({ deploymentFlowNames })`. The
rule's registry entry moves to `tier: 'gating'`, `surfaces:
CLI_AND_RUNTIME`, `runtimeTypes: ['flow']`. Its runtime pass judges
nothing without stated names. The rule's explanation text is updated.
- `@objectstack/metadata-protocol`: `evaluateRuntimeAuthoringGate({
deploymentFlowNames })` adds the batch's flow drafts.
`judgeRuntimeAuthoringRules` reads the names only on a flow write whose
body calls another flow (`flowCallsAnotherFlow` in
`runtime-authoring-gate.ts`; `deploymentFlowNamesOf`,
`automationFlowNames`, `registeredFlowsWithDisabled` in
`protocol-authoring-gate.ts`), through the host's existing
`servicesRegistry`; the registry is listed with its disabled packages,
since the served listing drops their items. The stored names are one
`sys_metadata` read, `type` `$in` both spellings, projected to `fields:
['name']`. `saveMetaItem` takes a server-only `copyPlanFlowNames`
(`protocol-door-requests.ts`), which `importUnmanagedPackage` states on
each flow write and the save door hands the gate as `pending.flows`.
`protocol.ts` moves no line: one docblock (the `pending` field) is
reworded in place.
- `@objectstack/spec`: the ADR-0087 entry
`publish-refuses-flows-that-save-and-do-not-run` now counts eight errors
at the publish gate, seven of them also on the CLI: its `surface` names
the `subflow` / `map` refusal, the warnings sentence says which door
each warning is silent at, the acceptance line is no longer seven, and
the reason says what holds for a package install.

No rule is added, so no "author-time rules (N)" count moves.

## Rework on contract review 7238045522 (FAIL at `bc21970eab`)

This PR continues objectstack-ai#38241 (seat 6's branch
`claude/issue-35143-flows-leftovers`, whose dev ran out of budget). It
starts at that head, merges `main`, and closes every open item of the
review:

- **M1** (an unmanaged install refused a package whose flow calls a
sibling declared after it): `importUnmanagedPackage` states its plan's
flow names on each flow write (`copyPlanFlowNames`), which reach the
gate as `pending.flows`, the batch's channel. Pinned in
`package-unmanaged-install.test.ts`, describe "a flow calling a sibling
flow of the same package": a package declaring `crm_parent` (calls
`crm_child`) before `crm_child`, on a protocol whose automation service
holds another flow, installs both; the control (a call to a flow nothing
holds) is still refused 422 and leaves no row and no base.
`duplicatePackage` is unchanged: it copies stored rows, which the gate's
stored read already holds (the review's own reading).
- **S1** (every flow body read for names, on every flow publish): one
read, both type spellings, `fields: ['name']`; none at all for a flow
that calls no other flow, or only itself. Pinned on the shared harness.
- **S2** (the entry still counted seven): `surface`, `reason` and
`acceptanceCriteria` rewritten as above.
- **S3** (three no-verdict exits unpinned): one pin each through
`saveMetaItem` on the shared harness: a store read that throws
(accepted, one `warn`), a `listFlows` that throws (accepted, one
`warn`), and a missing `sys_metadata` table (no `warn`; a call to an
engine or registry flow is accepted and a call to nothing is still
refused).
- **N1**: the `sealedFlowNodeTypeVocabulary` docblock is back above its
function. N2–N5 are left as the review graded them (no effect on
correctness); see the acceptance notes.

## Patch round on contract review 7257069704 (PASS, S4 open at
`a7c00fdd85`)

- **S4** (the texts said a disabled package's flows count; the gate read
the served registry listing, which drops them): the first closing
condition. The names read lists the registry with
`includeDisabledPackages: true` (`registeredFlowsWithDisabled`), so a
call to a disabled package's flow is let through, as a draft is: the
flow is held, and runs once its package is enabled. The docblock, the
changeset and this body now say what the code does. Pinned through
`saveMetaItem`; removing the option fails the pin.
- **N6, N7, N8** in the same commit: the entry's `reason` gives the
right cause (the install states its flow names) and says the rename
covers prefixed names only; the `pending` docblocks, the lint docblocks
and the `os explain` text name a package install's flows and a disabled
package's; the changeset's Exports bullet names `saveMetaItem`'s
`copyPlanFlowNames` and no longer names `evaluateRuntimeAuthoringGate`.
N9 and N10 stand as accepted.

## Why

objectstack-ai#35143 "Done when": each line is a rule with its pins, or a line on the
card saying which rule covers it. F1 is the second case and F6 is now
the first. The hosted copy of the subflow check can be deleted.

## Tests

<details><summary>Lint: new pins in
flow-publish-checks-second-batch.test.ts (describe
flow-subflow-unknown)</summary>

- CLI: still exactly one `warning`.
- Runtime gate refuses a call to a name the stated set lacks: `error`,
path `flows[0].nodes[1].config.flowName`, message opening, `rulesRun`
names the rule.
- A `map` call inside a loop body: `error` at
`flows[0].nodes[1].config.body.nodes[0].config.flowName`.
- Silent: a name the stated set holds, the written flow calling itself.
- No verdict: no stated names, an empty set.

</details>

<details><summary>Metadata-protocol: the describe in
protocol.runtime-authoring-gate.test.ts (the shared harness), end to end
through saveMetaItem</summary>

- 422 `INVALID_METADATA`, issue `flow-subflow-unknown` at the path,
nothing stored.
- Accepted: a flow only the automation engine holds, an installed
package's flow (registry), a stored draft, a stored active flow.
- No automation service: accepted (no verdict).
- New (S4): a flow only a DISABLED package ships (listed by the registry
only with `includeDisabledPackages`) resolves; a call to nothing in the
same case is still a 422.
- New (S1): the stored names are read once, `{ where: { type: { $in:
['flow', 'flows'] } }, fields: ['name'] }`; a flow calling only itself,
and a flow with no call, read nothing.
- New (S3): a store read that throws, accepted with one `warn` naming
the cause; a `listFlows` that throws, the same; a missing `sys_metadata`
table, no `warn`, engine and registry flows still resolve and a call to
nothing is still a 422.
- `evaluateRuntimeAuthoringGate`: a flow in `pending.flows` resolves;
without it the call is refused.

</details>

<details><summary>Metadata-protocol: new describe in
package-unmanaged-install.test.ts (M1)</summary>

- A package declaring `crm_parent` (a `subflow` step calling
`crm_child`) before `crm_child`, with an automation service holding
`other_flow`: installs, both flows stored active.
- Control: `crm_parent` calling `crm_nowhere`: refused 422 with
`flow-subflow-unknown`, no active row left, the base
`com.example.crm-copy` removed.
- Reading, not pinned: the same package installed with `targetNamespace:
'crm2'` is refused 422 (`flow 'crm2_parent' could not be written …
flows[0].nodes[1].config.flowName [flow-subflow-unknown]`) and rolled
back, because the rename does not rewrite `config.flowName`; see the
acceptance notes.

</details>

<details><summary>Ablations (each fix removed on disk from the committed
head, then restored with git checkout HEAD)</summary>

- `importUnmanagedPackage` states no `copyPlanFlowNames`: "installs a
package that declares the calling flow before the flow it calls" fails
(1 failed / 1 passed).
- The names read for every flow write (the `flowCallsAnotherFlow` guard
dropped): "reads the stored names once …" fails (1 failed / 7 passed).
- At 93f3643, the registry read without `includeDisabledPackages`:
"lets a call through to a disabled package's flow …" fails (1 failed).

</details>

<details><summary>Suites (head 93f3643, main merged at 3014176;
under os-verify-lock)</summary>

- `@objectstack/lint` test: 246 files / 9962 tests passed. typecheck
exit 0.
- `@objectstack/metadata-protocol` test: 372 passed / 9 skipped files,
23660 passed / 45 skipped tests. typecheck exit 0.
`protocol.runtime-authoring-gate.test.ts` +
`package-unmanaged-install.test.ts`: 383/383.
- `@objectstack/spec` `src/migrations`: 5 files / 209 tests.
- Dogfood battery: head 93f3643, `pnpm --filter @objectstack/dogfood
test` under the lock after a clean closure build (exit 0): VERDICT
command-exit 0, Test Files 495 passed / 3 skipped (498), Tests 4187
passed / 68 skipped (4255), no failure.

</details>

## Acceptance notes

- Not judged: whether the engine's package-scoped name resolution lets
the calling flow reach the called one (ADR-0150 D3). The set is the
whole deployment, so an `outside-closure` call still fails at run time.
Judging that would need the resolver's verdict at the door.
- A call to a stored draft, or an archived or deprecated row, is let
through. The step fails until that flow is active. This keeps two new
flows that call each other publishable one at a time.
- The stored read for names is not filtered for legacy organization
rows. An extra name can only let a call through.
- A package install under another namespace (`targetNamespace`) renames
its flows but not the `config.flowName` that calls them, so a package
whose flow calls a sibling is now refused and rolled back unless the
deployment holds the old name. On `main` it installed with a step that
fails on every run. Making the rename follow flow names is outside this
card; reported to the seat as a finding.
- A plan flow name counts even if that flow's own write then fails: the
install then rolls back whole, so no caller is left pointing at it.
- Not addressed, as graded (nits): N2 `listFlows` is read with no seal;
N3 the empty-set exit depends on the door; N4 the "did you mean"
suggestion draws on the unfiltered stored read; N5 `rulesRun` names the
rule on a write where it judged nothing.

## Verification

- Read first:
`packages/metadata-protocol/src/protocol-package-commits.ts`
`importUnmanagedPackage` (`copyPlanFlowNames`) with `protocol-save.ts`
(where it becomes `pending.flows`);
`packages/metadata-protocol/src/protocol-authoring-gate.ts`
`deploymentFlowNamesOf` (the union, the projected read, the no-verdict
exits), `packages/lint/src/authoring-rules.ts` the
`validateFlowSubflowTargets` entry (runtime pass with no names =
nothing), `packages/lint/src/validate-flow-trigger-readiness.ts`
`validateFlowSubflowTargets`.
- Two minutes: `pnpm --filter @objectstack/metadata-protocol exec vitest
run src/protocol.runtime-authoring-gate.test.ts
src/package-unmanaged-install.test.ts -t '35143|sibling flow'`. Expect
11 passed, among them a 422 naming `flow-subflow-unknown` and a package
install of a caller before its callee.

<details><summary>Gates (head 93f3643)</summary>

- `dispatch-gates --ran` at 93f3643, run after the closure build: 103
derived, 102 run (all exit 0), 1 NOT MEASURED, 0 unrun (`✓
dispatch-gates --ran: 103 derived famil(ies) accounted for`).
- `check:dual-build-cjs-loads` exit 3: needs a full workspace build.
Left to CI.
- `overlap-check` (`--exclude-pr=38241`) at a7c00fd: clean against
origin/main 3014176 and the two open PRs sharing a file (objectstack-ai#38550,
objectstack-ai#38497). The 93f3643 commit touches only files of this PR.
- `protocol.ts` moves no line, so `check:facade-delegation-only`'s
ceiling is untouched (exit 0 in the sweep).

</details>

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes (CI-owned run).
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: only a migration entry's text, no
generated artifact moves.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01QsR2jSjBfkaFUVwRa3pdUK

<!-- signed: repo:objectstack#1 · zhuangjianguo ·
session_01QsR2jSjBfkaFUVwRa3pdUK -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…rd`, and Studio stops offering it (objectstack-ai#38045) (objectstack-ai#38581)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Jianguo** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9Ubb1YRLSVWfEBbNBCfs6vKG6L)_
Fixes objectstack-ai#38045
Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: none — no text or eval under skills/ writes a
record:quick_actions bar's own location; action locations themselves are
unchanged

## 维护者速读

- 用户能看到什么变化:在应用搭建里给记录页的快捷操作栏选位置时,下拉不再有「记录 · 页面与行」这一项;手写或 AI
写出这个值,保存或校验时直接报错,并提示改写成「记录页」。
- 为什么做:这是你在快捷操作栏位置问题上选的方案 A(下拉和格式都去掉),趁 19 版正式发布前收紧,现在没有任何已写的栏用到这个值。
- 出错会怎样:只影响快捷操作栏自己的位置设置,动作本身的「记录」位置不变;万一有问题,撤回这个改动即可恢复原样,不涉及数据迁移。
- 要你做什么:契约复审通过后,请批准这个格式收紧。

Supersedes objectstack-ai#38541
Seat: repo:objectstack#1 · zhuangjianguo ·
session_01QsR2jTsdScTh3o2fSjbxSz (takeover of seat repo:objectstack#5)
Claim: governing claim amendment 7255928921 on objectstack-ai#38045 (takeover Claim
7255614866, amendments 7255639984 and 7255928921)
Branch: claude/project-thread-y2muak (started at
claude/issue-38045-quick-actions-no-record @c68dfcc7)
Ruling-ref: record 7251596106 on the card (maintainer ruling A, verbatim
「A 下拉和格式都去掉」). Analysis: 7251023956.

## Takeover round (seat 1, governing claim amendment 7255928921)

This PR replaces objectstack-ai#38541: its dev's account ran out of tokens, and the
new branch starts at that PR's head `c68dfcc7`, where the seat L1
(7255089417, ACCEPT) and the contract review (7255183085, PASS with S3
open) were recorded. Every prior commit was re-read and kept; nothing
was dropped or rewritten.

- **Merge of main.** `40b0b59a` merges `origin/main` at `30141766`
through `scripts/pm/os-regen-merge.sh`. The only conflict was the
generated `content/docs/references/index.mdx`. It was regenerated from
the merged tree (`gen:schema`, spec `build`, `gen:api-surface`,
`gen:export-origins`, `gen:declaration-map`, `gen:docs`) in `7fb066f7`:
main dropped one published schema while this PR adds
`RecordQuickActionsLocation`, so the counts read 1742 total and 187 in
UI. No other generated file moved, and no hand-written file needed a
resolution (en.ts and zh.ts auto-merged).
- **S3 (contract review 7255183085).** On the bar, the `global_nav`
prescription no longer ends with the `os migrate meta --from 18`
sentence, which no conversion backs for that word (protocol 19's step
covers a bar's four page-part words; the protocol-17 step stripped
`global_nav` from `action.locations` only).
`QUICK_ACTIONS_BAR_PLACES_TAIL` is split into the places sentence (all
five rows) and the house migrate sentence (the four page-part rows). The
bar's pin now asserts the `global_nav` message has no `os migrate meta
--from` and each of the four names `` `os migrate meta --from 18` ``.
Commit `5496b7a4`.
- **N5.** The older test comment no longer calls the `global_nav`
message proof that the row rides the shared enum; it points at the
positive pin.
- **N6.** The two body sentences below ("What changes, Spec" and "Read
first 1") now describe the bar's own map, not a delegation.
- **Readings at `5496b7a4`.** Spec `component-record-blocks.test.ts`,
`action.test.ts`, `retired-key-migrate-sentence.test.ts`,
`type-alias-convention.pin.test.ts`: 4 files, 209 passed. Ablation
through `scripts/ablation-replace.mjs`: the `global_nav` row put back on
the migrate tail turns "answers each retired word on the bar with a
single place, never `record`" red (1 failed / 35 passed); restored, blob
== HEAD. PR body gates (`check-closing-keyword-parity`,
`check-changeset-no-major --base origin/main`,
`check-adr-0087-registration --base origin/main`,
`check-partof-closing-keyword`): exit 0. Full dogfood battery (closure
built, then `pnpm --filter @objectstack/dogfood test`): lock VERDICT
command-exit 0, Test Files 495 passed, 3 skipped (498), Tests 4187
passed, 68 skipped (4255), no failures. `pnpm --filter @objectstack/spec
test`: Test Files 913 passed (913), Tests 28893 passed, 1 todo.
`dispatch-gates --commands` derives 132 families; `--ran` with exit
codes: 131 run with exit 0, 1 NOT MEASURED
(`check:dual-build-cjs-loads`, exit 3 PREREQUISITE NOT MET: it reads
dists of packages not built here, such as `packages/qa/scenarios/dist`;
CI runs it). `overlap-check`: main merges cleanly; objectstack-ai#38550 conflicts on
three generated files (`content/docs/references/ui/component.mdx`,
`content/docs/ui/components/record.mdx`,
`scripts/sdui-manifest.record.json`), landing order set by the seat
(this PR first, objectstack-ai#36496's thread regenerates after).

## Rework round (contract review 7253506178, seat ruled both should-fix
its way)

Head c68dfcc (merges main at d64541c first).

- **S1.** The protocol-19 upgrade step
`action-locations-page-parts-retired`
(`packages/spec/src/migrations/entries/semantic/19.action-locations-page-parts-retired.ts`)
now says, in `surface`, `replacement` and `acceptanceCriteria`, that a
`record:quick_actions` bar's own `location` takes one place only
(`record_page`, its default, `record_row`, `record_related`,
`record_section` or `list`) and that `record` there is refused at parse
with the prescription naming `record_page`. No new id, no new entry. The
changeset's ADR-0087 marker now says this change extends that entry's
surface, and no longer says the conversion maps every protocol-18 bar
location: it maps `record_header`, `list_item` and `list_toolbar`, and
leaves a bar at `record_more` as stored with a TODO. The ledger feeds
only gitignored projections (upgrade guide, `spec-changes.json`);
`check:upgrade-guide` and `check:spec-changes` are green and nothing
else regenerated.
- **S2.** `Clause-②: yes (narrowing)` here and in the changeset (see
Acceptance notes).
- **N1 (folded in).** On the bar, a retired word (`record_header`,
`list_item`, `list_toolbar`, `record_more`, `global_nav`) now gets a
prescription written for a bar: it names the one place to write and
never offers `record`. The shared enum's action-side prescriptions are
unchanged. N2 and N3 are untouched.

## What changes

Ruling A, carried out as one PR. On the `record:quick_actions` bar,
`record` is not a place the bar can be set to; `record` on an action's
own `locations` is untouched.

- **Spec (contract face).** `packages/spec/src/ui/action.zod.ts` adds
`RecordQuickActionsLocationSchema` (and its type
`RecordQuickActionsLocation`):
`ActionLocationSchema.exclude(['record'])`, so it rides the shared enum
(a location the vocabulary adds reaches the bar too). Its error map
answers `record` with a prescription that names `record_page`, the five
retired words (`global_nav` and the four page-part words) from the bar's
own map of bar-worded prescriptions, and every other value with zod's
own enum error; the shared enum keeps its action-side prescriptions.
`RecordQuickActionsProps.location` uses it; its describe says "any
action location but `record`". Proposed refusal text (the contract
review judges it):
> `record` is not a place a `record:quick_actions` bar can be set to. On
an action, `record` says what the action acts on: one record, drawn on
the record page and on each list row. A bar sits in one place and draws
that place's actions. On a record page write `location: 'record_page'`
(the bar's default, so the key can be left out): it draws the record
page's actions, the ones placed at `record` included. A bar for another
single place names it: `record_row`, `record_related`, `record_section`
or `list`.
- **Studio.** The bar's location dropdown (`block-config.ts`) is built
from a total label map keyed by `RecordQuickActionsLocation` (a
TypeScript Record type) (the `ActionDefaultInspector` `LOCATION_LABELS`
mechanism), so the compiler keeps the options equal to the spec's set:
re-adding `record` is TS2353. Display order unchanged except `record` is
gone (`record_page` first).
- **i18n.** `engine.inspector.pageBlock.option.location.record` removed
from en (`Record · page and rows`) and zh (「记录 · 页面与行」).
- **Outside the claimed file surface, and why.**
`ui/packages/plugin-detail/src/index.tsx` (the bar's registration, not
the renderer) published `location` as `[...ACTION_LOCATIONS]`; that list
is serialized into `sdui.manifest.json`, which JSX page validation
reads. Left as it was, the manifest would still offer `record` on the
bar, a second door that accepts what the spec now refuses. It now
publishes `RecordQuickActionsLocationSchema.options`;
`sdui.manifest.json`, `scripts/sdui-manifest.record.json` and
`content/docs/ui/components/record.mdx` are regenerated by their
generators (the manifest diff is the one enum member and the
description). The renderer (`record-quick-actions.tsx`) is unchanged.
- **Generated.** `api-surface/`, `export-origins/`, `declaration-map/`,
`json-schema.manifest/ui.json` and `content/docs/references/**`
regenerated by the spec gates (no hand edits).
`type-alias-convention.pin.test.ts` pins the new alias as isomorphic
(ADR-0122; `check:spec-parsed-alias` asked for it) and its count line
moves 879 → 880.
- **Changeset.** `.changeset/38045-quick-actions-no-record.md`: `minor`
on spec, plugin-detail, app-shell and i18n, the two declaration lines, a
FROM → TO table, and ADR-0087 disposition `not-required
(already-registered action-locations-acted-on,
action-locations-page-parts-retired)`, whose semantic entry this PR
extends (rework round, S1).

Census of authored bars at `location: 'record'` (any quoting, any file
type): **0** in objectstack (`git grep -nE
"[\"']?location[\"']?\s*:\s*[\"']record[\"']"` at 545a4fa), **0** in
HotCRM (same pattern at origin/main d48b030b; its one
`record:quick_actions` mention is a test). The authored bars are
`showcase_task_detail` and `sys_user`, all at `record_section`, and both
still parse.

## Read first

1. `packages/spec/src/ui/action.zod.ts`, the
`RecordQuickActionsLocationSchema` hunk: the refusal text and the
`.exclude()` with an explicit error (the explicit param replaces the
copied one, so the bar's own retired-word map,
`QUICK_ACTIONS_BAR_RETIRED`, is what answers those words on the bar).
2.
`ui/packages/app-shell/src/views/metadata-admin/previews/block-config.ts`,
the `QUICK_ACTIONS_LOCATION_LABELS` map and the dropdown's `options`.
3. `ui/packages/plugin-detail/src/index.tsx`, the registration's
`location` enum (the surface addition above).

## Two-minute check

`pnpm --filter @objectstack/spec exec vitest run
src/ui/component-record-blocks.test.ts` — expect 36 passed, including
the four cases under "record:quick_actions `location` — single places
only, never `record`".

## Tests

All at head aeb79b9 unless noted.

- Spec pins (`component-record-blocks.test.ts`, new top-level describe
in the bar's existing harness): positive (the bar accepts exactly
`ACTION_LOCATIONS` minus `record`, each parses), negative (`location:
'record'` refused, one issue, `code: 'invalid_value'`, `path:
['location']`, message first sentence and `location: 'record_page'`),
`record` still on the shared enum, and each retired word on the bar is
answered with one issue (`invalid_value`, `location`), a message that
opens with the word, names a single place and never offers `record`,
while the shared enum's `record_header` prescription still offers
`record`. A schema refusal carries no ADR-0112 `status` (that envelope
is the API's), so the pin is `code` + `path` + prescription, the
`add-record-config-retirement.test.ts` precedent.
- Studio pins (`block-config.test.ts`): offers exactly
`RecordQuickActionsLocationSchema.options`; does not offer `record`
(with the non-empty guard); no leftover `…option.location.record`
translation in either locale, with a still-offered key as control.

<details><summary>Test runs</summary>

- Rework round, at c68dfcc: `pnpm --filter @objectstack/spec test` 913
files passed, 28896 tests passed, 1 todo; spec
`component-record-blocks.test.ts` + `action.test.ts` +
`action-locations-acted-on.test.ts` 198 passed; `pnpm --filter
@objectstack/spec build && check:generated` all 14 up to date.
- `pnpm --filter @objectstack/spec test` (at 8a55fce, before the merge
of main and the pin-count commits): Test Files 913 passed (913), Tests
28896 passed, 1 todo.
- `pnpm --filter @objectstack/spec typecheck`: exit 0
(`check:test-typecheck: OK`), rerun after the pin edit.
- spec `component-record-blocks.test.ts` +
`type-alias-convention.pin.test.ts`: 2 files, 39 passed.
- `ui`: `block-config.test.ts` + `block-config-i18n.test.ts`: 2 files,
68 passed.
- `ui`: plugin-detail quick-actions and registration tests + all of
`packages/i18n/`: 125 files, 1978 passed, 13 skipped. (The whole
plugin-detail suite did not finish inside one 10-minute foreground run;
narrowed to the files that read the registration or the bar, and left to
`Test UI`.)
- `pnpm --filter @object-ui/plugin-detail type-check`: exit 0. `pnpm
--filter @object-ui/app-shell type-check` (both tsconfigs): exit 0.
- Rework round, full dogfood at c68dfcc (closure built, then `pnpm
--filter @objectstack/dogfood test`): lock VERDICT command-exit 0, Test
Files 495 passed, 3 skipped (498), Tests 4183 passed, 68 skipped (4251).
- Full dogfood at aeb79b9 (`pnpm --filter @objectstack/dogfood test`
after building its closure): lock VERDICT command-exit 0, Test Files 495
passed, 3 skipped (498), Tests 4183 passed, 68 skipped (4251).
</details>

<details><summary>Ablations (each mutation through
scripts/ablation-replace.mjs, landing and restore checked by blob
hash)</summary>

- Spec negative pin: `location:
RecordQuickActionsLocationSchema.optional()` →
`ActionLocationSchema.optional()`: "refuses `location: 'record'` …" red
(1 failed / 35 passed); restored, blob == HEAD.
- Spec positive pin: `.exclude(['record'])` → `.exclude(['record',
'record_row'])`: "accepts every action location except `record` …" red;
restored.
- Studio: re-add `record` to `QUICK_ACTIONS_LOCATION_LABELS`: "offers
exactly the locations the spec accepts" and "does NOT offer `record`"
red (2 failed / 45 passed), and `tsc --noEmit` in app-shell red with
`TS2353`: `'record'` does not exist in the type, a Record keyed by
exactly `list`, `record_page`, `record_row`, `record_related` and
`record_section` — the reverse check that the Console compiles against
the rebuilt, narrowed `.d.ts`. A first attempt was refused by the tool
(its replacement contained its anchor) and changed nothing; the run
quoted is the second.
- Rework round, N1: the bar's retired-word branch pointed back at the
shared action-side prescriptions: "answers each retired word on the bar
with a single place, never `record`" red (1 failed / 35 passed);
restored, blob == HEAD.
- i18n: re-add the zh label: "has no leftover translation for the
removed `record` option" red; restored.
</details>

<details><summary>Gates</summary>

- Rework round, at c68dfcc: `dispatch-gates --commands` derives 130
families; `--ran` with exit codes: 129 run, 1 NOT MEASURED
(`check-plugin-teardown-shape --self-test`, exit 3, shallow clone cannot
reach its pinned fixture commit). Six gates first answered exit 3 on an
unbuilt closure in the fresh worktree and `pnpm --dir ui exec vitest run
scripts/` was SIGKILLed on the shared box; after building the CLI and
lint closures each was rerun: exit 0 (ui scripts: 172 files passed, 2
skipped). `check-adr-0087-registration --base origin/main`: exit 0 with
the reworded marker.
- Overlap at c68dfcc: `overlap-check` exit 1. Textual conflicts with
two open draft PRs on files this PR changed in its first round
(generated outputs): objectstack-ai#38550 on
`content/docs/references/ui/component.mdx`,
`content/docs/ui/components/record.mdx`,
`scripts/sdui-manifest.record.json`; objectstack-ai#38545 on
`content/docs/references/index.mdx`. Not resolved by hand; whichever
lands second regenerates.

- `dispatch-gates --commands` (derived at c1cb23b, the same list at
aeb79b9): 127 families run; `--ran` with exit codes: 124 run, 3 NOT
MEASURED, all three `PREREQUISITE NOT MET` exit 3, none reading a file
this diff changes: `check-plugin-teardown-shape --self-test` (shallow
clone cannot reach its pinned fixture commit), `spec
check:skill-examples` (reads `packages/client-react/dist`, not built
here), `check:dual-build-cjs-loads` (reads dists of packages not built
here). CI runs all three.
- One real finding along the way, fixed in this PR:
`check:spec-parsed-alias` asked for a pin of the new alias (exit 1, then
0).
- `pnpm --filter @objectstack/spec check:generated` after rebuilding
spec on the merged tree: all 14 artifacts up to date.
- `check-adr-0087-registration --base origin/main`: exit 0 (the
already-registered disposition). `check-sdui-manifest`,
`check:sdui-reference`, `check:nul-bytes`, `check:issue-citations`,
`check-empty-changeset`, `check-changeset-no-major`: exit 0 at aeb79b9.
- `check:query-options-erasure` and `check:type-check-debt` exceed 300
s; rerun without that cap: exit 0 both.
</details>

## Acceptance notes

- **ADR-0087 disposition: settled by the contract review (record
7253506178, option C).** `not-required (already-registered …)` stands,
and the semantic entry it names is extended here so the claim is a fact
(rework round, S1). The original argument, kept for the record: The
dispatch left open whether this narrowing needs a conversion entry. The
registration gate refuses `no-migration-prescription` on any
`Metadata-protocol: narrowed` changeset; what it accepts is a new
semantic entry or a category resting on a fact. This PR claims
`already-registered action-locations-acted-on,
action-locations-page-parts-retired`: the word became legal on the bar
only inside unreleased 19, by the change those entries register, and
their conversion maps every protocol-18 bar location to a single place
(`record_header` → `record_page`, `list_item` → `record_row`,
`list_toolbar` → `list`) and never writes `record` on a bar. ADR-0087
records that the gate checks such an id is old, never that it covers the
change, so this rests on the argument above. The alternative is a new
semantic entry for prerelease authors. Seat repo:objectstack#5 ruled
this disposition (option A, not-required) on 2026-11-29 at 08:24 UTC and
asked the contract review to check the reading; if the contract review
rules a semantic entry is owed, this PR switches to that entry.
- **`Clause-②: yes (narrowing)`.** The diff narrows one accept set (the
bar's `location` refuses `record`) and also enlarges the public surface
of `@objectstack/spec/ui`: two new exports,
`RecordQuickActionsLocationSchema` and `RecordQuickActionsLocation`, and
one new published JSON schema, `ui/RecordQuickActionsLocation`. Clause-②
judges both accept sets and the public surface, so the honest value is
`yes` with the `(narrowing)` arm, the spelling ruling record 7251596106
wrote and the claim's amendment 7253515149 now carries. The first
round's `no (narrowing)` treated the new exports as outside the clause;
the contract review corrected that (S2).
- The generic `action:bar` and `action:group` blocks also take a
`location` from the full vocabulary, `record` included, and match it
literally. Neither has a Studio dropdown; outside this card, left as
they are.
- The `record` option's label keys stay in the action inspector
(`engine.inspector.action.location.record`), where `record` is a real
choice for an action.


---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jT4byCJU6xgZwQDh8y)_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01QsR2jT4byCJU6xgZwQDh8y

<!-- signed: repo:objectstack#1 · zhuangjianguo ·
session_01QsR2jT4byCJU6xgZwQDh8y -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…hat first ship in 19 move to protocol 19 (objectstack-ai#38627)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9CGtGeksBgFXURAQ8CAJhT8)_

Fixes objectstack-ai#38256

Clause-②: no
Metadata-protocol: none

## 维护者速读
- 从 18 升级到 19 的团队用升级命令时,以前看不到 34 条变化说明,其中三项旧写法也不会被自动删掉;现在这些说明都列在 18 → 19
的升级提示里,三项旧写法会被自动删除。
- 修正第 19 版的升级说明,替用升级命令从 18.x 升上来的团队补上漏掉的提示和自动修改。
- 只是把说明和自动修改挪到正确的大版本下,说明内容不改,三项自动修改的先后顺序也不变;出错只影响升级提示与自动修改落在哪个版本,可以直接撤回。
- 无

## What changes
- **The set, re-derived on `origin/main` (Ask 1).** `semantic/18.*`
entries present at the protocol move `204356a6e` (objectstack-ai#37314) and absent at
`@objectstack/spec@18.6.0` (`958ee0359`): 579 − 545 = 34, the same 34
ids the card lists. Each is in no `@objectstack/spec@18.*` tag (all 12
read: 0 hits each) and in `19.0.0-next.0` (34 of 34).
- **34 semantic entries move to step 19 (Ask 2).**
`entries/semantic/18.ID.ts` becomes `19.ID.ts`, R100, ids and bytes
unchanged. `gen:migration-registry` files an entry by its file name's
major, and `composeMigrationChain(fromMajor)` keeps only the steps above
`fromMajor`, so under 18 the 18 → 19 upgrade never listed them.
- **Three of the 34 move as whole families, not entries alone.**
`object-grid-single-click-edit-retired`, `view-column-state-retired` and
`field-inline-edit-boolean-retired` are each the D3 record of a D2
conversion from the same window
(`object-grid-single-click-edit-removed`, `view-column-state-removed`,
`field-inline-edit-boolean-removed`: absent at 18.6.0, first shipped in
19.0.0-next.0). Ruling B in `migrations.test.ts` and each family's pin
hold the D3 entry in its conversion's own step, and under 18 `os migrate
meta --from 18` did not run those conversions either. So, per the seat's
amended claim:
- the three conversions move to `src/conversions/entries/19/`, `toMajor:
19`, `retiredAfter` unchanged (`18.6.0` is still the last stable release
that accepted the old shape);
- `src/conversions/registry.ts`: they leave `MAJOR_18_CONVERSIONS` and
join `MAJOR_19_CONVERSIONS` at `order` 0.1 / 0.1 / 0.2. They were the
last three of major 18 (orders 83, 83, 84), so `ALL_CONVERSIONS` runs in
exactly the same sequence as before; only the step each is reported
under changes. Read off the built registry: major 18's tail is now
`manifest-packaging-manifest-deps-removed`,
`form-view-drawer-keys-removed`, `view-personal-declarations-removed`,
and major 19 starts `object-grid-single-click-edit-removed`,
`view-column-state-removed`, `field-inline-edit-boolean-removed`;
- each conversion's docblock says protocol 19 and `--from 18`, and the
two schema comments that name a moved conversion
(`src/ui/component.zod.ts` above `singleClickEdit`,
`src/data/field.zod.ts` above the boolean `inlineEdit` refusal) say
protocol 19.
- **Four retired-key rows move to 19 (Ask 3).**
`ai/KnowledgeChunk:metadata`, `ui/ObjectGridProps:singleClickEdit`,
`ui/ViewItemWire:columnState`, `ui/ViewMetadata:columnState`: each is in
no 18.x tag and in 19.0.0-next.0, so the card's criterion holds. The
aging reading: `build-schemas.ts` check (c) proof 1 allows deleting a
tombstone once `CURRENT_MAJOR - registeredAt >= 1`. At 18 these rows
were deletable now, at major 19, before any stable release ever carried
them; at 19 they become deletable at 20, the same as every other
retirement that first ships on the 19 line. Proof 2 (the
`@objectstack/spec@18.0.0` dating tag) does not date them, since none
was `[RETIRED]` there. So the move corrects a verdict rather than
changing one wrongly. One row's comment named the 18.x line as its
reason and now says why it is under 19.
- **Step 18 rationale → step 19 rationale.** The `STEP18_RATIONALE`
fragments of the four moved retirements
(`object-grid-single-click-edit-retired`, `view-column-state-retired`,
`field-inline-edit-boolean-retired`, `knowledge-chunk-metadata-retired`)
leave step 18 and their text, unchanged, joins step 19's rationale,
before the form view `modalSize` sentence (placed there so it does not
share the tail line objectstack-ai#38550 edits).
- **Refusal text the moves made false.**
`retired-key-removal-version.pin.test.ts` derives a prescription's `os
migrate meta --from N` from the conversion's `toMajor`, so the
`singleClickEdit`, boolean `inlineEdit` and `columnState` refusals now
say `--from 18`. `KnowledgeChunk.metadata`'s tombstone said "removed in
@objectstack/spec 18"; it now says 19.0.0, as its three siblings already
did. That pin did not catch it because it derives the version only for
retirements with a D2 conversion, and this one has none. Reference pages
regenerated (`content/docs/references/ai/knowledge-document.mdx`,
`ui/component.mdx`, `ui/view.mdx`).
- **A sibling entry's wording.** `19.ui-form-view-modal-size-retired`
(not one of the 34) called `internal-record-forms-not-loaded` "the
protocol-18 semantic entry"; it now says protocol-19, since that entry
moves to step 19 here and the sentence prints under the 18 → 19 hop
(contract review, S1). The boolean `inlineEdit` prescription's docblock
says protocol 19 too.
- **Built artifacts declaring a bare `^19`.** The artifact door replays
a retired conversion for a `19.0.0` floor only when its step is 19
(`converted-major-step`,
`packages/metadata-core/src/artifact-forward-conversion.ts`). Such an
artifact that still carried one of the three keys was refused before; it
is now converted at ingestion. Artifacts declaring a floor below 19
replayed them already. The changeset says so.
- **Order-dependent wording.** None of the 34 says "since the previous
entry" or similar. Where an entry names another (for example
`18.action-body-does-not-compile-refused` names
`body-regexp-pattern-refused`, now under 19), it names the id, not a
position, so it still reads right.
- One `@objectstack/spec` patch changeset (Ask 4). The id-keyed
`adr-0087: registered` markers in `.changeset/pre/*` and the released
CHANGELOGs, which say "step 18" for these families, stay as published
(AGENTS.md: release-owned).

## Tests
Forced test changes, each because the family it pins moved to 19:
- `src/data/field-inline-edit-boolean.pin.test.ts`: the conversion's
`toMajor` and the step it is wired into read 19; the prescription regex
reads `--from 18`.
- `src/ui/object-grid-single-click-edit.pin.test.ts`: the same, plus
`RETIRED_KEYS_BY_MAJOR[19]`.
- `src/ui/view-column-state-retirement.test.ts`: the retired-key rows,
the conversion and the D3 entry are read from major 19; the prescription
regex reads `--from 18`.

No other test changes. The chain pins (`migrations.test.ts`,
`semantic-relevance.test.ts`, `step18-rationale-merge.test.ts`,
`conversions-major18-merge.test.ts`) read the generated lists and pass
unchanged.

<details><summary>Readings (head
367d09d, base origin/main
ee9fd3d)</summary>

Built registry (`dist/migrations`):

| | step 18 semantic | step 19 semantic | conversions 18 / 19 | retired
keys 18 / 19 | `composeMigrationChain(18)` lists the 34 + the 3 of
objectstack-ai#38239 | `composeMigrationChain(17, 18)` lists any |
|:--|:--|:--|:--|:--|:--|:--|
| before (main) | 579 | 34 | 98 / 8 | 282 / 9 | the 3 only | the 34 |
| after | 545 | 68 | 95 / 11 | 278 / 13 | all 37 | none |

The semantic id set over every step: 690 ids, 690 unique, before and
after.

Local runs:
- `pnpm --filter @objectstack/spec build` under `os-verify-lock`:
command-exit 0.
- `pnpm --filter @objectstack/spec test` under `os-verify-lock` at
367d09d (`build` and `check:generated` clean there): `Test Files 913
passed (913)`, `Tests 28893 passed | 1 todo (28894)`.
- `pnpm --filter @objectstack/spec typecheck`: command-exit 0.
- `pnpm --filter @objectstack/spec check:generated --fix`: regenerated
the three reference pages it proved stale.
- Derived gates (`dispatch-gates.mjs --commands`) at 367d09d: 122
derived, 122 run, each exit 0; `--ran` reconciles 0 NOT-MEASURED (after
`turbo run build --filter=./packages/**` and `git fetch --unshallow`,
without which nine exit 3 on unmet prerequisites).
- `overlap-check.mjs` before every push: clean with origin/main and with
objectstack-ai#38594 (which edits
`18.publish-refuses-flows-that-save-and-do-not-run.ts`; `git merge-tree`
against its head applies that edit to the renamed `19.` file). One
overlap, see Acceptance notes.
</details>

## Acceptance notes
- **Textual overlap with objectstack-ai#38550.** Both PRs insert a line into
`MAJOR_19_CONVERSIONS`'s imports and list directly after
`permissionViewAllFieldsBesideRecordBypass` (this one
`viewColumnStateRemoved`, objectstack-ai#38550 `viewBulkActionsToActionSelection`), so
whichever lands second merges main and resolves it mechanically: both
lines kept, in identifier order (`viewBulk…` before `viewColumn…`).
`registry.ts.template` merges clean with objectstack-ai#38550. The seat chose to open
this PR rather than wait.
- Released prereleases (`19.0.0-next.0` to `next.2`) carry these
entries, rows and conversions under 18 and stay as published; the fix
ships with the next prerelease.

## Verification
Read first (by risk):
1. `packages/spec/src/conversions/registry.ts`: the three entries' new
`order` values and the docblock that says why.
2. `packages/spec/src/migrations/registry.ts.template`: the four
fragments moved from `STEP18_RATIONALE` into step 19's rationale.
3. The renames: `git diff --stat -M origin/main...HEAD` shows R100 for
the 34 semantic entries and the three columnState / KnowledgeChunk rows.

Two-minute check: in `packages/spec`, run `pnpm gen:migration-registry`,
then `grep -n "object-grid-single-click-edit-retired"
src/migrations/registry.ts`. On this branch the id sits inside the
`semantic:19` region; on main it sits inside `semantic:18`.

<!-- signed: repo:objectstack#3 · os-steve ·
session_01ADHkmQcqpJwkeqnruAv4md -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
… whose documentBy is not a single-valued parent link (objectstack-ai#38662)

<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ8Xj6YfMRKw8XnmTA1ohBr6K)_

Fixes objectstack-ai#38537

Clause-②: no
Metadata-protocol: none

**Lands after objectstack-ai#38594** (merged 2026-11-30T01:10Z; main merged into this
branch at `d1e1ba3f03`). Both PRs are seat 2's. The overlap is two files
(`packages/lint/src/index.ts`,
`packages/lint/src/rule-explanations.ts`), in hunks far apart;
`overlap-check` reads both clean against each other and main.

## 维护者速读

- 用户能看到什么变化:知识源的“文档单位”(`documentBy`)如果填的不是指向父记录的单值查找字段,`os validate` /
`os build` / `os lint` 和发布时都会报错并说明怎么改。之前只有在 Studio / 元数据 API 保存时才会拒绝。
- 为什么做:随包发布或代码注册的知识源不经过保存这道门,填错了没人拦,检索按父记录聚合会悄悄失效。这是 objectstack-ai#38537 的第二个也是最后一个
PR。
- 出错会怎样:只影响声明了 `documentBy` 的知识源;规则误判会让正确的知识源发布失败,删掉 `documentBy` 即可绕开。
- 要你做什么:无。

## What changes

- **New rule** `knowledge-source-document-by-not-parent-link` (`error`)
in `validate-knowledge-source.ts`. It refuses a `source.documentBy` that
`metadataFields` lists and that is not a single-valued parent link of
the indexed object. The checks run in the save door's order: declared by
the object, neither credential-class nor `internal`, a `lookup` /
`master_detail` type, a target `referenceTargetOf` can read, and not
`multiple: true`. Each reason gets its own message, worded like the save
door's `documentUnitRefusalText`, naming the field and the fix. Path:
`knowledgeSources[i].source.documentBy`.
- **Where it runs.** The rule rides the existing
`validateKnowledgeSource` registry entry, so it reaches `os validate` /
`build` / `lint` and the runtime publish gate (`knowledge_source`
writes) with no new wiring. This is what judges a source a package ships
or code registers; until now only the metadata API's save door did
(objectstack-ai#38564).
- **Not judged twice.** A `documentBy` that `metadataFields` does not
list is left to the parse, which already names that fix. A member the
object does not have is reported once, as
`knowledge-source-field-unknown`. An object with no readable field map
is not judged.
- **Published and explained.** The rule id is re-exported from the root
barrel (`index.ts`, one line in the knowledge block).
`rule-explanations.ts` gets its `os explain` entry and table row beside
the five sibling rules.
- **Census pin**
(`packages/core/src/security/second-object-read-exposure.pin.test.ts`):
the new `referenceTargetOf` import makes `validate-knowledge-source.ts`
a caller of the reference-target arbiter, so it is classified
`not-a-served-read` beside the other lint callers. It only asks whether
a target is declared, and reads and serves nothing of the target.
Admitted by the seat for this fix after CI's Test Core (8/12) flagged
the unclassified caller. Locally: 1 failed / 3 passed before the entry,
4/4 after.
- **Changeset** `patch` for `@objectstack/lint`.

## Route chosen for the parent-link rule (objectstack-ai#38564's PR 2 question)

objectstack-ai#38564 left PR 2 two ways to reach `parentLinkRule` / `documentUnitOf`
(`service-knowledge`'s `knowledge-search-scope.ts`). The seat accepted a
third:

- **A: lint imports `@objectstack/service-knowledge`.** Not taken.
`@objectstack/lint`'s package description says it "Depends on
@objectstack/spec; never on a runtime", and service-knowledge is a
runtime service. It would also need a new line on service-knowledge's
`exports` surface.
- **B: move the rule to "a package lint already reads, for example
`@objectstack/core`".** Not taken. Lint does not depend on
`@objectstack/core`; its workspace dependencies are `formula`,
`metadata-core`, `sdui-parser` and `spec`. Moving it to `spec` would put
runtime-shaped logic into the protocol package and widen this PR well
past its card.
- **C (taken): compose the verdict in lint from the spec predicates
`parentLinkRule` itself asks.** Withheld =
`isMaskedOnReadFieldType(type, managedBy)` or `internal === true`. That
is the reading this file already takes for
`knowledge-source-field-never-indexed`, and the one
`collectCredentialWriteResponseFields` /
`collectInternalWriteResponseFields` compute in core. Target =
`referenceTargetOf` (`@objectstack/spec/data`). The type pair `lookup` /
`master_detail` is spelled locally, as eight other lint rule files
already spell it. Cost: the four-part rule now lives in two places. No
test pins their agreement, because no package that depends on both can
import `documentUnitOf` without one more barrel line in
service-knowledge. The module header names the save door's function so a
change to one points at the other.

## Why

ADR-0161 K4: "a packaged item meets the gates that need no principal in
`os validate` and at publish". `documentBy` is such a gate: it reads
only the object definition. objectstack-ai#38564 left it judged at save only, and its
body says "PR 2's `os validate` rule covers packaged sources."

## Clause-② and Metadata-protocol, measured from the diff

`Clause-②: no` / `Metadata-protocol: none`, a judgement call stated here
for review. The rule refuses values of `source.documentBy`, a key objectstack-ai#38564
added in this same prerelease line. Its changeset
`.changeset/38537-knowledge-document-by.md` is still pending (not moved
to `.changeset/pre/`), so no published version carries the key and
nothing an author could write against a release is refused. The metadata
API's save door already refuses the same values. Read against `main`
instead, a packaged source with a non-parent-link `documentBy` passed
`os validate` before this PR and fails it after. If review prefers that
reading, the lines become `Clause-②: no (narrowing)` /
`Metadata-protocol: narrowed` (level `minor` and an ADR-0087
disposition).

## Verification

### Acceptance (the card's `os validate` half)

| Card line | Test (`validate-knowledge-source.document-by.test.ts`) |
|:--|:--|
| Refuse a text field, a `user` field, an `internal` lookup and a
`multiple` lookup, each naming the fix | "refuses a text field / a user
field / an internal lookup / a multiple lookup as the document unit,
naming the field and the fix" |
| (the save door's other reasons) | "… a credential-class field", "… a
lookup with no readable target", "… a system column the platform adds" |
| Positive controls | "CONTROL: a lookup and a master_detail to the
parent are admitted", "CONTROL: a source without documentBy is judged as
before" |
| Same verdict at publish | "refuses the publish with the words os
validate prints", "CONTROL: a single-valued parent link publishes with
nothing to report" |
| Published id + `os explain` | "the root barrel re-exports it", "os
explain answers it" |

### Ablation (`scripts/ablation-replace.mjs`, each mutation verified on
disk, each restore verified blob == HEAD `d9f63681062f` with an empty
`git diff HEAD`)

<details><summary>Call site disabled (<code>const refusal =
documentUnitRefusal(…)</code> → <code>undefined</code>): 9 red</summary>

`validate-knowledge-source.document-by.test.ts`: 9 failed / 8 passed.
All seven refusal tests, "a fields array is read like a field map", and
"refuses the publish with the words os validate prints". The controls
stay green.
</details>

<details><summary><code>multiple</code> arm deleted: 1 red</summary>

1 failed / 16 passed: "refuses a multiple lookup as the document unit…".
</details>

<details><summary><code>internal</code> half of the withheld arm
removed: 1 red</summary>

1 failed / 16 passed: "refuses an internal lookup as the document
unit…". (A first attempt was refused by the tool before running
anything, because its replacement text already occurred in the file; it
was re-run with a distinct replacement.)
</details>

### Package suite and typecheck

- `pnpm --filter @objectstack/lint test`: Test Files 248 passed (248),
Tests 9989 passed / 5 skipped. Exit 0.
- `pnpm --filter @objectstack/lint typecheck` (tsc + test layer): exit
0.
- `eslint` on the four changed source files: exit 0.
- `overlap-check`: VERDICT clean exit 0. origin/main merges cleanly, and
so do the 7 open PRs sharing a file (objectstack-ai#38651, objectstack-ai#38650, objectstack-ai#38643, objectstack-ai#38605,
objectstack-ai#38594, objectstack-ai#38550, objectstack-ai#38497).

### Derived gate families (`dispatch-gates.mjs --commands`, 70)

- First pass, captured per the tool's idiom: `--ran` reports "70 derived
famil(ies) accounted for — 66 run, 4 NOT-MEASURED (4 DERIVED from a
recorded exit 3)". All 66 that ran exited 0, including
`check-changeset-no-major --base origin/main`,
`check-adr-0087-registration --base origin/main`, `check:doc-authoring`,
`check:issue-citations` and `check:cross-package-test-inputs`.
- The four exit-3 families each had a prerequisite missing. Three were
re-run after fixing it, each exit 0: `check-plugin-teardown-shape
--self-test` (needed `git fetch --unshallow`),
`check:docs-transcript-drift` (needed the built lint) and
`check:lean-entry-closure` (needed the built objectql). These re-runs
were by hand, outside the `--ran` record.
- `check:dual-build-cjs-loads` was not measured locally: it reads every
package's `dist/`, which needs a full build. CI's `Build Core` job runs
it on this PR.

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(spec untouched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes (eslint on the changed
files).
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: n/a.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English (the 维护者速读 block is the
maintainer's Chinese brief).
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

## Read first

1. `packages/lint/src/validate-knowledge-source.ts`:
`documentUnitRefusal` and the call site after
`judgeMembers('metadataFields')`.
2. `packages/services/service-knowledge/src/knowledge-search-scope.ts`:
`parentLinkRule` / `documentUnitOf`, the save door's rule this one
restates.

**Two-minute check:** `pnpm --filter @objectstack/lint exec vitest run
src/validate-knowledge-source.document-by.test.ts`. Expect 17 passed.

Dogfood: n/a (no `!` in the title, no `(narrowing)` arm).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01JQwxbWsSJprjGydwaCH1gD

<!-- signed: repo:objectstack#2 · os-warren ·
session_01JQwxbWsSJprjGydwaCH1gD -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…s lanes do (objectstack-ai#38681)

<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ844kETyNGBBt9atKc1Snfzd)_
Fixes objectstack-ai#38558
Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:列表里按查找字段或文本字段分道的看板,页脚现在显示整个视图的记录数(例如 70
条),与各道计数之和一致;只有看板确实只画了第一页的道时,才保留「只显示前 N 条」。
- 为什么做:同一块看板上页脚写 25 条、各道加起来却是 70 条,两个数字互相矛盾(看板页脚计数卡)。
- 出错会怎样:最坏是页脚数字或「只显示前 N 条」提示显示错,不影响数据本身;可直接撤回本 PR。
- 要你做的:无。

## What changes

- `ui/packages/plugin-list/src/ListView.tsx`, the record-count bar under
a board the list hands its window to (`kanbanLaneStatisticHosted`). With
a numeric `fetchedTotal`, the count is the query's total instead of the
window's length, which is the number the board's lanes add up to. The
same figure feeds the view switcher's count (`leadingRecordCount`).
- The "Showing first N" line is dropped only where the board reaches
every record by itself (`kanbanHostedBoardReachesEveryRecord`): lanes
from the data, a lookup or text lane field, no declared lanes, no
swimlanes, and a source with `queryGroupHeaders`. Number, boolean and
date lane fields, declared lanes, swimlanes and a source with no grouped
door draw only the page's lanes, so the line stays there. i18n wording
is unchanged.
- Pin: a new top-level describe in the shared harness
`ui/packages/app-shell/src/__tests__/listKanbanEveryRecord-12619.test.tsx`
(AGENTS.md shared-harness rule). Text-laned and lookup-laned boards read
"70 records" with no warning, and the text board's lane sum equals the
footer figure. CONTROLs: a number-laned board and a source with no
grouped door keep "Showing first 25 records".
- Changeset `.changeset/38558-kanban-footer-count.md` (patch,
`@object-ui/plugin-list`).

## Tests

Head `e4b485a5`, after building the `@object-ui/app-shell^...` closure
under os-verify-lock (command-exit 0):

- `pnpm exec vitest run --maxWorkers=2
packages/app-shell/src/__tests__/listKanbanEveryRecord-12619.test.tsx`
(under the lock): 1 file, 49 tests passed (45 existing, the objectstack-ai#38506 pin
included and still green, plus 4 new).
- `pnpm exec vitest run --maxWorkers=2 packages/plugin-list/`: 190
files, 2083 tests passed.
- `@object-ui/plugin-list` `type-check` (tsc + tsconfig.test.json): exit
0.
- Ablation A1 (`hostedBoardTotal` forced to null): all 4 new tests red
(footer lacks "70 records"). Ablation A2 (the warning gate's `&&
kanbanHostedBoardReachesEveryRecord` removed): 2 CONTROLs red, 2 pins
green. Both restored, blob == HEAD.

## Acceptance notes

- The warning gate is static: if the lane read is refused or cut at
runtime, the board shows page counts marked `+` and no lane past the
page, while the footer reads the full total with no "Showing first N".
The total is still true, but past-page records are not reachable on the
board in that state.

## Verification

- `dispatch-gates --commands` at `e4b485a5`: 38 derived families, 38
run, all exit 0 (the `ui scripts/` vitest under the lock: 172 files
passed, 2 skipped; 5159 tests passed). `--ran`: 0 NOT-MEASURED.
- `overlap-check.mjs` at `e4b485a5` against origin/main `0ba5e06a`:
clean (objectstack-ai#38550 shares ListView.tsx and merges cleanly).
- CI check-runs: read on this PR.

Files to read first: `ListView.tsx` hunks at
`kanbanHostedBoardReachesEveryRecord` and `hostedBoardTotal` (the risk
is the warning gate).
Two-minute check: open a list-view kanban laned by a lookup field with
more records than its page size. The footer should read the full count,
equal to the sum of the lane badges, with no "Showing first N".

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01JQwxbamiNxp7695qyaEYsH

<!-- signed: repo:objectstack#2 · os-warren ·
session_01JQwxbamiNxp7695qyaEYsH -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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 protocol:data protocol:system protocol:ui size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bulk actions declared on the action (selection) with a selection arm in the object action layout, moved from view bulkActions

3 participants