Skip to content

feat(spec)!: form is a metadata type of its own, and the form doors read a form over both types - #37422

Merged
os-alice merged 45 commits into
claude/project-thread-pu5dntfrom
claude/project-thread-pu5dnt-b
Nov 27, 2026
Merged

os-alice merged 45 commits into
claude/project-thread-pu5dntfrom
claude/project-thread-pu5dnt-b

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Alice · project thread

Fixes #37086 — PR B of the card's fixed 3,000-line cut, stacked on #37366 (the rename only). Merge #37366 first, then retarget this onto main. The two land together, because ADR-0159:109 anchors view.zod.ts#defineForm, and only this PR declares it again.

Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #37105

维护者速读

  • 用户能看到什么变化:开发者可以把公开表单单独定义成一种"表单"元数据;写在视图里的旧表单照常工作,公开表单的地址和回答都不变。
  • 为什么做:"表单成为独立元数据类型"系列的第二步,给后面 Setup 里的表单开关和表单设计器打基础。
  • 出错会怎样:碰到的是保存、发布或恢复被拒(公开地址已被另一个表单占用,或在只读包的表单名下放没有归属的列表),或公开表单打不开;已存数据不会被改写,可以整体撤回。
  • 要你做什么:无。

What changes

form becomes a metadata type of its own (ADR-0159 card ②, items 1, 2 and 4 to 10, as the card rules them):

  • spec
    • FormSchema derives every body key from FormViewSchema by reference. The name is OBJECT.KEY. data, viewKind, config, isDefault, order and scope are refused by name.
    • Also new: defineForm, the registry row (*.form.ts|yml|json), the stack's forms: and the forms translation family. The family reads forms.NAME first, with the _views title and thank-you tails as the fallback. A form's own section copy is forms.NAME.sections.SECTION.{label,description} and .fields.FIELD.{label,placeholder,helpText} (D8). Each key the form's node lacks reads objects.OBJECT._sections.SECTION, the object-level default.
    • One projection, projectViewForms, reads the three old view shapes. The intake layer is formIntakeLayer / openFormAt.
    • New error code FORM_ADDRESS_TAKEN, a liveness ledger form.json, and a semantic migration entry 18.form-type-define-form-and-packageless-list-at-form-name.
  • metadata-protocol
    • The effective form read resolves over both types in the served-row order (D5). Each address holds one definition. A package-less stored form row over a base that ships the form as an old shape is listed once, at the base's address, with the row's body.
    • A form left open on a held address is refused with 409 FORM_ADDRESS_TAKEN. The refusal applies on the save, on the publish of a draft whose address was taken after the draft was saved, and on a rollback to a version that is open on a held address.
    • A form save, publish, reset or delete removes, in the same transaction, only the package's old-shape row that carries that same form. Which forms a stored row carries, and under which names, is the form read's own answer (storedViewRowHoldings), so the write and the read name a stored container's members one way. This touches form content only: a list of that name, and a container member served under another name, stay byte-equal.
    • A package-less list at a name that a read-only package authors as a form is refused with 400. The refusal applies on the save, on the publish of a pre-gate draft and on restore.
    • After an old-shape removal, one registry heal (healOldShapeFormRowRemovals) restores the view registry for each removed row.
    • An unreadable stored body closes the links it names. It is reported once per process at error, the first time the form doors read it. There is no boot hook: a project kernel must not read sys_metadata view rows at boot.
    • getPackagedFormBase answers a form's packaged base: the authored form item, or else the form the base's view item projects.
    • An undo puts back the rows the publish moved: the undo of a package publish refused part-way on an engine that cannot roll back, and a commit revert, on every engine.
    • When one view row a commit edited cannot be put back, every form item of that commit is kept as published, and each is listed in the revert's failed[].
    • After a refused or undone publish, the doors and the meta reads answer only committed state.
  • rest
    • GET /forms/:slug and its submit read their candidates from ONE effective form read. They judge withdrawal across form and view, both effective and per-package (D6 rules 1 to 11). This narrows only.
    • The door keeps no second candidate source: a protocol that serves no form item serves no candidate.
    • GET /api/v1/meta/form/NAME refuses whoever /meta/view/NAME refuses, on the cached plain read as well as on the uncached read.
    • A form override's own changed text outranks the base's catalog, on /meta/form and on the public door (the form row of PACKAGED_BASE_ACCESSORS).
  • lint
    • New rules: form-public-address-taken (gating), form-consumer-less (advisory), form-object-outside-closure and form-object-unknown.
    • The i18n walker emits a form item's section copy at the form's own node, forms.NAME.sections.SECTION…, with the object-level _sections slot as each key's fallback address. The translation reference lint judges forms.NAME.sections.SECTION against the sections the form names, and .fields.FIELD against each section's entries (translation-target-unknown). A form the stack does not author is not judged.
  • metadata, metadata-core, objectql, runtime, cli
    • forms is loaded, typed, registered and counted for i18n coverage.
    • The coverage count and os i18n extract read the fallback address: a section translated at either address counts as translated, and extract writes no translated-locale scaffold over a translation the object-level slot holds.

Why

ADR-0159 card ②. The breaking surface is written out in .changeset/37086-form-metadata-type.md.

Measure-first answer (D7-b)

  • Over a base that authors a form item: a declared view list override at the form's name is refused with 403 NOT_OVERRIDABLE.
  • Over an old-shape base: the same override is admitted, and it closes the address.

Both cases are pinned in packages/rest/src/public-form-two-type-withdrawal.test.ts ("measure-first").

Rule 9: the premise is stale

D6 rule 9 asks that an organization-scoped form save be judged as the same view save is. On this tree, every organization-scoped write is refused before any other gate reads the body. packages/metadata-protocol/src/protocol-save.ts, saveMetaItemUnaudited:

[ADR-0131 D6] FIRST, before every other gate and every read: an organization-scoped write is refused for every type, draft or publish.

It calls refuseOrganizationScopedWrite. protocol-write-gates.ts#organizationScopedWriteRefusal returns null only for an empty organization; otherwise it returns 403 NOT_OVERRIDABLE. So no organization layer exists to hold a withdrawal, in either type. The pin "rule 9" holds the form save and the view save to the same answer: 403 NOT_OVERRIDABLE, nothing written, the doors still closed. protocol.org-scoped-write-refused.test.ts already enumerates DEFAULT_METADATA_TYPE_REGISTRY, so it covers form.

Door pins and ablations

The pins are in packages/rest/src/public-form-two-type-withdrawal.test.ts. The harness is a real ObjectQL engine with SqlDriver on :memory:, the real protocol and the real routes. Each door pin drives both doors: GET /forms/:slug and its submit.

First round (the head this PR opened at):

Ablation Removes Pins that go red
A1 view half of the layer 3, 5v, narrowing
A2 form half of the layer none (pin 2b, below, closes this)
A3 projection step 3, 5v, narrowing
A4 whole-item name match (replaced by slug equality) 4
A5f per-package form layer none
A5v per-package view layer 5v
A6 rule 7 (an unreadable body closes its links) 6
A7 cross-type resolution (D5) 7, 7 twin
A8 A1 + A7 3, 5v, 7, 7 twin, narrowing

Pin 1 stays green under A1 and A8, and pin 2 under A2: D5's cross-type resolution, or the candidate itself, already holds the withdrawal. That is why the second round adds pin 2b, where the form half is the only reader. A5f and the exempt reader are measured again in the third round (T3, T7 to T9).

Second round (this rework). Each run follows the same steps:

  1. Mutate the source on disk.
  2. Rebuild the package's dist that the harness reads.
  3. Run the whole harness file and record the red pins.
  4. Restore with git checkout and rebuild.
  5. Read git diff HEAD --stat (empty after every run).

No ablation was committed. No pin was weakened to get these readings.

Run Removes Pins that go red
R1 the form half of the layer (formIntakeLayer's loop over the forms) pin 2b, pin 2b twin, pin 5f
R2 served rows only: every stored view row projected served rows only (F1), pins 4 and 5v
R3 the served row taken from the effective view list, not the served-row order served rows only at the address (F2), both closed readings, pin 7
R4 the closed reading (a stored list falls through to the package's source form) both closed readings (list and container)
R5 the bound (the package-less list refusal) both bound pins, and the three refusal pins
R6 the expansion half of the bound the container refusal, the bound pin
R7 the form-content test of the old-shape row removal the list stays untouched; byte-equal across save, publish and reset; byte-equal across delete
R8 the projection half of the override gate's "ships" read the declared_package_ships_no_such_item pin (its CONTROL is refused), pin 2, narrowing, and the five pins that write a form override over an old-shape base
R9 projected items parsed as form items (data stripped, refused ones dropped) the data.object door pin, the /meta/form route pin
R10 the publish refusal the publish clash pin, the pre-gate list draft pin
R11 the restore refusal the restore pin
R12 the form row of PACKAGED_BASE_ACCESSORS the override's own text pin
R13 one definition per address (the package-less form row deferral) the one-definition pin
R14 form in the cached plain read's audience fold the /meta/form route pin
R15 forms.NAME.sections in translateForm (spec source; spec tests read the source, so there was no rebuild) i18n-resolver.form-item.test.ts "reads the form's own section node first"

The per-run proof (the mutation diff, the build exits, the red titles and the empty git diff HEAD) is below. In the diffs, angle brackets are written as ‹ › so the body's sanitizer keeps them.

R1, form-half: 3 of 48 red
  • The mutation, on disk in packages/spec/src/ui/form-intake-layer.ts (diff below). Rebuilt: the spec dist, exit 0.
  • The harness: 45 passed, 3 failed. The red pins are named in the table.
  • Restored with git checkout and rebuilt (exit 0). git diff HEAD --stat after: (empty).
--- packages/spec/src/ui/form-intake-layer.ts
@@ -63,7 +63,7 @@
-  for (const form of input.forms) {
+  for (const form of [] as ReadonlyArray‹unknown›) {
R2, every-stored-view-row: 3 of 48 red
  • The mutation, on disk in packages/metadata-protocol/src/protocol-form-reads.ts (diff below). Rebuilt: the metadata-protocol dist, exit 0.
  • The harness: 45 passed, 3 failed. The red pins are named in the table.
  • Restored with git checkout and rebuilt (exit 0). git diff HEAD --stat after: (empty).
--- packages/metadata-protocol/src/protocol-form-reads.ts
@@ -249,7 +249,7 @@
-    for (const view of views) {
+    for (const view of [...views, ...(await storedEntries(host, 'view')).map((e) =› ({ ...(e.data as object), ...(e.packageId ? { _packageId: e.packageId } : {}) }))]) {
R3, served-rows-from-view-list: 4 of 48 red
  • The mutation, on disk in packages/metadata-protocol/src/protocol-form-reads.ts (diff below). Rebuilt: the metadata-protocol dist, exit 0.
  • The harness: 44 passed, 4 failed. The red pins are named in the table.
  • Restored with git checkout and rebuilt (exit 0). git diff HEAD --stat after: (empty).
--- packages/metadata-protocol/src/protocol-form-reads.ts
@@ -311,7 +311,8 @@
-        const served = servedFormHolding(await placesOf(), name, pkg!, installed);
+        const viaList = projected.get(keyOf(pkg, name)) ?? projected.get(keyOf(undefined, name));
+        const served = (viaList ? { holding: { kind: 'form', item: viaList }, place: { type: 'view' } } : undefined) as any;
R4, closed-reading-fallthrough: 2 of 48 red
  • The mutation, on disk in packages/metadata-protocol/src/protocol-form-reads.ts (diff below). Rebuilt: the metadata-protocol dist, exit 0.
  • The harness: 46 passed, 2 failed. The red pins are named in the table.
  • Restored with git checkout and rebuilt (exit 0). git diff HEAD --stat after: (empty).
--- packages/metadata-protocol/src/protocol-form-reads.ts
@@ -320,7 +320,7 @@
-        // …else the closed reading: nothing is served for the name from the package.
+        else put(key, item);
R5, the-bound: 5 of 48 red
  • The mutation, on disk in packages/metadata-protocol/src/protocol-form-writes.ts (diff below). Rebuilt: the metadata-protocol dist, exit 0.
  • The harness: 43 passed, 5 failed. The red pins are named in the table.
  • Restored with git checkout and rebuilt (exit 0). git diff HEAD --stat after: (empty).
--- packages/metadata-protocol/src/protocol-form-writes.ts
@@ -77,7 +77,7 @@
-    if ((PLURAL_TO_SINGULAR[type] ?? type) !== 'view') return undefined;
+    if (type.length › 0) return undefined;
R6, expansion-half: 2 of 48 red
  • The mutation, on disk in packages/metadata-protocol/src/protocol-form-writes.ts (diff below). Rebuilt: the metadata-protocol dist, exit 0.
  • The harness: 46 passed, 2 failed. The red pins are named in the table.
  • Restored with git checkout and rebuilt (exit 0). git diff HEAD --stat after: (empty).
--- packages/metadata-protocol/src/protocol-form-writes.ts
@@ -43,7 +43,7 @@
-            names.push(...projectViewForms(expanded).lists);
+            void expanded;
R7, removal-form-content-test: 3 of 48 red
  • The mutation, on disk in packages/metadata-protocol/src/protocol-form-writes.ts (diff below). Rebuilt: the metadata-protocol dist, exit 0.
  • The harness: 45 passed, 3 failed. The red pins are named in the table.
  • Restored with git checkout and rebuilt (exit 0). git diff HEAD --stat after: (empty).
--- packages/metadata-protocol/src/protocol-form-writes.ts
@@ -206,7 +206,7 @@
-        if (!projection.forms.some((form) =› form.name === name)) continue;
+        void projection;
R8, override-gate-projection-half: 8 of 48 red
  • The mutation, on disk in packages/metadata-protocol/src/protocol-packaged-base-refusal.ts (diff below). Rebuilt: the metadata-protocol dist, exit 0.
  • The harness: 40 passed, 8 failed. The red pins are named in the table.
  • Restored with git checkout and rebuilt (exit 0). git diff HEAD --stat after: (empty).
--- packages/metadata-protocol/src/protocol-packaged-base-refusal.ts
@@ -1439,7 +1439,7 @@
-                    .filter((a) =› projectViewForms(a).forms.some((form) =› form.name === request.name))
+                    .filter((a) =› projectViewForms(a).forms.some(() =› false))
R9, parse-projected-with-FormSchema: 2 of 48 red
  • The mutation, on disk in packages/metadata-protocol/src/protocol-form-reads.ts (diff below). Rebuilt: the metadata-protocol dist, exit 0.
  • The harness: 46 passed, 2 failed. The red pins are named in the table.
  • Restored with git checkout and rebuilt (exit 0). git diff HEAD --stat after: (empty).
--- packages/metadata-protocol/src/protocol-form-reads.ts
@@ -249,9 +249,12 @@
+    // ABLATION: the projected items parsed as `form` items (`data` stripped, as a normalizing parse would), the refused ones dropped.
+    const { FormSchema: AblFormSchema } = await import('@objectstack/spec/ui');
+    const asFormItem = (f: unknown): boolean =› { const { [PROJECTED_FORM_SOURCE_KEY]: _m, data: _d, ...plain } = f as Record‹string, unknown›; return (AblFormSchema as any).safeParse(plain).success; };
-        for (const form of projectViewForms(view).forms) {
+        for (const form of projectViewForms(view).forms.filter(asFormItem)) {
R10, publish-refusal: 2 of 48 red
  • The mutation, on disk in packages/metadata-protocol/src/protocol-history-and-publish.ts (diff below). Rebuilt: the metadata-protocol dist, exit 0.
  • The harness: 46 passed, 2 failed. The red pins are named in the table.
  • Restored with git checkout and rebuilt (exit 0). git diff HEAD --stat after: (empty).
--- packages/metadata-protocol/src/protocol-history-and-publish.ts
@@ -1205,10 +1205,7 @@
-            const formRefusal = await formTypeWriteRefusal(
-                host, singularType, draftForGate.body, request.name, promoteInto,
-            );
-            if (formRefusal) throw formRefusal;
+            void formTypeWriteRefusal;
R11, restore-refusal: 1 of 48 red
  • The mutation, on disk in packages/metadata-protocol/src/protocol.ts (diff below). Rebuilt: the metadata-protocol dist, exit 0.
  • The harness: 47 passed, 1 failed. The red pins are named in the table.
  • Restored with git checkout and rebuilt (exit 0). git diff HEAD --stat after: (empty).
--- packages/metadata-protocol/src/protocol.ts
@@ -1593,7 +1593,7 @@
-        return formTypeWriteRefusal(protocolHost(this), type, item, name, binding);
+        return formTypeWriteRefusal(protocolHost(this), type, item, name, binding).then(() =› undefined);
R12, packaged-base-accessor-form-row: 1 of 48 red
  • The mutation, on disk in packages/rest/src/meta-item-read-gate.ts (diff below). Rebuilt: none (the rest tests run its source), exit 0.
  • The harness: 47 passed, 1 failed. The red pins are named in the table.
  • Restored with git checkout and rebuilt (exit 0). git diff HEAD --stat after: (empty).
--- packages/rest/src/meta-item-read-gate.ts
@@ -3444,7 +3444,6 @@
-    ['form', 'getPackagedFormBase'],
R13, one-definition-per-address: 1 of 48 red
  • The mutation, on disk in packages/metadata-protocol/src/protocol-form-reads.ts (diff below). Rebuilt: the metadata-protocol dist, exit 0.
  • The harness: 47 passed, 1 failed. The red pins are named in the table.
  • Restored with git checkout and rebuilt (exit 0). git diff HEAD --stat after: (empty).
--- packages/metadata-protocol/src/protocol-form-reads.ts
@@ -303,7 +303,7 @@
-        if (pkg === undefined && projectedAddressesOf.has(name)) {
+        if (pkg === undefined && projectedAddressesOf.has(name) && name.length ‹ 0) {
R14, cached-read-audience-form: 1 of 48 red
  • The mutation, on disk in packages/rest/src/meta-item-read-routes.ts (diff below). Rebuilt: none (the rest tests run its source), exit 0.
  • The harness: 47 passed, 1 failed. The red pins are named in the table.
  • Restored with git checkout and rebuilt (exit 0). git diff HEAD --stat after: (empty).
--- packages/rest/src/meta-item-read-routes.ts
@@ -775,7 +775,7 @@
-                        const audienceFolds = metaType === 'view' || metaType === 'object' || metaType === 'form';
+                        const audienceFolds = metaType === 'view' || metaType === 'object';
R15, forms.NAME.sections: 1 of 10 red
  • The mutation, on disk in packages/spec/src/system/i18n-resolver.ts: translateForm passes no form name to translateFormSections, so only _sections is read.
  • pnpm exec vitest run src/system/i18n-resolver.form-item.test.ts (spec tests import the source): 9 passed, 1 failed. Red: "reads the form's own section node first, and _sections for each key it lacks". The CONTROL ("with no forms.NAME.sections node, _sections translates the section as before") stays green.
  • Restored with git checkout. git diff HEAD --stat after: (empty).
-    ? translateFormSections(form.sections, catalogs, formSectionObjectName(form, objectName), opts, base, name)
+    ? translateFormSections(form.sections, catalogs, formSectionObjectName(form, objectName), opts, base)

Third round (rework 3). Same steps as the second round. The harness now holds 53 pins: five new ones in its last describe, on an engine double that cannot roll back (NoRollbackSqlDriver, supports.transactionsUnsupported) and on SqlDriver. Pin titles name the rule each holds.

Run Removes Red
T1 the rule "an undo puts back the rows the publish moved", undo leg 1 of 53: the refused-publish pin
T2 the same rule, commit revert leg 2 of 53: both revert pins
T3 A5f again: the per-package form layer 2 of 53: pin 5f, pin 2b twin
T4 the bound written the D5 way (any stored view place holds the name) 2 of 53: pin 2b, the ensurable-pair bound pin
T5 question 3, holder half (only an open form holds) 1 of 53: the switched-off holder pin
T6 question 3, writer half (every save keeping a link is judged) 2 of 53: the closed-save CONTROL, the container re-save pin
T7 the exempt reader (oldShapeFormWithdrawals returns none) 4 of 53: pins 3, 4, 5v, narrowing
T8 T7 + the form half (R1) 7 of 53: pins 3, 4, 5f, 5v, narrowing, 2b, 2b twin
T9 T8 + cross-type resolution (the served form row is the generic item) 10 of 53: pin 1, pins 3, 4, 5f, 5v, 7, 7 twin, narrowing, 2b, served rows at the address
T10 the forms leg of the reference lint 1 of 270: the new reference-lint test
T11 the walker's forms.NAME.sections emission 3 of 7: all three cli section tests
T12 the fallback address in the coverage count 1 of 7: the coverage test
T13 the fallback address in extract 1 of 7: the extract test

Readings from this round:

  • A5f read "none" in the first round because no pin then had the per-package form layer as its only reader. Pin 5f and pin 2b's twin now go red without it (T3).
  • The exempt reader (T7): pins 1 and 6 stay green. Pin 1 is held by the form half and by D5's cross-type resolution, pin 6 by rule 7's closed links. T8 and T9 remove those readers in turn. Pin 1 goes red only in T9, with all three removed. Pin 6 stays green in all three: only the first round's A6 (rule 7) turns it red.
T1: 1 of 53 red
  • At 7b0f2f8c7; the mutation in packages/metadata-protocol/src/protocol-history-and-publish.ts (the undo leg of the rule); rebuilt mp exit 0; 52 passed. Then restored and rebuilt mp exit 0; git diff HEAD --stat (empty). The red pin is named in the table.
T2: 2 of 53 red
  • At 7b0f2f8c7; the mutation in packages/metadata-protocol/src/protocol-history-and-publish.ts (the commit revert leg of the rule); rebuilt mp exit 0; 51 passed. Then restored and rebuilt mp exit 0; git diff HEAD --stat (empty). The red pins are named in the table.
T3: 2 of 53 red
  • At 7b0f2f8c7; no rebuild (the tests import the source); 51 passed. Then restored; git diff HEAD --stat (empty). The red pins are named in the table.
--- packages/rest/src/form-routes.ts
@@ -325,7 +325,7 @@
-            forms: [...forms, ...(await perPackage(formsRequest))],
+            forms: [...forms],
T4: 2 of 53 red
  • At 7b0f2f8c7; rebuilt mp exit 0; 51 passed. Then restored and rebuilt mp exit 0; git diff HEAD --stat (empty). The red pins are named in the table.
--- packages/metadata-protocol/src/protocol-form-reads.ts
@@ -160,10 +160,10 @@
-        const at = places.filter((place) => place.holds.has(name)
-            && (candidate.packageId === undefined || (place.packageId ?? null) === candidate.packageId)
+        const at = places.filter((place) => place.holds.has(name) && (place.type === 'view'
+            || ((candidate.packageId === undefined || (place.packageId ?? null) === candidate.packageId)
-                { type: place.entry.type, package_id: place.packageId ?? null, metadata: place.entry.data }, installed, undefined));
+                { type: place.entry.type, package_id: place.packageId ?? null, metadata: place.entry.data }, installed, undefined))));
T5: 1 of 53 red
  • At 7b0f2f8c7; rebuilt mp exit 0; 52 passed. Then restored and rebuilt mp exit 0; git diff HEAD --stat (empty). The red pins are named in the table.
--- packages/metadata-protocol/src/protocol-form-writes.ts
@@ -136,7 +136,7 @@
-        if (formHeldSlug(form) !== slug) return false;
+        if (anonymousFormIntakeSlug((form as { sharing?: unknown }).sharing) !== slug) return false;
T6: 2 of 53 red
  • At 7b0f2f8c7; rebuilt mp exit 0; 51 passed. Then restored and rebuilt mp exit 0; git diff HEAD --stat (empty). The red pins are named in the table.
--- packages/metadata-protocol/src/protocol-form-writes.ts
@@ -130,7 +130,7 @@
-    const slug = anonymousFormIntakeSlug((item as { sharing?: unknown }).sharing);
+    const slug = formHeldSlug(item) ?? null;
T7: 4 of 53 red
  • At 7b0f2f8c7; rebuilt spec exit 0; 49 passed. Then restored and rebuilt spec exit 0; git diff HEAD --stat (empty). The red pins are named in the table.
--- packages/spec/src/ui/old-shape-form-withdrawals.ts
@@ -24,7 +24,7 @@
-  for (const form of projectViewForms(body).forms) {
+  for (const form of projectViewForms(body).forms.filter(() => false)) {
T8: 7 of 53 red
  • At 7b0f2f8c7; rebuilt spec exit 0; 46 passed. Then restored and rebuilt spec exit 0; git diff HEAD --stat names only packages/lint/src/i18n-walk.ts, this round's S11 edit then in progress (committed in 8ccb511), not an ablated file. The red pins are named in the table.
  • The diff: T7's hunk plus R1's hunk, both shown above.
T9: 10 of 53 red
  • At 8ccb511ce; rebuilt spec exit 0, mp exit 0; 43 passed. Then restored and rebuilt spec exit 0, mp exit 0; git diff HEAD --stat (empty). The red pins are named in the table.
  • The diff: T8's two hunks plus this one.
--- packages/metadata-protocol/src/protocol-form-reads.ts
@@ -319,7 +319,7 @@
-        if (served.holding.kind === 'form') put(key, projectedServed(served.holding.item, pkg));
+        if (served.holding.kind === 'form') put(key, item);
T10: 1 of 270 red
  • At 95cb02acf; no rebuild (the tests import the source); 269 passed. Then restored; git diff HEAD --stat (empty). The red pins are named in the table.
--- packages/lint/src/validate-translation-references.ts
@@ -2385,7 +2385,7 @@
-      for (const [formName, rawForm] of Object.entries(asRecord(rawData.forms))) {
+      for (const [formName, rawForm] of Object.entries(asRecord(undefined))) {
T11: 3 of 7 red
  • At 95cb02acf; rebuilt lint exit 0; 4 passed. Then restored and rebuilt lint exit 0; git diff HEAD --stat (empty). The red pins are named in the table.
--- packages/lint/src/i18n-walk.ts
@@ -2271,7 +2271,7 @@
-    for (const raw of Array.isArray(form.sections) ? form.sections : []) {
+    for (const raw of [] as unknown[]) {
T12: 1 of 7 red
  • At 95cb02acf; no rebuild (the tests import the source); 6 passed. Then restored; git diff HEAD --stat (empty). The red pins are named in the table.
--- packages/cli/src/utils/i18n-coverage.ts
@@ -782,7 +782,6 @@
-        ?? (key.fallbackPath !== undefined ? lookupKey(data, key.fallbackPath) : undefined)
T13: 1 of 7 red
  • At 95cb02acf; no rebuild (the tests import the source); 6 passed. Then restored; git diff HEAD --stat (empty). The red pins are named in the table.
--- packages/cli/src/utils/i18n-bundle-extract.ts
@@ -223,7 +223,7 @@
-          if (fallbackValue !== undefined && fallbackValue !== '') continue;
+          void fallbackValue;

Rework 4: after a refused publish the doors answer only committed state

The rule (6bea26c97): after a refused or undone publish, the doors and the meta reads answer only committed state, on an engine that can roll back as on one that cannot. It is held at every transaction this package opens, through one helper, retireOverlayCacheOnRollback (packages/metadata-protocol/src/meta-overlay-cache.ts):

Site Covers
protocol-history-and-publish.ts (inTxn) the package publish batch (Phase 1 and its commit record)
protocol-history-and-publish.ts (promoteFormAware) a form promotion with its old-shape row removal, single publish and batch member
protocol-save.ts (putFormAware) a form save with its old-shape row removal
protocol-diff-delete-load.ts (deleteFormAware) a form delete or reset with its old-shape row removal
sys-metadata-repository.ts (withTxn) every repository write unit (put, delete, and through them promoteDraft, restoreVersion, the rollback, revert and reset doors)
protocol-batch-data.ts the atomic data batch

A transaction that commits, or that writes no sys_metadata row, costs nothing. protocol.ts is untouched (11705 of 11705).

Pins. The harness's last describe, on SqlDriver (can roll back), at the shipped defaults:

  • a batch whose first form opens a new public link: two form drafts in the pair on one new link; success: false, failed is [[NAME, BATCH_ABORTED], [SECOND, FORM_ADDRESS_TAKEN]]; both doors 404 FORM_NOT_FOUND on that link with no record written; the store rows and GET /api/v1/meta/view/NAME and /meta/form/NAME equal to their reading before the publish.
  • a batch whose first form opens the address the pair's switched-off row holds: the first draft on that address, two more on a new link; refused at the third (FORM_ADDRESS_TAKEN, the other two BATCH_ABORTED); the same assertions at that address.
  • Two CONTROLs: the first draft published alone opens its address on both doors.
  • At protocol level, meta-overlay-cache.test.ts §11 ("after a transaction that does not commit, the reads answer only committed rows"), with two CONTROLs.
U1: 2 of 4 door pins and 1 of 3 protocol pins red
  • At c75ea6281; the mutation in packages/metadata-protocol/src/meta-overlay-cache.ts (the rule's helper); rebuilt metadata-protocol exit 0, the mutated line present in dist/index.js and dist/index.cjs (1 each).
  • Door pins (-t 'leaves nothing of the batch served'): 2 failed, 2 passed (the CONTROLs), 53 skipped. Red: both refused-batch pins.
  • Protocol pins (§11, source): 1 failed, 2 passed (the CONTROLs). Red: the rolled-back pin.
  • Restored with git restore --source=HEAD --staged --worktree; git diff HEAD --stat (empty); rebuilt exit 0, the mutation absent from dist; the four door pins 4 of 4.

Rework 5: one naming of a stored row's forms, and the cost of a revert that stops

The rule: a form write removes only the old-shape row that carries that same form. The write side now asks the form read's own naming: storedViewRowHoldings (packages/metadata-protocol/src/protocol-form-reads.ts) answers which forms one stored view row carries and under which names, for the form read (storedFormPlaces) and for oldShapeFormRowRemovals (protocol-form-writes.ts) alike. A stored container's members carry the names the view list and the doors serve them under: OBJECT.CONTAINER.KEY for a named container on another package's object, OBJECT.KEY on its own package's object. A form item is named OBJECT.KEY, so on another package's object no form write names a member of such a container.

Measured on the fixed tree, with a pair's stored container whose member is served under the base's form name: form writes of every other name tried (a name the member's key spells under the object alone, the container's own name, open elsewhere or switched off), the reset of each, a package publish and its revert. In every one the container row stayed byte-equal and the address stayed closed.

The cost of a revert that stops, as a rule (S12, dee2c2106): when one view row a commit edited cannot be put back, every form item of that commit is kept as published, and each is listed in the revert's failed[] with nothing written for it. The scope is the commit, not the form: the plan does not record which form a row carried.

Pins (packages/rest/src/public-form-two-type-withdrawal.test.ts):

  • "a form write removes only the old-shape row that carries that form: a stored container whose member is served under another name stays as it was across the save, the publish and the reset, and the address stays closed", on a pre-gate stored container row.
  • "CONTROL: the form write of the name a stored container's member is served under re-saves the container without it, and the form is served as written".
  • "a stored container is re-saved without the member the form write names, its lists byte-equal": the existing pin, now on a container of the pair's own object, where the member is served as OBJECT.KEY.
  • S12: "a commit revert that cannot put back … keeps the form as published and lists it in failed[]", for both kinds of row: an item-shaped row, and a re-saved container (on the pair's own object). Each has its CONTROL ("the same revert with the store restoring puts back … and removes the form").

T6 (rework 3) was read before the container re-save pin moved onto the pair's own object.

Run Rule ablated Red
W1 a form write removes only the old-shape row that carries that form (the write side's naming) 1 of 3: the "removes only" pin; its CONTROL and the re-save pin stay green
W2 when one edited view row cannot be put back, the commit's form items are kept (the commit-wide scope) 2 of 4: both S12 pins, the item-shaped row and the re-saved container
W1 and W2: the proofs
  • W1, at 76ec9b3e4: the mutation in packages/metadata-protocol/src/protocol-form-writes.ts through scripts/ablation-replace.mjs (anchor 1 to 0, blob efa21564701c to edb06759f765); rebuilt metadata-protocol exit 0; ablation-dist-preflight found the marker in dist/index.js and dist/index.cjs. Harness (-t on the three pins): 1 failed, 2 passed. Restored: blob equal to HEAD, git diff HEAD empty; rebuilt exit 0; the marker absent from all 24 built files; tree clean.
  • W2, at 76ec9b3e4: the mutation in packages/metadata-protocol/src/protocol-package-commits.ts, same tool (blob 01bffacef065 to 03946034e8d5); rebuilt exit 0; marker in both dist files. Harness (-t 'commit revert'): 2 failed, 2 passed. Restored: blob equal to HEAD, git diff HEAD empty; rebuilt exit 0; marker absent; tree clean.

The fixtures taken before the type

packages/rest/src/form-old-shape-before.json was captured on PR A's head, cb854ea4d: the rename-only tree, which has no form type. A throwaway test booted the same stacks these pins boot, and it was never committed (git status on PR A is clean). The fixture holds three answers:

  • GET /api/v1/meta/view over a container's default form, a formViews entry and a stored viewKind: 'form' item;
  • a formViews entry whose data.object names another object, on both doors;
  • the CRM's GET /forms/contact-us.

Each answer is compared as the wire serializes it, byte for byte. The save clock is written as TIME, because it is the one value two runs cannot share. The CRM pin (public-form-app-crm-byte-equal.test.ts, repo project) reads two examples/app-crm files. They are declared as rest test:repo inputs in scripts/cross-package-test-inputs.mjs and in turbo.json.

The capture source (S10). The throwaway test was packages/rest/src/__capture37086.test.ts in PR A's worktree. It sat there only for the run and was removed after it. Its sha256 is c320d476deac60cd1b4341ac613b77a08af9267cc7abd80f9c147aa1fc0a6577, and its source is below. The command, from packages/rest on PR A: CAPTURE_OUT=FILE pnpm exec vitest run --project local --maxWorkers=2 src/__capture37086.test.ts. This round ran it again on cb854ea4d: 1 passed. The JSON it wrote equals the committed fixture byte for byte except one value, changedAt of ftt_inquiry.standalone (line 104), the save clock the pins write as TIME. git status on PR A after the run: clean.

The capture test, as run
// TEMPORARY capture, run once on the rename-only head; never committed.
import { it } from 'vitest';
import { writeFileSync } from 'node:fs';
import { ObjectQL } from '@objectstack/objectql';
import { SqlDriver } from '@objectstack/driver-sql';
import { ObjectStackProtocolImplementation, resetEnvWritableMetadataTypes } from '@objectstack/metadata-protocol';
import { SysMetadataAuditObject, SysMetadataCommitObject, SysMetadataHistoryObject, SysMetadataObject } from '@objectstack/metadata-core';
import { RestServer } from './rest-server';
import * as CRM_OBJECTS from '../../../examples/app-crm/src/objects/index';
import { LeadViews } from '../../../examples/app-crm/src/views/lead.view';

const BASE = 'com.example.forms37086';
const OBJECT = 'ftt_inquiry';
const NAME = `${OBJECT}.contact`;
const SLUG = 'contact-37086';
const sharing = (open: boolean, slug = SLUG) => ({ enabled: true, allowAnonymous: open, publicLink: `/forms/${slug}` });
const body = (open: boolean | null, slug = SLUG) => ({ type: 'simple', sections: [{ fields: ['name', 'email'] }], ...(open === null ? {} : { sharing: sharing(open, slug) }) });
const viewItem = (open: boolean | null, extra: Record‹string, unknown› = {}, slug = SLUG) => ({
  name: NAME, object: OBJECT, viewKind: 'form', label: 'Contact us',
  config: { ...body(open, slug), data: { provider: 'object', object: OBJECT } }, ...extra,
});
const INQUIRY = { name: OBJECT, label: 'Inquiry', fields: { name: { name: 'name', type: 'text', label: 'Name' }, email: { name: 'email', type: 'text', label: 'Email' } } };
const LEAD = { name: 'ftt_lead', label: 'Lead', fields: { name: { name: 'name', type: 'text', label: 'Name' }, email: { name: 'email', type: 'text', label: 'Email' } } };
const threeShapes = () => ({
  views: [{
    object: OBJECT,
    form: { type: 'simple', sections: [{ fields: ['name'] }], sharing: sharing(true, 'whole-37086'), data: { provider: 'object', object: OBJECT } },
    formViews: { contact: { ...body(true), data: { provider: 'object', object: OBJECT } } },
  }],
});
const STANDALONE = `${OBJECT}.standalone`;
const otherObjectForm = () => ({
  objects: [LEAD],
  views: [{ object: OBJECT, formViews: { contact: { ...body(true), data: { provider: 'object', object: 'ftt_lead' } } } }],
});

function mockServer() { const noop = () => {}; return { get: noop, post: noop, put: noop, delete: noop, patch: noop, use: noop, listen: async () => {}, close: async () => {} }; }
function makeRes() {
  const res: any = { header: () => res, setHeader: () => res, send: (b: unknown) => { res._json = b; return res; }, write: () => true, end: () => res,
    status: (code: number) => { res._status = code; return res; }, json: (b: unknown) => { res._json = b; return res; } };
  return res;
}
async function boot(app: { id: string; namespace: string; objects: unknown[]; views: unknown[] }) {
  const driver = new SqlDriver({ client: 'better-sqlite3', connection: { filename: ':memory:' }, useNullAsDefault: true } as any);
  const engine = new ObjectQL();
  engine.registerDriver(driver, true);
  await engine.init();
  for (const o of [SysMetadataObject, SysMetadataHistoryObject, SysMetadataAuditObject, SysMetadataCommitObject]) engine.registry.registerObject(o as any, 'test-package');
  engine.registerApp({ id: app.id, name: app.id.split('.').pop(), version: '1.0.0', namespace: app.namespace, objects: app.objects, views: app.views } as any);
  await engine.syncSchemas();
  const protocol: any = new ObjectStackProtocolImplementation(engine as any, () => new Map());
  const rest = new RestServer(mockServer() as any, protocol, { api: { requireAuth: false } } as any);
  rest.registerRoutes();
  const route = (method: string, path: string) => rest.getRoutes().find((r: any) => r.method === method && r.path === path)!;
  const get = async (slug: string) => { const res = makeRes(); await route('GET', '/api/v1/forms/:slug').handler({ params: { slug }, query: {}, headers: {} } as any, res); return { status: res._status ?? 200, body: res._json }; };
  const post = async (slug: string, b: Record‹string, unknown›) => { const res = makeRes(); await route('POST', '/api/v1/forms/:slug/submit').handler({ params: { slug }, body: b, headers: {} } as any, res); return { status: res._status ?? 200, body: res._json }; };
  const metaList = async (type: string) => {
    (rest as any).resolveExecCtx = async () => ({ userId: 'u_reader', systemPermissions: [] });
    const res = makeRes();
    await route('GET', '/api/v1/meta/:type').handler({ method: 'GET', path: `/api/v1/meta/${type}`, params: { type }, query: {}, body: {}, headers: {} } as any, res);
    return { status: res._status ?? 200, body: res._json };
  };
  return { engine, protocol, get, post, metaList };
}

it('captures the before answers', async () => {
  delete process.env.OS_METADATA_WRITABLE;
  ObjectStackProtocolImplementation.resetEnvWritableCache();
  resetEnvWritableMetadataTypes();
  const out: Record‹string, unknown› = {};
  const a = await boot({ id: BASE, namespace: 'ftt', objects: [INQUIRY], views: threeShapes().views });
  await a.protocol.saveMetaItem({ type: 'view', name: STANDALONE, item: { ...viewItem(true, {}, 'standalone-37086'), name: STANDALONE }, mode: 'draft' });
  await a.protocol.publishMetaItem({ type: 'view', name: STANDALONE });
  out['meta-view-list'] = await a.metaList('view');
  const b = await boot({ id: BASE, namespace: 'ftt', objects: [INQUIRY, ...otherObjectForm().objects], views: otherObjectForm().views });
  out['data-object-resolve'] = await b.get(SLUG);
  out['data-object-submit'] = await b.post(SLUG, { name: 'Ada', email: 'ada@example.test' });
  const c = await boot({ id: 'com.example.crm', namespace: 'crm', objects: Object.values(CRM_OBJECTS), views: [LeadViews] });
  out['crm-resolve'] = await c.get('contact-us');
  writeFileSync(process.env.CAPTURE_OUT!, JSON.stringify(out, null, 2) + '\n');
});

Per-type arm inventory (card item 2)

Command: git grep -nE "=== 'view'|'view'," -- packages/rest/src packages/metadata-protocol/src packages/spec/src/kernel. It finds 64 hits in source files. The test files are left out: they hold fixture rows, not arms. Each hit is listed with whether form takes the arm.

64 source hits, by file

rest

  • form-routes.ts:245, 300, 511-514: the doors' own reads of the view carrier of a projected form. These are by design; form is the other half of the same reads.
  • meta-item-read-gate.ts:1796 (item audience) and :1998 (list audience): taken. The form arms sit at :1818 and :2015.
  • meta-item-read-gate.ts:2850 and :4780-4782 (the object list filter): not taken. The filter is the view list's. The form list declares no filter, and a form's object is its name's prefix.
  • meta-item-read-gate.ts:3438 (PACKAGED_BASE_ACCESSORS): taken, as ['form', 'getPackagedFormBase'] (S4).
  • meta-item-read-gate.ts:3791 and :3867 (withoutInventedViewLabel): not taken. translateForm translates only a label that the form authors, so it invents none.
  • meta-item-read-gate.ts:3843 and :3932 (container translation): not taken. A form item is never a container.
  • meta-item-read-gate.ts:4492 and :4526 (lists: 'app' | 'view'): not taken. These name the two list shapes that a navigation member reads.
  • meta-app-bundle-routes.ts:311 (an app bundle's view members): not taken. No app navigates to a form item until card ③.
  • meta-item-read-routes.ts:778 (the cached plain read's audience fold): taken (this rework), so the cached arm applies the same audience gate as the uncached one. See R14.
  • meta-item-read-routes.ts:766 and rest-server.ts:4445 (the public-form intake warning stamped on a served view): not taken. The warning's reader is the console's form designer, which is card ③. A form write is warned at the save door (runtime-authoring-gate.ts:437).
  • rest-server.ts:4096 (gatesOnItsOwnKey, the history, diff, audit and published doors): not taken. Those doors serve stored form rows only. An authored form item declares no requiredPermissions, so its gate always passes. A projected form, the only form that carries a gate, has no form rows, so those doors expose nothing of it.

metadata-protocol

  • build-probes.ts:653-674 (the renderer probe over published views): not taken. The probe reads the view renderer's path, and the public form renderer reads a form item through the doors pinned above.
  • destructive-still-shown-by.ts:343 (views that still show a field a destructive change removes): not taken in card ②. A form item's sections name fields too. Measuring that it should be shown is listed under "Named for the seat".
  • meta-compile-cache.ts:159: not taken, by design. The form read is never cached, because its answer moves with the stored view rows (protocol-meta-item-reads.ts, the by-name read's header).
  • metadata-diagnostics.ts:645 and :736 (form-layout diagnostics on a served form view): not taken. The consumer is Studio's form designer, card ③. The save and publish gate runs the form rules registered for the type.
  • package-namespace-rename.ts:133 and package-unmanaged-install.ts:634-642 and :1015-1017 (the copy names of a view and of a container's expansions): not measured for form. A form item named OBJECT.KEY follows the generic renameName, not the qualified-view rename. Whether an unmanaged copy of a package that authors forms: keeps the name's prefix equal to its renamed object is listed under "Named for the seat".
  • protocol-authoring-gate.ts:663 (the storage fold of a disabled extension's fields): not taken. No rule that a form write runs reads its object's fields. The form rules judge the object binding only.
  • protocol-discovery-and-bases.ts:879 and :947: the view half of getPackagedViewBase, and the old-shape fallback of the new getPackagedFormBase.
  • protocol-form-reads.ts and protocol-form-writes.ts (all hits): the cross-type reads and writes themselves.
  • protocol-meta-item-reads.ts:704: the projected-item mark. :1592 (ADR-0047 list-view reference diagnostics) is not taken: those rules read list-only keys.
  • protocol-meta-list-reads.ts:320 (the view merge's container handling) and :1027 (containers left out of the view list): not taken. A form row is never a container.
  • protocol-packaged-base-refusal.ts:1349 (a container's expansion in the override gate): not taken, for the same reason. :1441 is the form gate's projection half (R8).
  • protocol-registry-hydration.ts:872 and :2024 (finding(metadata-protocol): on an unscoped kernel, a package-bound stored row of a view name two packages ship is hydrated into the registry's bare slot, so a by-name read naming the other package serves that row's body under its own _packageId #22057, a view row bound to one package is not registered under a name another package ships): not taken in card ②. The header marks the case "View only". The form read resolves the address itself and does not read the registry for a stored row.
  • protocol-save.ts:1511: the package-less list refusal. :1706 (projectStorableViewBody) is not taken: a form body is stored through the generic path, and FormSchema is strict, so no undeclared key survives the parse.
  • protocol-unmanaged-import.ts:60: a container's expansions. Not taken.
  • runtime-authoring-gate.ts:1670: taken. PUBLIC_FORM_INTAKE_UNAVAILABLE runs for form.
  • protocol-diff-delete-load.ts:841, protocol-registry-hydration.ts:1694 and sys-metadata-repository.ts:2433: comments.

spec/kernel

  • metadata-plugin.zod.ts:98 and :967: form has its own enum member and its own registry row.

Notes for the review items

  • M3 (an undo puts back the rows the publish moved). The rule holds for the undo of a package publish refused part-way on an engine that cannot roll back, and for a commit revert on every engine. The writer is in the stored-row write census (protocol.view-expansion-reconcile-call-sites.test.ts), with its heal route named. Pins: the undo describe of the harness, with two CONTROLs. Ablations: T1 and T2.

  • S12 and N9. See "Rework 5": the commit-wide scope as a rule, and the re-saved container kind among the revert pins.

  • Rework 4. See its section: the rule, the six sites, the pins with their CONTROLs, and U1.

  • S10. The records asked for are T3 to T9 above, and the capture source is in "The fixtures taken before the type".

  • S11. packages/lint/src/i18n-walk.ts and validate-translation-references.ts follow forms.NAME.sections. The object-level _sections emission for a form item is gone from the walker: the form's own node carries the entry, with _sections as its fallback address. Pins: packages/cli/test/i18n-form-section-entry-coverage.test.ts (3, against the built lint) and validate-translation-references.test.ts (1, with a CONTROL). Ablations: T10 to T13.

  • S5 (one candidate read; predicates pushed down).

    • names is pushed into both generic reads.
    • packageId is not pushed, for two reasons, both written in readEffectiveFormList's docblock. A declared form override is re-keyed onto its base's address from the base's projected view item, and a list scoped to the pair never holds that item. A view list scoped to a package seats the package-less rows in that package's slots ([finding] getMetaItems scoped to a package reads only that package's rows, so it never falls back to the package-less row that getMetaItem naming the package serves #21817), and they would be projected as the package's own forms ahead of the served-row order.
    • The by-name read makes one unscoped read and filters it.
    • The door asks one form read. The view list and the stored rows it also needs are not shared through a new protocol extension: protocol.ts sits at its facade ceiling, 11705 of 11705 lines. The row sets come from the overlay row cache. That is the residual.
  • S8 (the @object-ui changeset stays patch). The diff adds and narrows nothing published:

    • a form row in TYPE_COUNT;
    • a Forms category in the translation preview;
    • the preview.changes.typeCount.form key in each bundled locale;
    • forms in the language loader's recognised groups;
    • form in HIDDEN_DIRECTORY_TYPES, a read-only set of strings whose type is unchanged. It hides a type that did not exist before this change.

    No export is removed or retyped, and no accepted input is refused.
    @object-ui/types has no changeset entry: its two touched files (src/__tests__/zod-mirror-parity.test.ts, src/__tests__/spec-object-refinements-7715.test.ts) are tests, and the package's files ships only dist, README.md, CHANGELOG.md and LICENSE.

  • S9. The forms row in skills/objectstack-platform/SKILL.md is done in this PR, in commit 6103f74: one line, with no teaching text, example or eval. The skills token ceiling rises from 6151 to 6153, the row's measured delta (+2), on a base where main's knowledge capability row had already moved it from 6149 to 6151. That rise rests on ruling A on Adding a top-level key or a bound enum member reds two-way skill gates in both card orders under the skills split #32584 (record 6819475461), made standing by [Decision] Under ruling A (#32584), may the PR that adds a key raise the token ceiling of the published skill file its enumeration row lands in? #32673 letter A (record 6840575378, 「32843 32673 同意」).

Accepted deviations (review nits)

  • N1 (form-consumer-less is silent for every overrides item). Kept. Lint judges the authoring stack, and the base form's consumers live in the installed base, which is not in that stack. The rule cannot tell an override that keeps a consumed address closed from one that steers nothing. A warning there would invite the removal of the override that keeps the address closed (validate-form-items.ts header).
  • N2 (readEffectiveFormItem scoped to a package where the name is listed only at another). Kept. That branch is the pair's address answered by its base, the same layered by-name answer every type gives. The address is closed on both doors, so nothing is exposed.

The other three nits are done:

  • N3: form.json sharing cites findPublicForm, openFormAt and the slug rule.
  • N4: the registry-row comment says what overlays a form.
  • N5: scripts/adr-anchors/packages__metadata-protocol__src__protocol-form-reads.ts.json anchors the cross-type resolution.

Verification

The head is 20a80b19d. This round brings current main (c2bfa3ef7) in once more, through PR A: main is merged into PR A's branch (f4ce75659, no conflict, nothing left to regenerate there), and that branch into this one (2321811241, no conflict), then the regeneration 20a80b19d (content/docs/references/api/protocol.mdx and content/docs/references/system/translation.mdx). On PR A, main changed agent.form.ts, which PR A renames: the change landed in agent.metadata-form.ts, which still calls defineMetadataForm, and main adds no *.form.ts module and no defineForm call. The merge changed files this PR also changes (lint's i18n-walk.ts, index.ts and rule-explanations.ts; spec's translation.zod.ts and i18n-resolver.ts; the eleven *.metadata-forms.generated.ts bundles), so the battery ran again on this head.

  • Local, this round, on 20a80b19d: check:generated (14 of 14 current after the regeneration), check:facade-delegation-only (protocol.ts within its ceiling), check:test-source-alias, check:adr-symbol-anchors, check:nul-bytes: exit 0 each. On PR A f4ce75659: check:generated 14 of 14 current.
  • Dogfood battery at 20a80b19d (pnpm --filter '@objectstack/dogfood^...' build && pnpm --filter @objectstack/dogfood test, under the verify lock): VERDICT command-exit 0; 489 files passed, 3 skipped (492); 4140 tests passed, 68 skipped (4208); no failure.
  • The previous round (921f5d060, after merging main 9a65a48f8): conflicts reconciled by summing both sides' deltas (the translated-leaf census 841; dropped-refinements.baseline.json 279 / 1223; the protocol-diff-delete-load.ts imports), protocol.ts brought back to its ceiling with no behaviour change (921f5d060), the failed[] wording of a held-back form item (d5c5b92d5); metadata-protocol full (371 files, 23472 tests), rest local (431 files, 8931 tests), lint full (240 files, 9739 tests), platform-objects full (129 files, 2202 tests), their typecheck and the gates listed then, all green; battery 489 files, 4138 tests.
  • Earlier rounds (their trees; this round changes none of their code but the two commits above): the previous round ran the spec test files that name metadata forms (95 files, 6006 tests) and the gates listed then; rework 5 ran the rest door harness (63 of 63) and the rest and metadata-protocol typecheck; rework 4 ran objectql environment-overlay-five-types.test.ts (36 of 36); @objectstack/cli unit ran 445 files, 6361 tests. Their gate lists stand as reported then.
  • Declared narrowing: this round ran the families that read the files the merge changed or reconciled, listed above. The derivation covers the whole stacked diff against main.

Edits needed outside this PR's surface (named, not made):

  • .claude/skills/spec-property-retirement: the lines that name defineForm as the Studio helper.
  • ui/docs/adr/0056: the same naming.
  • ADR-0159:109: the anchor resolves again with this PR, onto a symbol whose meaning is the opposite of the sentence. The ADR's text is the seat's to order.

Named for the seat (from the arm inventory; measured nowhere yet, so no card is asked):

  • Does the destructive-change "still shown by" read need form items, whose sections name fields?
  • Does an unmanaged copy of a package that authors forms: keep each form name's prefix equal to its renamed object?

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint is CI's.
  • 4. One issue, one branch, one pull request (the card's cut: PR A refactor(spec)!: rename the Studio helper defineForm to defineMetadataForm and its modules to *.metadata-form.ts #37366 + this PR B, stacked).
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_011y7As9cjn4Y9vAUQbVH4fq

…ead a form over both types

ADR-0159 card ②, everything past the rename (PR B of the card's cut):
FormSchema derived from FormViewSchema by reference with defineForm and
*.form.ts; the registry row, the stack's forms collection and the forms
translation family; one projection of the three old view shapes; the
effective form read resolved over both types; the form write's removal of
the old-shape row; the address clash refusal (FORM_ADDRESS_TAKEN); the
package-less list-at-a-form's-name refusal on save, publish and restore;
the anonymous doors' two-type withdrawal layer with rule 7's closed links;
the lint rules, the liveness ledger and the showcase form.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As9cjn4Y9vAUQbVH4fq
…gation, cli i18n bucket, provenance row, checklist waiver, transcript counts

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As9cjn4Y9vAUQbVH4fq
…les, showcase feedback form zh-CN, walk-parity fixture member; typed form-body refinement params

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As9cjn4Y9vAUQbVH4fq
…ocol serving no form item, one registry heal for old-shape removals, the by-name form read keeps the generic answer unless resolved across types, census and enumeration pins

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As9cjn4Y9vAUQbVH4fq
The owner-stamp fixture tables, the meta list/item census, the CLI
schema-gate classification and the metadata-form catalog ratchets each
gain the form type (ADR-0159 card ②, #37086).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As9cjn4Y9vAUQbVH4fq
@github-actions github-actions Bot added documentation Improvements or additions to documentation 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 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 10 package(s): @objectstack/cli, @objectstack/lint, @objectstack/metadata-core, @objectstack/metadata-protocol, @objectstack/metadata, @objectstack/objectql, @objectstack/platform-objects, @objectstack/rest, @objectstack/runtime, @objectstack/spec, touching 309 documentable anchor(s). ⚠️ 24 changed file(s) yielded no anchor (packages/lint/src/index.ts, packages/rest/src/form-old-shape-before.json, packages/rest/vitest.repo-tests.json, …), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

82 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 f4ce756599358ed4ab3bd9944a9425ad3e3fd445.

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

What this run could not see
  • 24 changed file(s) yielded no anchor (packages/lint/src/index.ts, packages/rest/src/form-old-shape-before.json, packages/rest/vitest.repo-tests.json, …) — pages documenting those are invisible to this run
  • 2 anchor(s) matched too much of the corpus to be a work list: VALIDATION_ERROR (literal, 39 pages), objectName (literal, 60 pages)
  • 30 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 — 192 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 f4ce756599358ed4ab3bd9944a9425ad3e3fd445 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 580a72070c44ad1c5c5cd6171f1cab72442aeaee — the merge of head 20a80b19d16058700b6a44ea91b38be9da771e45 into base f4ce756599358ed4ab3bd9944a9425ad3e3fd445, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older claude/project-thread-pu5dnt 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 580a72070c44ad1c5c5cd6171f1cab72442aeaee && git checkout 580a72070c44ad1c5c5cd6171f1cab72442aeaee
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin f4ce756599358ed4ab3bd9944a9425ad3e3fd445 20a80b19d16058700b6a44ea91b38be9da771e45 && git checkout -B drift-repro f4ce756599358ed4ab3bd9944a9425ad3e3fd445 && git merge --no-ff 20a80b19d16058700b6a44ea91b38be9da771e45

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

⚠️ 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 f4ce756599358ed4ab3bd9944a9425ad3e3fd445 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…object

translateForm reads a form item's section headings at
objects.<object>._sections.<name>, so translation-target-unknown must
accept those keys. The showcase feedback form's zh-CN section heading
tripped it in the dogfood build.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As9cjn4Y9vAUQbVH4fq
…ectstack-ai/objectstack into claude/project-thread-pu5dnt-b

# Conflicts:
#	packages/spec/dropped-refinements.baseline.json
- TranslationPreview draws the forms group, with its strings and fixtures.
- Pending changes count a drafted form in every pack.
- The console loader namespaces a served forms group.
- Studio's directory and menu leave form out until card ③ brings its
  designer, placement and ADR-0084 row.
- The types censuses: spec FormSchema is a name collision with the
  form node, and checkFormItemNamePrefix judges a schema objectui does
  not mirror.
- rest: the unused withdrawal import goes, and the intake test pays the
  objectql load at collection.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As9cjn4Y9vAUQbVH4fq
…ectstack-ai/objectstack into claude/project-thread-pu5dnt-b

# Conflicts:
#	content/docs/deployment/cli.mdx
#	content/docs/deployment/validating-metadata.mdx
#	content/docs/getting-started/build-with-claude-code.mdx
#	content/docs/ui/react-pages.mdx
…vel keys

The enumeration row only (check:skill-top-level-keys); the prose,
examples and evals are #37105's. The token ceiling moves by the row's
measured +2 (6149 -> 6151), the standing enumeration-row case: ruling A
on #32584 (record 6819475461), made standing by #32673 letter A
(record 6840575378).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As9cjn4Y9vAUQbVH4fq
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As8wf3DSPRevwNnYLcM

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 97341d57da84d7143c7990ef72a82fff0e8b77ef
Local-runs: none
Scope: packages/spec/src/api/error-code-ledger.zod.ts, packages/spec/src/index.ts, packages/spec/src/kernel/collection-item-owner-stamp.ts, packages/spec/src/kernel/customization-package.ts, packages/spec/src/kernel/metadata-plugin.zod.ts, packages/spec/src/kernel/metadata-type-schemas.ts, packages/spec/src/meta-spelling/manifest-collection-spelling.ts, packages/spec/src/meta-spelling/meta-url-data.generated.ts, packages/spec/src/migrations/entries/semantic/18.form-type-define-form-and-packageless-list-at-form-name.ts, packages/spec/src/stack.zod.ts, packages/spec/src/system/i18n-resolver.ts, packages/spec/src/system/translation.zod.ts, packages/spec/src/ui/anonymous-form-intake.ts, packages/spec/src/ui/form-intake-layer.ts, packages/spec/src/ui/index.ts, packages/spec/src/ui/old-shape-form-withdrawals.ts, packages/spec/src/ui/view.zod.ts, skills/objectstack-platform/SKILL.md + packages/rest/src/form-routes.ts, packages/rest/src/meta-item-read-gate.ts, packages/rest/src/public-form-two-type-withdrawal.test.ts, packages/metadata-protocol/src/protocol-form-reads.ts, packages/metadata-protocol/src/protocol-form-writes.ts, packages/metadata-protocol/src/protocol-save.ts, packages/metadata-protocol/src/protocol-history-and-publish.ts, packages/metadata-protocol/src/protocol-diff-delete-load.ts, packages/metadata-protocol/src/protocol-meta-item-reads.ts, packages/metadata-protocol/src/protocol-meta-list-reads.ts, packages/metadata-protocol/src/protocol-packaged-base-refusal.ts, packages/metadata-protocol/src/protocol-authoring-gate.ts, packages/metadata-protocol/src/runtime-authoring-gate.ts, packages/metadata-protocol/src/protocol.ts, packages/lint/src/validate-form-items.ts, packages/lint/src/authoring-rules.ts, packages/lint/src/i18n-walk.ts, packages/lint/src/validate-translation-references.ts, packages/spec/liveness/form.json, packages/spec/src/kernel/metadata-credential-fields.test.ts, scripts/adr-anchors/packages__rest__src__form-routes.ts.json, scripts/adr-anchors/packages__spec__src__ui__old-shape-form-withdrawals.ts.json, scripts/check-skills-token-ratchet.mjs, scripts/check-stack-collection-maps.mjs, ui/scripts/check-spec-symbol-derivation.mjs, docs/qa/platform-checklist/coverage.json, examples/app-showcase/src/ui/forms/feedback.form.ts, .changeset/37086-form-metadata-type.md, .changeset/37086-form-type-console-strings.md
Security-touching: yes
Rule-change-verified: none

PR #37422 (PR B of card #37086's fixed cut), base = PR A's branch claude/project-thread-pu5dnt, 153 files, +4117 / -306, 14 commits. Read: the card body and its six comments, the PR body, the file list, the net diff against PR A's head, the check-runs on this head, ADR-0159 on main, and the cited code at this head. Nothing was built, run or ablated. The narrowing face holds, so every path of the diff is in the floor; + names the files the published hunks make a claim about.

The security question of the brief, answered first. No path that re-opens a withdrawn public form was found by reading. Traced: a view override's withdrawal against an authored form; a form override against an old-shape base; a base-withdrawn form item under a package-less or override old-shape row; rule 11 for the pair row and the package-less row; served rows only; the package-less list refusal at save, publish and restore; the door's own fallback read (S1). What follows is that the design reads closed, and that the card's proof of it is not in the PR: see M2.

① Derived judgments

Each accept-set and public-surface change, named right or wrong.

  • FormSchema (packages/spec/src/ui/view.zod.ts): a strict object of name, object, label, the body keys of FormViewSchema taken by reference less data, the protection and override-declaration fields; data, viewKind, config, isDefault, order, scope refused with guidance; the form-body refinement shared with the view (checkFormViewBody), the name-prefix check, the groups-into-sections fold. Right (D2, D3, ruled question 2 = A).
  • defineForm declared again as the form type's factory. Right (ruled question 1 = A); it is absent on PR A's head and has one meaning here.
  • form as a metadata type: enum member, registry row with page's flags and **/*.form.ts|yml|json, type-to-schema map, forms stack collection, plural fold, owner stamp, form: listed in the customization package. Right (D1).
  • forms offers the array form only (waivers in scripts/check-stack-collection-maps.mjs). A dev-derived decision the card does not rule. Right: the name is OBJECT.KEY and is checked against object, so a map key would be a second spelling of the same identity.
  • projectViewForms / projectedFormsOf, the _formDefinedIn marker: one projection of the three old shapes; the marker is stripped before the anonymous door answers (formBodyOf). Right (D5).
  • formIntakeLayer / openFormAt: withdrawal by whole-item name over both types, closed links from unreadable bodies. Right (D6 rules 4 to 7).
  • oldShapeFormWithdrawals: the exempt reader, with the required words in its docblock and its own anchor file; not registered as an ADR-0087 conversion. Right (item 6).
  • FORM_ADDRESS_TAKEN in the error-code ledger. The code is right; the ledger comment that publishes where it is refused is wrong (M1).
  • The package-less list refusal, 400 VALIDATION_ERROR, at save, draft promotion and restore. Right (item 5), and it is the declared narrowing.
  • The override gate's "ships" read over both types (overrideWriteVerdict). Right (item 5).
  • /meta/form read gate arms (meta-item-read-gate.ts): requiredPermissions judged as for view. Right; the route pin the card asks for is missing (M2).
  • The forms translation family: label, description, title, submitBehavior in a strict object. Wrong against D8, which lists a sections branch as part of the family (S3).
  • The door's second candidate source (servedForms.length test in form-routes.ts). Wrong (S1).
  • form hidden from Studio's directory (HIDDEN_DIRECTORY_TYPES). Right: ruled A in 7183329743.

② Semver level

  • .changeset/37086-form-metadata-type.md: minor on spec, metadata-protocol, rest, lint, metadata, metadata-core, objectql, runtime, cli, platform-objects; Clause-②: yes (narrowing); Metadata-protocol: narrowed. Consistent with AGENTS.md (a protocol kind takes at least minor on a package the diff moves) and with the card's Done-when. The BREAKING banner names the export's new meaning and the refusal, the saves refused that are admitted today, and the one-line fix.
  • One ADR-0087 marker: registered form-type-define-form-and-packageless-list-at-form-name, with its entry in hits. It covers the export and the refusal together, as the card asks. PR A's changeset carries its own single marker for the rename; see that record.
  • .changeset/37086-form-type-console-strings.md: patch on @object-ui/app-shell and @object-ui/i18n, Clause-②: no, Metadata-protocol: none. Check Changeset accepts it. Against the card's "minor on every package the diff moves" it is a deviation the seat should rule: S8.
  • @object-ui/types: test files only, no changeset line. Right; the dev says so in the report.

③ Boundary flags

  • Open question 1 (who adds the forms row to skills/objectstack-platform/SKILL.md): answered A in 7183329743. Verified: the skill's hunk is one line, the top-level key enumeration gains `forms`, and nothing else; no teaching text, example or eval. scripts/check-skills-token-ratchet.mjs raises the ceiling 6149 to 6151 and the arithmetic holds (24594 to 24603 priced bytes, a quarter rounded up is 6151): exactly the row's measured delta. The two rulings are cited in the script comment only, not in the PR body as the amendment asks: S9. The two cited records were not opened; they are outside this review's inputs, and the seat checks the citation.
  • Open question 2 (keep form hidden in Studio until card ③): answered A. Verified in directoryScope.ts.
  • .claude/**: no path in the diff. Three gate-data edits are in it and are named for the seat, since each lets something through a check: the ratchet ceiling above; the forms waivers in scripts/check-stack-collection-maps.mjs; and an allow-list entry @object-ui/types:FormSchema in ui/scripts/check-spec-symbol-derivation.mjs for a name collision with the spec's new FormSchema. Each carries its reason, none changes what an agent may do without the maintainer, so the header reads none.
  • The dev's out-of-scope finding on sharing credential marking (class c): escalated by the seat. A security item is with the owner seat; no detail here.
  • The dev's security_findings: withheld: not answered on the card. The seat collects it through the private channel; this review did not see it and cannot say it is covered by the findings below.
  • Other dev decisions surfaced for the seat: KNOWN_UNSEEDED gains form in metadata-create-seeds.test.ts; docs/qa/platform-checklist/coverage.json waives form (S7); the liveness ledger form.json inherits view's verdicts (N3).
  • Named, not made: .claude/skills/spec-property-retirement and ui/docs/adr/0056 still name defineForm as the Studio helper; after this PR that is false twice over. ADR-0159:109 resolves again, onto a symbol with the opposite meaning of its sentence. All three are the seat's to order.
  • SQL push-down (Prime Directive 5): a finding. S5.
  • Check-runs on this head: 67 runs, 60 success, 7 skipped, none red, none running. Test Core was still running when the review began and finished green. Lint · docs & code guards is green here, which is what restores PR A's red lane.

④ Design judgment

Against ADR-0159 D1 to D8, the ruled questions, and the card's Done-when. The tree was read, not the PR body's account.

M1 (must-fix) — The address-clash refusal is judged at one door, and the published ledger says three. formAddressClashRefusal has one call site, the save door (protocol-save.ts). Draft promotion and the restore writer ask the package-less list refusal and do not ask this one, and the holder read is of published forms. So a draft is not judged against another draft, a draft saved before a holder took the address is not judged again at publish, and a restore is not judged at all: each leaves two open forms on one address, which is the arrangement ruled question 3 = A refuses. Card item 7 names publish ("The form write door, os validate and publish each refuse") and Done-when asks a pin for each of the three refusals; there is no publish pin. The second comment on FORM_ADDRESS_TAKEN in packages/spec/src/api/error-code-ledger.zod.ts says "the form save, draft promotion and restore doors refuse": declared, not enforced, in a hits file. Fix: ask the refusal in promoteDraftForPublish and the restore writer beside the list refusal, pin each, or correct the ledger and take the gap to the seat.

M2 (must-fix) — Done-when's pins are not all there, and two of the eight D6 pins do not hold the read they name. The card makes the pins the proof that no withdrawn form re-opens; a design that reads closed is not that proof.

  • By the PR's own table, ablation A2 (the form half of the layer) and A5f (the per-package form layer) turn nothing red, and pin 1 stays green under A1. The form half of the two-type layer is therefore unpinned: it can be deleted with the suite green. The card's fixture for pin 2 cannot show it, because the withdrawing override is itself the served candidate. A fixture that does: the base authors the form with its link kept and switched off, and an old-shape row of that name stands open on the same link; both doors must answer 404. If the dev finds no fixture where that half is the only thing keeping an address closed, that is a finding for the seat (the half is dead), not a reason to leave it unpinned.
  • Absent: the served-rows-only pin, both fixtures. The closed-reading pin (a seeded package-less list, and a stored package-less container, over an authored form). In the bound pin: "where the base's pair cannot be ensured", "into the pair as its own item", and "after all of them the doors serve the package's form". The rule 9 pin (and see S6). The declared_package_ships_no_such_item pin for a form override of a name shipped in neither type. The route pin that a caller refused /api/v1/meta/view/NAME is refused /api/v1/meta/form/NAME. The reset and delete pins; the container re-saved without the member; the failed write that leaves both rows. Byte-equality of the list row (the one test asserts viewKind, on save only). The data.object door pin. The GET /api/v1/meta/view fixture pin. The examples/app-crm byte-equal pin. The pin that an old-shape view write on a taken slug still saves. The publish clash pin (M1).
  • Not in the PR: the per-type arm inventory of item 2; the ablation records for the D5 pins; the rebuild, on-disk mutation and empty-git diff HEAD proof Done-when asks of each ablation run.

S1 (should-fix) — packages/rest/src/form-routes.ts: servedForms.length being zero switches the door to projectedFormsOf(views). That is a second candidate source inside the door, keyed on emptiness, where D6 rules 1 and 3 give the door one read, and it is a consumer-side fallback (Prime Directive 12). It was added for test doubles that answer an empty list. No divergence from the protocol's read was constructed, so it is not graded must-fix; key it on the protocol's capability or remove it and fix the doubles.

S2 (should-fix) — packages/metadata-protocol/src/protocol-form-reads.ts: the cross-type served-row resolution runs only at addresses where the package authors a form item. Over a base that ships the form as an old shape, a package-less stored form row of the same name (a write the doors admit) is listed beside the base's projected form: two definitions at one address, against D5's "one address holds one definition" and its one served-row order. The answer also changes when the base later moves to forms:. It fails closed, so it is not a re-opening; it is an upgrade-time surprise. Scenario detail is in the summary to the seat.

S3 (should-fix) — packages/spec/src/system/translation.zod.ts, system/i18n-resolver.ts: D8 lists forms.NAME.sections.SECTION.label, .description and .fields.FIELD.* as part of the family, with _sections as the default when the family has no key. The family schema is strict and refuses sections; translateForm reads section copy from _sections only. Add the branch, or have the seat name the card that owns it.

S4 (should-fix) — packages/rest/src/meta-item-read-gate.ts and the protocol: form is overridable, and translateForm promises the ADR-0029 D9.2a rule that an override's own changed text outranks the base's catalog. There is no packaged-base accessor for form (no row in PACKAGED_BASE_ACCESSORS), so the comparison has no base and an override's changed title is replaced by the base's translation, on /meta/form and on the public door.

S5 (should-fix, SQL first) — readEffectiveForms drops names and packageId from the request and filters in memory after full reads of both types and of every stored row of both. readEffectiveFormItem calls it up to three times for one by-name read, and each anonymous door request repeats the view-list and stored-row reads for the form read, the two per-package layers and the unreadable bodies. No reason is given in the code. Push the name and package predicates down, or state why the two-type resolution cannot.

S6 (should-fix) — Rule 9: Done-when asks a pin that an organization-scoped form save leaving a withdrawn form open is refused "as the same view save is today". On this tree no write-time withdrawal judgement exists in metadata-protocol (anonymousFormIntakeWithdrawnIn has no caller there; refuseOrganizationScopedWrite refuses every organization-scoped write first). The PR neither pins the form case nor reports that the item's premise is stale. Report it to the seat with the reading.

S7 (should-fix) — docs/qa/platform-checklist/coverage.json: the waiver says no app the checklist drives authors forms:, and this diff adds forms: [FeedbackForm] to the showcase. It also names card ③ as the mover of contact-us where the card says ④.

S8 (should-fix) — the second changeset declares Clause-②: no / Metadata-protocol: none at patch for two packages in a PR whose kind is narrowed. The gate is green; the card's sentence is not met to the letter. The seat rules whether the @object-ui train is exempt.

S9 (should-fix) — the PR body still lists the SKILL.md row under "named, not made" and does not cite the two rulings for the ceiling raise, which amendment 7183329743 asks for in the body. A body edit; it moves no head.

N1 (nit) — packages/lint/src/validate-form-items.ts: the consumer-less advisory is silent for every item that declares overrides, where D1 and item 9 ask it silent only when the base's form has a consumer.
N2 (nit) — protocol-meta-item-reads.ts: readEffectiveFormItem answers the generic item when the name is listed only at another package; closed at this address, so no exposure.
N3 (nit) — packages/spec/liveness/form.json (sharing): the evidence quotes lines findPublicForm no longer has and names the view path for a form item.
N4 (nit) — packages/spec/src/kernel/metadata-plugin.zod.ts: the registry-row comment says "overlayable per org" and names a scope set of global, org and user, while organization-scoped writes are refused on this tree (ADR-0131 D6); the comment describes a layer no door writes.
N5 (nit) — the cross-type resolution in protocol-form-reads.ts has no anchor file of its own; the doors' ADR-0159 anchor is an edit of the existing form-routes.ts file.

Files that hold. packages/spec/src/ui/view.zod.ts, ui/form-intake-layer.ts, ui/anonymous-form-intake.ts, ui/old-shape-form-withdrawals.ts, ui/index.ts, src/index.ts, stack.zod.ts, kernel/metadata-type-schemas.ts, kernel/customization-package.ts, kernel/collection-item-owner-stamp.ts, meta-spelling/manifest-collection-spelling.ts, meta-spelling/meta-url-data.generated.ts, the migration entry, skills/objectstack-platform/SKILL.md: each agrees with the decision it implements. protocol-form-writes.ts (the list refusal and the same-transaction row removal), protocol-packaged-base-refusal.ts, runtime-authoring-gate.ts, the two anchor files, feedback.form.ts: hold as read. Their findings are the ones graded above.

Two must-fix. The verdict is on M1 and M2; the nine should-fix items do not carry it.

Implemented-by: claude/project-thread-pu5dnt-b
Reviewed-by: l2-37086 subagent of session_011y7As8wf3DSPRevwNnYLcM

VERDICT: FAIL

…ectstack-ai/objectstack into claude/project-thread-pu5dnt-b

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As9cjn4Y9vAUQbVH4fq
…estore; one candidate read at the form doors

formTypeWriteRefusal asks the package-less list refusal and the public
address clash together, at draft promotion and in the restore writer,
so the three doors the ledger names all refuse FORM_ADDRESS_TAKEN.

The form doors read their candidates from the effective form read alone;
the test doubles serve that read as the protocol does for an old-shape
fixture, through projectedFormsOf.

The effective form read pushes names down, resolves a package-less stored
form row at an old-shape address in the served-row order (one definition
per address), and the by-name read resolves the name once.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As9cjn4Y9vAUQbVH4fq
…eading, the bound and the form write doors

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As9cjn4Y9vAUQbVH4fq
…ead, and a form override's own text over its base's catalog

The cached plain read of GET /meta/:type/:name judges a form through the
per-caller read gate, as it judges a view, so a caller refused a form's
document at /meta/view/NAME is refused it at /meta/form/NAME.

A form gets a packaged-base accessor (getPackagedFormBase: the base's
authored form, else the form its old shape carries through the
projection), so an override's changed text outranks the base's catalog
on /meta/form and on the public door (ADR-0029 D9.2a).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As9cjn4Y9vAUQbVH4fq
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…siness wording in ja-JP, es-ES and zh-CN (objectstack-ai#37464)

Fixes objectstack-ai#37384

Clause-②: no
Metadata-protocol: none

## 维护者速读

-
用日文、西班牙文(以及部分中文)搭报表的人,在报表设置面板里看到的"列分组、排序、分块、图表、日期范围、导出选项"六条说明和"联合分块""筛选与图表"两段分区说明,现在和英文说的是同一件事,不再是旧的"维度
/ 度量 / 数据集"开发者说法。
- 属于报表面板改用业务用语的收尾,接上一轮只修了六行和四个标签的那张卡,补齐其余译文。
- 出错只会是某条译文措辞不够好,不影响任何功能或数据,随时可以直接改回或再改。
- 无。

## What changes

Translation text only, in the three hand-written locale bundles of
`@objectstack/platform-objects` (`zh-CN`, `ja-JP`, `es-ES`
`*.metadata-forms.generated.ts`), `report` block. No key added or
dropped; `pnpm check:i18n` is in sync. Vocabulary follows PR objectstack-ai#37377:
データソース / 指標 / グループ化 · Fuente de datos / Métricas / Agrupar por · 数据来源 /
指标 / 分组. The enum tokens `matrix` / `joined` stay as tokens, as the
English and each bundle's own `type` hint keep them.

**Every leaf re-translated** (current English, then the new value per
locale):

| Leaf | English | ja-JP | es-ES | zh-CN |
|:---|:---|:---|:---|:---|
| `report.sections.joined_blocks.description` | Other blocks stacked
into the same report, each with its own data source (joined reports
only). | 同じレポートに積み重ねる他のブロック。それぞれ独自のデータソースを持ちます(joined レポートのみ)。 | Otros
bloques apilados en el mismo informe, cada uno con su propia fuente de
datos (solo informes joined). | 叠加进同一张报表的其他分块,各有自己的数据来源(仅 joined 报表) |
| `report.sections.filter_and_chart.description` | Filter conditions and
how the chart is shown. | フィルター条件と、チャートの表示方法。 | Las condiciones de
filtro y cómo se muestra el gráfico. | unchanged (条件与图表展示 already
follows) |
| `report.fields.columns.helpText` | Groups spread across the columns
(matrix reports only). | 列方向に展開するグループ(matrix レポートのみ)。 | Grupos
distribuidos en las columnas (solo informes matrix). | 横向展开的分组(仅 matrix
报表) |
| `report.fields.order.helpText` | What to sort by, most important first
(a grouping or a metric). Time groupings sort in date order by default.
| 並べ替えの基準。重要なものから順に指定します(グループまたは指標)。時間のグループは既定で日付順に並びます。 | Por qué
ordenar, lo más importante primero (una agrupación o una métrica). Las
agrupaciones de tiempo se ordenan por fecha de forma predeterminada. |
排序依据,最重要的在前(某个分组或指标)。时间分组默认按时间先后排列。 |
| `report.fields.blocks.helpText` | Sub-reports, each with its own data
source (joined reports only). | サブレポート。それぞれ独自のデータソースを持ちます(joined
レポートのみ)。 | Subinformes, cada uno con su propia fuente de datos (solo
informes joined). | 子报表,各有自己的数据来源(仅 joined 报表) |
| `report.fields.chart.helpText` | Chart type and settings. |
チャートの種類と設定。 | Tipo y configuración del gráfico. | unchanged (图表类型与配置
already follows) |
| `report.fields.dateRange.helpText` | The period the report opens with,
and whether people may choose their own range. |
レポートを開いたときに表示される期間と、利用者が自分で範囲を選べるかどうか。 | El período con el que se abre
el informe y si cada persona puede elegir su propio rango. |
打开报表时显示的时间段,以及使用者能否自己选择范围 |
| `report.fields.exportOptions.helpText` | Download formats (csv, xlsx)
and file name. Who may download is set by the export permission on the
data source’s object. | …データソースのオブジェクトのエクスポート権限で決まります。 (データセット → データソース)
| …el permiso de exportación del objeto de la fuente de datos. (del
conjunto de datos → de la fuente de datos) | …由数据来源对象上的导出权限决定 (数据集 →
数据来源) |

Counts: ja-JP 8 leaves, es-ES 8 leaves, zh-CN 6 leaves. zh-CN
`filter_and_chart.description` and `chart.helpText` were already current
against the English and are left as is. The six zh-CN values that moved
match the console's own zh overlay (`metadata-form-zh-cn.ts`), which
already carried the current English, except that the platform bundle
keeps the `matrix` / `joined` tokens its `type` hint and `joined_blocks`
label use, where the overlay writes 矩阵表 / 联合报表.

**Ledger.** `report-dataset-panel-echo-decisions.test.ts`: the
`values.helpText` row's reason cited its sibling `order.helpText` as
naming the rows/columns dimension and values measure vocabularies; that
sibling no longer does, so the reason gains one sentence saying so and
keeps the precedent as the record of why the leaf was reached. No
verdict or pinned value moved: no ledger pins any of the leaves above by
value (they are the population's authored, non-echoing negatives).

## Tests

<details><summary>platform-objects: translations suite, full package
suite and typecheck, green at d37c591</summary>

```
pnpm --filter @objectstack/platform-objects exec vitest run --maxWorkers=2 src/apps/translations
 Test Files  26 passed (26)
      Tests  610 passed (610)
pnpm --filter @objectstack/platform-objects run typecheck   (tsc --noEmit, scripts tsconfig, check:test-typecheck OK)
os-verify-lock: VERDICT command-exit 0
pnpm --filter @objectstack/platform-objects exec vitest run --maxWorkers=2
 Test Files  127 passed (127)
      Tests  2176 passed (2176)
os-verify-lock: VERDICT command-exit 0
```
</details>

<details><summary>Local gates, at d37c591</summary>

```
node scripts/pm/dispatch-gates.mjs --commands (diff-derived): 63 families
pnpm check:i18n                     EXIT=0  check-i18n-bundles: OK (10 package(s), all bundles in sync, no undeclared authoring keys)
                                    (first run EXIT=3 PREREQUISITE NOT MET, CLI unbuilt; re-run after the gate's own closure build)
pnpm check:i18n-stale-fill          EXIT=0  OK (11 bundle set(s), no new stale fills, 1 baselined)
pnpm check:nul-bytes                EXIT=0
pnpm check:doc-authoring            EXIT=0
pnpm check:issue-citations          EXIT=0  (self-test + scan: no issue citations added, 3 files read)
pnpm check:cross-package-test-inputs EXIT=0
check-adr-0087-registration / check-changeset-no-major / check-empty-changeset   EXIT=0 each
pnpm check:dual-build-cjs-loads     EXIT=0  (first run EXIT=3 prerequisite, re-run green)
remaining 41 derived families       EXIT=0 each
NOT MEASURED locally (my 150 s per-gate cap, whole-tree scans that read no translation text; CI runs them):
  check-comment-mask-corpus, check:query-options-erasure, check:slot-lookup
dispatch-gates --ran                63 of 63 derived families accounted for
node scripts/pm/overlap-check.mjs --branch=HEAD   VERDICT clean (origin/main, objectstack-ai#37436, objectstack-ai#37422 merge cleanly)
```
</details>

## Acceptance notes

- **Card item "the PR names every leaf it re-translated"**: the table
above names all 22 locale-leaves; the two zh-CN leaves left as is are
named too.
- **Same-family leftovers, not in this card** (noted, not filed):
`report.fields.type.helpText` still reads the enum list as slash-joined
tokens (tabular / summary / matrix / joined) in all three bundles while
the English reads "Report type: tabular, summary, matrix or joined.";
the meaning matches, so it is not stale.
`report.sections.joined_blocks.label` in zh-CN reads `joined 报表分块` where
the console overlay reads 联合报表的分块; label leaves were outside this card.
- `dataset-panel-echo-decisions.test.ts` cites
`report.sections.joined_blocks.label is 关联对象` in one reason, which the
bundle no longer reads; that row is the dataset panel's and its verdict
does not depend on it. Not touched.

## Verification

First read, by risk:
1.
`packages/platform-objects/src/apps/translations/ja-JP.metadata-forms.generated.ts`,
`report` block: the 8 changed values.
2.
`packages/platform-objects/src/apps/translations/es-ES.metadata-forms.generated.ts`,
`report` block: the 8 changed values.
3.
`packages/platform-objects/src/apps/translations/zh-CN.metadata-forms.generated.ts`,
`report` block: the 6 changed values.

Two-minute check: `pnpm --filter @objectstack/platform-objects exec
vitest run src/apps/translations`, expect 26 files, 610 tests passed. In
the browser: switch Studio to 日本語, open any report, and the Sort Order
hint reads 並べ替えの基準。重要なものから順に指定します(グループまたは指標)… with no rows / columns /
values tokens.

---

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

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

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

Fixes objectstack-ai#37099

Clause-②: yes
Metadata-protocol: none

## 维护者速读

- 用户看到的:知识库数据源第一次部署、或换了嵌入模型 /
索引配方之后,服务启动后会在后台自动把它建好索引,不用再等每条记录被改一遍才能搜到;管理员也可以用命令行手动重建某个源、查看每个源的索引状态和进度。
- 为什么做:属于「知识检索平台化」专题,让知识源开箱即可检索;以前一个从没建过索引的源,搜索永远是空的。
-
出错会怎样:建索引会把匹配到的内容发给嵌入服务商并产生费用;默认的内存存储每次重启都会整源重建、每个节点各建一次,只有配置了共享集群锁才是一个节点建;可以用插件开关关掉开机自动建,回退就是撤掉这个改动。
- 要你做什么:无。

## What changes

**First build after boot** (`@objectstack/service-knowledge`)
- `KnowledgeService.readIndexState(source)` reads ADR-0161 K7's table
for one source: the adapter holds nothing, a different fingerprint, a
different recipe hash, no recipe hash, current, or (an adapter without
`indexStatus`) whether `listDocuments` lists anything. Each reading says
whether a build is due.
- `KnowledgeService.buildSourcesAtBoot()` runs from the plugin's
`kernel:bootstrapped` hook, after the embedder is provided, without
holding up the boot. It walks the sources one at a time and builds each
one a build is due for. A source with `refresh.onRecordChange: false`
(an external indexer owns it) is skipped. A state it cannot read, or an
adapter that cannot say, is logged at warn and left alone; the operator
rebuild is the way for those.
- **One node builds.** `rebuildSource` takes the cluster lock
`knowledge:build:SOURCE` (`ILock`, 60 s lease renewed every 20 s,
`waitMs: 0`). A node that finds the lock held records `not-run` and
builds nothing. A node that gets the lock re-reads the state first, so a
node arriving after another finished builds nothing either. If the lock
service errors, no build starts and the node warns. Without a `cluster`
service (single process) the build runs without a lock.
- Each build logs one cost line at its start (every row the source's
`where` matches is read, and its content fields are sent to the
embedding provider, which bills for them), progress at most every 10 s,
and its totals at the end (info) or why it did not finish (warn).
- New plugin option `buildAtBoot` (default `true`). `false` turns the
boot pass off; the operator rebuild still works.

**Operator rebuild**
- Two actions on the `knowledge` settings namespace, beside `test`:
`rebuild` (`{ source }`) starts a build and answers at once;
`index_status` (`{ source? }`) answers each source's index reading and
the last build record on this node, with its progress. Both go through
the settings action door, so both need `manage_platform_settings`. A
second rebuild of a source already building on this node is refused.
- `os knowledge rebuild SOURCE` starts one and follows it to its end by
polling `index_status` (`--no-wait` to return at once, `--interval`). It
exits 1 when the build failed or did not run, or when the answer comes
from a node that is not running this build.
- `os knowledge status [source]` prints each source, its index state and
its last build on the node that answered.

**Docs**: `content/docs/ai/knowledge-rag.mdx` gains "The first build,
and rebuilding a source": the K7 table, what one build costs (a warn
callout), how to turn the boot pass off, and the two commands.

**Rework round (seat L1 REWORK, contract record PASS with should-fix
findings)**
- **S3, the admin gate is pinned.**
`knowledge-settings-contribution.test.ts` gains "the rebuild and
index_status actions are administrator-only, at the HTTP door": a real
`LiteKernel` with `KnowledgeServicePlugin` and `SettingsServicePlugin`,
driven through `registerSettingsRoutes` and the real
`SettingsService.runAction`. A signed-in caller without
`manage_platform_settings` (an organization member holding `setup.read`
/ `setup.write`, or one with no capability) gets `403
SETTINGS_FORBIDDEN` for `rebuild` and `index_status`; an unauthenticated
one gets `401 UNAUTHENTICATED`. No refusal names the source (id or
label), and no handler method on the service (`listSources`,
`getSource`, `readIndexState`, `rebuildSource`, `buildRecord`) is
called. A control shows the same door lets an administrator through and
then names the source, and the in-process `runAction` with an enforced
member context rejects with `SETTINGS_FORBIDDEN`. The gate itself is
unchanged; it still lives in the `knowledge` manifest's
`writePermission`, and relaxing it now turns these pins red (ablation
below).
- **S4, the cost callout** in `content/docs/ai/knowledge-rag.mdx` now
says the default `memory` adapter holds nothing after a restart, so with
it every boot is a first build that re-embeds the whole source on every
node; and that "only one node builds a source" holds only with a shared
cluster lock driver, because the default `memory` cluster driver's lock
is a per-process mutex. The paragraph above the callout now qualifies
its "only one builds" sentence the same way and links the cluster page.
The changeset says both.
- **S6, the CLI reference.** `content/docs/deployment/cli.mdx` gains a
`### Knowledge` section after `### MCP`, in the shape of the other
command groups (overview table, one `####` per command with examples, a
flag table): `os knowledge status` and `os knowledge rebuild`, their
exit codes, the admin-only door, and the per-node build record.
- **Nits fixed:** N2 (`os knowledge rebuild --no-wait` now prints that
it reports no outcome and points at `os knowledge status`; the flag help
and the CLI reference say so), N3 (`buildSourcesAtBoot` lists the
sources inside a `try` and resolves with a warn when it cannot; the
plugin's `void` call carries a `.catch`), N5 (an adapter reporting `{
building: true }` with no active fingerprint, a first build that never
completed, now reads `nothing` with its own sentence instead of
`new-fingerprint`). N1 (the optional `protocol/knowledge.mdx` pointer)
stays an accepted deviation.
- **Carded, not fixed here:** S1 (a lease that lapses mid-build only
warns and the walk goes on unfenced; a build whose embed call never
returns renews forever) is objectstack-ai#37465. S2 (build records live in memory per
node, so behind a load balancer `os knowledge rebuild` can exit 1 on a
poll that lands elsewhere) is objectstack-ai#37466. S5 (retiring the field gate's
`title` arm) is objectstack-ai#37467.

## Why

A source that was never built had an empty index until each of its rows
was written again; search found nothing and nothing said why. After an
embedder or recipe change the index stayed stale the same way. ADR-0161
K7 says what starts a rebuild; nothing ran it.

## Tests

-
`packages/services/service-knowledge/src/__tests__/knowledge-build.test.ts`
(20 tests): every `readIndexState` reading; a fresh source is built at
boot and search finds its rows; a built source is not rebuilt; two nodes
sharing one lock build once (one `done`, one `not-run`, lock released);
a node arriving late re-reads and builds nothing; a lock error starts
nothing and warns; `onRecordChange: false` is skipped; a failed build is
logged at warn and stays due; the `rebuild` and `index_status` actions
(progress, result, an operator rebuild skipping unchanged documents, a
running build refused, bad payloads refused); the plugin's
`kernel:bootstrapped` pass and `buildAtBoot: false`.
- `packages/cli/src/commands/knowledge/knowledge.test.ts` (7 tests):
both commands against bodies written by `sendOk` / `sendError`: the
route and payload, following a build to its end, exit 1 on a failed
build, on a server refusal, and on an answer from a node not running
this build; `--no-wait`.
- Ablation: replacing `lock.acquire` with an always-granted handle fails
the two-node and lock-unreachable tests.
- Rework round: `knowledge-settings-contribution.test.ts` +10 tests (the
admin-gate pins above); `knowledge-build.test.ts` +2 (N3: a listing that
throws resolves and warns; N5: `{ building: true }` reads `nothing`);
`knowledge.test.ts`: the `--no-wait` case now also asserts the line
naming `os knowledge status` (N2).
- Rework ablations, each mutated through `scripts/ablation-replace.mjs`
(landing proved on disk, restore proved `git diff HEAD` empty):
- S3: the `knowledge` manifest's `writePermission` set to `setup.write`
in `@objectstack/service-settings`, package rebuilt (the pins read its
`dist/`): the four member cases, the admin control and the in-process
case turn red (6 failed, 4 passed); restored and rebuilt, 10/10 green,
and the built manifest reads `writePermission:
"manage_platform_settings"` again.
- N5: the new branch disabled: its test red. N3: the listing failure
rethrown: its test red. N2: the log line deleted: the `--no-wait` test
red. All three green again after restore.

## Acceptance notes

- **The `title` arm of the field gate is not retired here.** Per the
11-25 14:55Z comment it can go once a rebuild has run, but it is a
security gate and retiring it needs proof per source at search time that
the index was built under the current recipe. That is its own row,
objectstack-ai#37467; this PR only makes the rebuild happen.
- **Build records are per node.** `index_status` reports the build the
answering node ran. Behind a load balancer, `os knowledge status` may
reach a node that is not building; `os knowledge rebuild` says so and
exits 1 rather than guessing. The index state itself is read from the
adapter and is the same on every node. Sharing the record, or letting
the CLI fall back to the index state, is objectstack-ai#37466.
- **No Setup page button.** The rebuild entry is the CLI (and the action
route it calls). A button on the Knowledge settings page is a separate
UI row if wanted.
- The CLI reference `content/docs/deployment/cli.mdx` now lists both
commands (S6). `content/docs/frontend/cli.mdx` is not updated: it is
outside this card's file surface.
- A boot build runs sequentially per source and in the background; boot
does not wait for it.
- Lease fencing (stop the walk once the lease is lost, bound a build
whose embed call never returns) is objectstack-ai#37465.

## Verification

- `service-knowledge`: 14 test files / 436 tests pass; `tsc --noEmit`
and `check:test-typecheck` pass.
- CLI: the knowledge tests and the vitest tier partition test pass (29
tests). `eslint --no-inline-config` on every changed file passes.
- CLI `tsc --noEmit`: **not measured locally**. This container has no
built `dist/` for the CLI's workspace dependencies (563 TS2307-family
errors, none in a knowledge file); CI owns it.
- Real kernel run: two `LiteKernel`s sharing one `MemoryLock` over a
250-row source. Boot returned in 9 ms without waiting for the build.
Node A: `done`, 250 indexed; node B: `not-run` ("another node holds the
build"); `beginBuild` called once; search found row `r0007`; the state
afterwards read `current`. A non-admin
`runAction('knowledge','rebuild')` was refused ("requires the
'manage_platform_settings' capability"); an admin rebuild then showed
`done` with 250 skipped. The log carried the cost line.
- Derived gates: the local run's gates exit 0 except six that need a
full build or full history (`check:skill-examples`,
`check:dual-build-cjs-loads`, `check:i18n`, `check:i18n-coverage`,
`check:i18n-walk-parity`, `check-plugin-teardown-shape --self-test`;
that script's scan alone exits 0). Those six go to CI.
- Overlap check against objectstack-ai#37102 and objectstack-ai#37004 (both touch
`knowledge-rag.mdx`, objectstack-ai#37102 also `packages/cli`): clean at push time.
The second to land merges main.

<details><summary>Rework round readings, head 1061045</summary>

- `service-knowledge` (dependency closure rebuilt first, `turbo run
build --filter='@objectstack/service-knowledge^...'`, 18/18 tasks):
`pnpm test` 14 files / 448 tests pass; `typecheck` (`tsc --noEmit` and
`check:test-typecheck`, 0 files / 0 errors in the debt ledger) passes.
- CLI: `src/commands/knowledge/knowledge.test.ts` 7/7 pass (unit layer).
CLI `tsc --noEmit` not measured locally, for the reason above; CI's
`TypeScript Type Check` owns it.
- `eslint --no-inline-config` on the seven changed `.ts` files: exit 0.
- Derived gates (`dispatch-gates.mjs --commands`, 122 commands, run on
a753df9 with the changeset edit in the tree): 114 exit 0. Not measured
here, left to CI: six exit 3, PREREQUISITE NOT MET, the same six the
first round named (`check-plugin-teardown-shape --self-test`, whose
positive control is pinned to a commit a shallow clone cannot reach, its
scan exits 0; `spec check:skill-examples`, `check:dual-build-cjs-loads`,
`check:i18n`, `check:i18n-coverage`, `check:i18n-walk-parity`, which
read built output this container does not have); two whole-repo scans,
`check:query-options-erasure` (its self-test passed) and
`check:type-check-debt`, hit the 300 s per-command limit on the shared
box. Re-run on 1061045: the changeset family
(`check-adr-0087-registration`, `check-changeset-no-major`,
`check-empty-changeset`, `check:changeset-fixed`), `check:nul-bytes`,
`check:doc-anchors`, `check:cli-command-ids`,
`check:cli-examples-parity`, all exit 0.
- `overlap-check` before each push: clean against `origin/main`, objectstack-ai#37442,
objectstack-ai#37422 (shares `content/docs/deployment/cli.mdx`) and objectstack-ai#35129. objectstack-ai#37004 has
no PR open yet.

</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.
- [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: its generated artifacts are
regenerated and committed. (not touched)
- [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.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

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

https://claude.ai/code/session_01JQwxbXkQAmjg7Hf74xDKA6

<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6Cb4BAjgQ43tqy1DvVJ -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…a package; two columns, no top bar (objectstack-ai#37470)

<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgNFUifusaHW7HJRgpb8tzNW)_

repo:objectstack#5 · os-bill · session_01Utp6CYNbcRTbq4QAT4wBXW

Fixes objectstack-ai#37451

Clause-②: no
Metadata-protocol: none
Container & model: `S`, `mode:thread`, `model: CONTRACT_REVIEW_TIER
(mandatory for docs/adr/**; served at tier, read from the thread's
session record)`, `effort: xhigh (ADR amendment, standing order)`

## 维护者速读

- 用户能看到什么变化:现在没有,这次只改架构记录的文字。它写定了 Studio
的新外框:去掉顶栏改成左右两栏,左上角恢复软件包切换器(带「新建软件包」),菜单第一项是「概览」,Studio
用自己的石墨色,以及顶栏上每个按钮搬去哪。
- 为什么做:第一阶段的四张界面卡都照这份记录施工,先写清楚,开发才不会各自猜。后面几个阶段的内容也一次写进去了,分阶段实施。
- 出错会怎样:不改代码,不改发布包。合并后发现措辞不对,再修订一次即可改回。
- 要你做什么:批准合入(受管文件,需要 os-zhuang 和 hotlong 批准)。专题的 5
个问题、表单层级、「诊断」页留在哪,都按你今天的裁定写成已定,正文里没有待定的问题了。有一处你没说、我先写了:表单在「常用」里排在报表之后、紧挨视图前面(正文第
11 点)。

## What changes

Two files, text only (+229 / −8 against `main` at `a46efa8c`). No code,
no test, no changeset.

**`docs/adr/0084-application-builder-information-architecture.md`**
gains its third in-place amendment, dated 2026-11-26.

- The status line gets a third "Amended in place" entry, appended at its
end, and the record gets a third note at the top. The title is
unchanged, so the `docs/adr/README.md` row is unchanged
(`check:adr-index` green).
- A new section, **Amendment (2026-11-26)**. Each part has its own
anchor, so that a child card can cite the part it builds:

| Part | Anchor | Who cites it |
|---|---|---|
| What Studio is: the entry for developing a package; the name App
Studio / 应用搭建 | `#amendment-2026-11-26-position` | every card |
| The frame: two columns, no top bar; Studio's row and the package row;
the restored switcher with 新建软件包; the lock; the rail; the menu's look;
graphite | `#amendment-2026-11-26-frame` | objectstack-ai#37452, objectstack-ai#37456 |
| Where the top bar's controls go (seven tenants, their homes) |
`#amendment-2026-11-26-homes` | objectstack-ai#37455, objectstack-ai#37456 |
| 概览 Overview: first entry, no `package` metadata type, header, three
tabs, what Pending counts, what it may do and what stays in Setup, what
phase 1 builds | `#amendment-2026-11-26-overview` | objectstack-ai#37454; phase 2 |
| Placements, and what moves to Setup (`dataset`, `position`,
Diagnostics, the cross-package directory, `datasource`, and `form`) |
`#amendment-2026-11-26-moves` | phase 3; objectstack-ai#37087 |
| Organization-level content, as ruled on questions 2 and 3 |
`#amendment-2026-11-26-org` | phase 4 |
| What the amendment replaces, and what stands |
`#amendment-2026-11-26-stands` | reviewers |
| Written here where the rulings were silent (ten numbered points;
number 7 is kept as a pointer to its ruling) |
`#amendment-2026-11-26-silent` | the approver |

- Nine marks on the earlier text, each pointing at the new section:
TL;DR 4; the first two bullets of the 2026-11-24 "What Studio is"; the
menu's drawing; the `datasource` reading; "Entries that are not a type";
the `dataset` row of the 2026-11-24 "What stands" table; item 1 of the
2026-11-24 list; the tiers paragraph of 2026-11-25.
- There is no "Open" part any more. Every question the plan put to the
maintainer is answered, and each answer is written in the part it
decides.


**`docs/adr/0146-studio-designs-setup-administers-one-editor-per-item-paired-customize-package.md`**
is touched in D1 only: a dated pointer in the status block; a mark on
D1's scope sentence; one dated paragraph at the end of D1's 2026-11-24
amendment; and one short pointer to it, at "no metadata catalog". An
earlier head also marked "diagnostics"; that mark is taken out, because
the maintainer ruled that Diagnostics stays in Studio.

**Not touched, on purpose:** the rows of ADR-0084's type → group table.
`ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts`
pins them, row by row, to the registry and the placement list. The ruled
moves are written as prose, and the section says each row is rewritten,
or written, in the change that moves it.

**The maintainer sources** (verbatim):

1. The order that opened the area for the epic, 2026-11-26 05:27Z:
「开一个专区处理专题 37424」
2. The pick on the area's decision card, 2026-11-26 05:57Z: 「按推荐启动」,
whose recommended option read, as objectstack-ai#37451 records it:
「返回放左上第二行,⋯和发布进概览页,保存/取消放详情页头,AI放标题行右端。」
3. Questions 2 and 3, 2026-11-26 06:44Z, in the area's thread: 「同意」, to
the area's proposal to rule both as recommended. Ruling record: objectstack-ai#37424
comment 7184753035.
4. The question on the `form` type, recorded on objectstack-ai#37451 (comment
7184972402): 「Studio 菜单还没有 form 类型是吗?怎么规划?」
5. The tier of `form`, 2026-11-26 07:36Z, in the project chat: 「表单放常用」.
Ruling record: objectstack-ai#37451 comment 7185703578.
6. Questions 1, 4 and 5 and the Diagnostics page, 2026-11-26 08:56Z, in
the area's thread: 「同意」, to the area's recommendations. Ruling record:
objectstack-ai#37451 comment 7187264388.

The maintainer's words on the design itself are the quotations in epic
objectstack-ai#37424's body; the new section quotes them where each one decides
something.

**Each ruling, and where it is written:**

| Ruling | Record | Written in |
|---|---|---|
| Question 1 = B: disable, enable and delete stay in Setup; 概览 carries
authoring actions and a "Manage in Setup" link | 7187264388 |
`-overview` ("What 概览 may do, and what stays in Setup"); `-position`;
ADR-0146 D1's paragraph, "Not changed here" |
| Question 2 = A, question 3 = C: organization-level content |
7184753035 | `-org` |
| Question 4 = yes: `dataset` and `position` are common types, placed by
name | 7187264388 | `-moves` (their two bullets; "The rule of 2026-11-25
is not reworded"; the three order lists) |
| Question 5: the cross-package directory goes to a Setup group that
holds access pages, not Diagnostics | 7187264388 | `-moves`; ADR-0146
D1's paragraph |
| Diagnostics stays in Studio, reading the open package (the point this
PR had raised as item 7) | 7187264388 | `-moves`; ADR-0146 D1's
paragraph; item 7 is now a pointer |
| `form` is a common type | 7185703578 | `-moves`; item 11 |

**Read first** (by risk):

1. Each ruling against its record, using the table above. The text
should add nothing to a record. Where a ruling changes one of the epic's
numbered decisions (9, 11, 12), the "Decided by" part lists which and
says the ruling decides.
2. The named placements. Three types join the ten common types of
2026-11-25, which makes thirteen. The rule of that day is not reworded:
it already says that a type the maintainer places by name goes where the
name says.
3. The `form` point (item 11). The ruling gives the tier and not the
place inside it; the text lists `form` last of the group's common types,
after `report`, which is directly before `view`.
4. ADR-0146 D1: only the scope sentence and one catalog (the
cross-package directory) are marked. D1's "diagnostics" stands as
written.
5. The table of the top bar's seven tenants, and items 3 to 6 of the
"silent" list.

**Two-minute verification**: `cd ui && pnpm exec vitest run
--maxWorkers=2
packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts`
→ `Tests 12 passed (12)`. It reads ADR-0084 and proves the table pin
still holds.

## Tests

n/a — `docs/adr/**` text. The one test that reads ADR-0084 was run and
passes (above).

## Acceptance notes

- **The card's acceptance, line by line.** One PR amending ADR-0084 and
the ADR-0146 wording that moves: this PR. Each phase-1 child card can
cite a section: the first table above. The body quotes the maintainer
sources: above. "Questions 1 to 5 appear as open" was written before the
maintainer answered them: all five are now written as ruled, each citing
its record.
- **Three reworks after the first push**, each on a ruling or a note
that arrived later. `44069a71`: organization-level content as ruled, and
a place for `form`. `6e55cbb8`: `form` as a common type, on 「表单放常用」.
`2520f4d3`: questions 1, 4 and 5 and the Diagnostics page as ruled; the
"Open" part removed; ADR-0146's mark at "diagnostics" taken out.
- **Past the card's words; each is a numbered item in the record, for
the approver.**
- The top bar holds seven things, not five. The menu's show/hide control
goes to Studio's row (decision 3). The "create app" button for a package
with no app is given no home (item 5). Below 768 px the menu is a drawer
and a strip keeps its opener (item 4).
- Decisions 8 and 12 are written, though the card lists 1–6 and 9–10
(item 9). The card's own summary asks for the Setup moves to be written
once.
- Where the switcher lands and what it lists (item 3); Save and Cancel
on a page that is not an item (item 6); the order around `dataset` and
`position` (item 8); where `form` sits among the common types (item 11).
- **Item 7 keeps its number and is now a pointer.** It had set the
epic's decision 12 (Diagnostics to Setup) beside the 2026-10-30 ruling
in ADR-0146 D1. The maintainer ruled that the earlier word holds. The
ruling record names the point "item 7", so the number stays and the
later items are not renumbered.
- **`form`: the tier is ruled, the place inside it is this record's.**
Group: the interface group, its registered domain. Tier: common, by the
maintainer's words. Place: fifth of the group's common types, after
`report`. The area had recommended the place directly after `view`; a
common type cannot take it, because the menu lists a group's common
types before its advanced fold, so the text puts `form` directly before
`view` instead. ADR-0159 D10 says ADR-0084 needs no change for `form`;
that was written before the table took one pinned row per type, and the
"What stands" table says so. PR objectstack-ai#37422 (card ② of ADR-0159) keeps `form`
off Studio's directory, so the row is objectstack-ai#37087's to write.
- **Which Setup entry the cross-package directory becomes is left to its
card.** The ruling says a group that holds access pages, and not
Diagnostics; it names no entry, and the text names none.
- **ADR-0146 is touched in more than one sentence.** The card speaks of
"the one ADR-0146 sentence on the split". Decision 12 moves one thing D1
gave Studio, the cross-package directory, and D1's "no metadata catalog"
would contradict ADR-0084 without a mark. The claim was amended before
the edit (comment 7184713180 on objectstack-ai#37451); the final text marks less than
the claim allows.
- **ADR-0070 is not edited.** The ruling on questions 2 and 3 restates
its D1 and D5; the text leaves those marks to the phase-4 cards that
carry the ruling out. Its D2 as amended stands by the ruling on question
1.
- **The claim was written by this thread**, as the area's dispatch order
asked (comment 7184414899), and amended once.
- **Tier H by path.** `docs/adr/**` (AGENTS.md Prime Directive objectstack-ai#14):
approvers os-zhuang and hotlong, and the maintainer merges. The PR stays
a draft. The `Rule-change` line is left out, as the template asks for a
diff that does not touch `.claude/**`.
- **No changeset.** `docs/adr/**` is not published; `skip-changeset` is
declared with the create.

## Verification

- Gate list derived on the final head `2520f4d3`: `node
scripts/pm/dispatch-gates.mjs --commands` → 21 commands (2 paths against
merge base `a46efa8c`).
- All 21 exited 0 on `2520f4d3`, each exit code captured before any
pipe. The same 21 were green on the four earlier heads. On the very
first pass `check:doc-formula-expressions` exited 3 (a prerequisite was
not built, nothing measured); after `@objectstack/formula` and
`@objectstack/lint` were built under the verify lock it exited 0, and on
every head since.
- `--ran` reconciliation on `2520f4d3`: `21 derived famil(ies) accounted
for — 21 run, 0 NOT-MEASURED (a DERIVED zero — all 21 recorded an exit
code and none of them is 3)`.
- Five commits: the amendment (`642bb640`); three wording fixes found on
a read-through (`df25621c`); and the three reworks above (`44069a71`,
`6e55cbb8`, `2520f4d3`). The first commit's message was reworded before
anything was published, because the pre-push hook refuses a commit
message that names its card; no published history was rewritten.
- The table pin: `studioMenuPlacement.test.ts`, 12 of 12 passed on
`2520f4d3`, under the verify lock.
- Quotations: every 「…」 the diff adds was matched as a substring of its
source (the epic's body, the card's body and comments, the ruling
records, or ADR text already on `main`).
- `overlap-check.mjs` on `2520f4d3`: clean against `origin/main`
`df0894a6` and 0 PR heads. `main` has moved since the branch was cut; it
touched neither ADR, the placement list, the registry nor Setup's
groups, so the branch was not merged up. PR objectstack-ai#37422 was read by hand: it
does not touch either file.
- `dispatch-gates --tier`: `docs/adr/**` is the mandatory contract tier;
changed lines 237 against the human-merge threshold 3000: under.
- `check-prior-rulings --paths` on the two files at `a46efa8c`, read
before the edit: the 2026-11-24 and 2026-11-25 amendments are the
rulings in force; this PR amends the first's position and top-left
sentences on the maintainer's 2026-11-26 words and leaves the second's
tier rule standing.
- CI-owned families (type-check lanes, artifact rosters, `test:repo`,
the always-runs tail) are this PR's check-runs.

```text
Local gates (21, each exit 0)
node scripts/check-adr-links.mjs [+ --self-test]
node scripts/check-closing-keyword-parity.mjs [+ --self-test]
node scripts/check-comment-mask-corpus.mjs
node scripts/ci/plan-test-core-shards.mjs --self-test
pnpm --filter @objectstack/lint run check:doc-formula-expressions
pnpm check:adr-anchors · check:adr-index · check:adr-symbol-anchors
pnpm check:ci-filter-parity · check:closed-ceremony-text · check:cross-package-test-inputs
pnpm check:doc-authoring · check:driver-memory-census · check:gitlink-declared
pnpm check:nul-bytes · check:pm-governed-merges · check:pm-prior-rulings
pnpm check:refd-timer-probe · check:watch-hint-literal
```

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

https://claude.ai/code/session_01Utp6CYNbcRTbq4QAT4wBXW

<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6CYNbcRTbq4QAT4wBXW -->

---------

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

Fixes objectstack-ai#37365
Clause-②: yes (a new reserved URL parameter `section`)
Metadata-protocol: none

## 维护者速读
- 用户能看到什么变化:使用应用内 AI
的用户,在回答下方看到“引自记录”的引用条(每条显示摘句);点一条就打开那条记录,并滚到被引的那一节、高亮标出。
- 为什么做:记录 AI 问询专题的第 10b 行,让用户能从 AI 回答一键跳回原文核对。
- 出错会怎样:引用条不显示或跳到记录顶部,记录本身与数据不受影响;撤回本次合并即可恢复原样。
- 要你做什么:无。

## What changes

Governing text: ADR-0160 D9 as amended by objectstack-ai#37363; ruling 7177410380 on
objectstack-ai#37144 (Q1 A: draw the persisted, already-verified list, never
re-verify; Q3 A: a related-row quote opens the root record).

- **Lift** (`plugin-chatbot/src/mapMessages.ts`):
`extractRecordCitations(parts)` reads the last `data-record-citations`
part (`RECORD_CITATIONS_PART_TYPE`) through the spec's
`RecordCitationsSchema`. A part the schema refuses, or an empty list, is
no list (the `detectAnswerSource` precedent). `uiMessageToChatMessage`
carries it as `recordCitations`; `chatMessageAdapter.ts` names the new
render-only key.
- **Chips** (`plugin-chatbot/src/RecordCitations.tsx`, new; drawn in
`ChatbotEnhanced.tsx` beside `AnswerSourceBlock`): one chip per citation
showing the quote. A click calls `onOpenRecord({ objectName: object,
recordId: id, anchor })`; `onOpenRecord`'s argument gains an optional
`anchor`. Nothing is fetched or verified on display.
- **Open** (`app-shell/src/console/ai/AiChatPage.tsx`): `openRecord`
takes the optional `anchor` and navigates to `recordOpenTarget(app, …)`
= `/apps/APP/OBJ/record/ID?section=ANCHOR`. The dock and the `/ai` page
both draw this `ChatPane`.
- **Param** (`app-shell/src/urlParams.ts`): `RECORD_SECTION_PARAM =
'section'`, in `RESERVED_URL_PARAMS` and the param table.
`RECORD_SECTION_OPENED_STATE` is a history-state key, not a URL
parameter (the `RECORD_COMMENTS_PUSHED_STATE` precedent).
- **Record page** (`app-shell/src/views/recordSectionAnchor.ts`, new;
wired in `RecordDetailView.tsx`): once the record is held, the spec's
`headingsOf` runs on each long-text field (`markdown`,
`html`/`richtext`, `textarea`) in field order; the first whose outline
issues the anchor is the body. The heading element is found in that
field's drawn face and scrolled to and marked (the linked-comment
marking). The match is trusted only when the face draws exactly as many
headings of that title as the outline lists. A `textarea` body, a
heading that is not drawn within 4 s, a count that differs, or a heading
with no letter or digit scrolls to the field. A stale anchor opens the
top. The cleanup takes the mark off, so opening another section moves
the mark. Each chip click carries a fresh history-state value
(`RECORD_SECTION_OPENED_STATE`), so the same chip clicked again opens
its section again; a navigation that keeps the state, such as a tab
switch, does not.
- **Field marker** (`plugin-detail/src/DetailSection.tsx`): each detail
row carries `data-detail-field={field.name}`, which is how the page
finds a field. One attribute, no behaviour change.
- **i18n**: `chatbot.recordCitations.title` in all 11 `ui/packages/i18n`
locales.
- Docs: `content/docs/frontend/plugins/plugin-chatbot.mdx`,
`ui/packages/plugin-chatbot/README.md`; changeset
`.changeset/37365-record-citation-chips.md` (patch, four `@object-ui/*`
packages).

Read first, by risk:
1. `ui/packages/app-shell/src/views/recordSectionAnchor.ts`:
`locateSection` (how a drawn heading is matched) and
`focusRecordSection` (observer and settle timer).
2. `ui/packages/plugin-chatbot/src/mapMessages.ts`:
`extractRecordCitations` (the parse gate).
3. `ui/packages/app-shell/src/views/RecordDetailView.tsx`: the effect
beside `holdsRouteRecord`.

## Tests

Head `c1b30e6a0b`. Every run went through `scripts/pm/os-verify-lock.sh`
on a shared box.

- New pins:
`plugin-chatbot/src/__tests__/ChatbotEnhanced.recordCitations-37365.test.tsx`
(lift through the spec schema; chips; a refused part draws nothing with
a CONTROL leg; no fetch on display; related-row quote opens the root
record; record-link grammar still refuses a fragment, with a CONTROL);
`app-shell/src/views/recordSectionAnchor.test.tsx` (anchor derived as
the server derives it; matching by reading with repeats; a same-titled
heading the outline does not list, a listed heading the face does not
draw, and a heading with no letter or digit each open the field, each
with a CONTROL; textarea opens at the field; a heading never drawn
settles on the field; stale anchor moves nothing, with a CONTROL; the
cleanup unmarks, keeping a class the heading already had; the same
section opened again scrolls and marks again);
`app-shell/src/views/RecordDetailView.citedSection-37365.test.tsx` (the
REAL `RecordDetailView` and the real markdown face: `?section=scope`
marks and scrolls the first Scope, `scope-2` the second, a textarea body
scrolls to the field, a stale anchor opens the top with a CONTROL, a
setext `Scope` above the cited `# Scope` opens the field with a CONTROL,
a second chip moves the mark and the same chip again scrolls again,
CONTROL a state-keeping replace does not); a new describe in
`AiChatPage.recordLink-13037.test.tsx` (the real `ChatPane`: the chip
opens `/apps/APP/OBJ/record/ID?section=scope` under a `/_console` and a
root mount; each click carries a fresh opened-state value; a related-row
quote opens the root record with no section).

<details><summary>Whole suites of the four touched packages, at
c1b30e6</summary>

- `@object-ui/plugin-chatbot`: `Test Files 104 passed (104) · Tests 1089
passed (1089)`
- `@object-ui/i18n`: `Test Files 111 passed (111) · Tests 2028 passed |
13 skipped (2041)`
- `@object-ui/plugin-detail`: `Test Files 419 passed | 1 skipped (420) ·
Tests 3968 passed | 18 skipped (3986)`
- `@object-ui/app-shell`: `Test Files 2437 passed | 1 skipped (2438) ·
Tests 23428 passed | 9 skipped (23437)`
- All four ran in one lock hold: `VERDICT command-exit 0`, each package
exit 0.
- `type-check`: app-shell exit 0 at `c1b30e6a0b`. plugin-chatbot,
plugin-detail and i18n exit 0 at `60981028c`; this round changes no
source of theirs.
- Derived gate families: 73 derived, 73 run, every one recorded `exit 0`
(`dispatch-gates --ran`: "a DERIVED zero"), `check:type-check-debt`
included.
</details>

<details><summary>Ablation of the parse gate (round 1, at
6098102)</summary>

`node scripts/ablation-replace.mjs` replaced the
`RecordCitationsSchema.safeParse` lines in `extractRecordCitations` with
a bare `Array.isArray` pass-through (anchor x1 to x0, blob
`0354c5b73c28` to `400078723215`). The chip test then went red: `Tests 5
failed | 9 passed (14)`; the failing tests were the four refused-part
cases and "a part that fails the parse draws nothing". Restored: blob
equals HEAD (`0354c5b73c28`) and `git diff HEAD` is empty.
plugin-chatbot resolves to `src` through the vitest alias, so no `dist`
rebuild was involved. This round does not touch that file.
</details>

<details><summary>Mutation of the count check (round 2, at
c1b30e6)</summary>

`node scripts/ablation-replace.mjs` replaced `drawn.length ===
candidate.count ? drawn[candidate.ordinal] : undefined` in
`locateSection` with `drawn[candidate.ordinal]` (anchor x1 to x0, blob
`20eec4db25ed` to `f4f48f4f6379`). The two section test files then went
red: `Tests 3 failed | 21 passed (24)`. The failures were the
same-titled unlisted heading and the listed-not-drawn heading pins in
`recordSectionAnchor.test.tsx`, and the setext pin in
`RecordDetailView.citedSection-37365.test.tsx`. Restored with `git
checkout HEAD --`: blob equals HEAD (`20eec4db25ed`) and `git diff HEAD`
is empty. app-shell tests import their own `src`, so no `dist` was
involved.
</details>

## Acceptance notes

- **Which field is the body.** The URL carries only `section`, so the
page cannot read the citation's `context` pack. It runs `headingsOf` on
every long-text field the record holds (`markdown`, `html`, `richtext`,
`textarea`), in field order, and the first whose outline issues the
anchor is the body. When the pack's body field holds the anchor, the
result is the same. Another long-text field earlier in the field order
that has a heading with the same anchor would be opened instead. The
alternative, reading the pack's `body.field`, would need `context` on
the URL as well; it was not taken.
- **A2 (measured: holds only in part).** The drawn face shows headings
that `headingsOf` does not list: setext headings, an empty `#`, headings
inside a quote or a list, an indented ATX heading, and empty `h1`-`h6`
in html. The outline also lists headings the face does not draw, such as
a `#` line inside a raw HTML block or a four-backtick fence. With a bare
Nth-element rule, each of these shifts every later heading. The rule
taken (`locateSection`) has two parts. First, among the field's drawn
heading elements, it picks those whose letters and digits read the same
as the outline's heading and indexes them by the outline's repeat count.
Second, it trusts that index only when the face draws exactly as many
headings of that reading as the outline lists. Otherwise it opens the
field, and it also opens the field for a heading with no letter or
digit. So a differing heading of another title shifts nothing. A
same-titled one, or a listed one the face does not draw, opens the field
rather than a heading that may be another. A heading whose raw text
carries letters the face does not draw (a link's URL) reads differently
and opens at the field too. Two headings that normalise alike (`C` and
`C++`) are told apart by order, which both sides share.
- **Moving the mark (round 2).** The focus cleanup takes the attribute
and only the classes the mark added. A second citation on the open
record, or the record left, leaves no stale mark. The chat opener puts a
fresh `RECORD_SECTION_OPENED_STATE` value on each chip click, and the
record page keys the focus on record, anchor and that value. So the same
chip clicked again (same URL) scrolls and marks again. The tab and
comment writers replace the URL keeping `location.state`, so they do not
re-scroll.
- **Files beyond the claim's surface.** (1)
`ui/packages/plugin-detail/src/DetailSection.tsx` gets one
`data-detail-field` attribute on each detail row. Without it the page
has no way to find a field, so the textarea and not-drawn cases could
not open at the field. (2)
`ui/packages/plugin-chatbot/src/chatMessageAdapter.ts` gets one key on
`RuntimeOnlyMessageKeys`, the declared place for a new render-only
message key. (3) The new helper
`ui/packages/app-shell/src/views/recordSectionAnchor.ts`. (4) The
chatbot docs page and README. overlap-check is clean against
`origin/main` and against objectstack-ai#37436, which shares `DetailSection.tsx` and
the 11 locale files (disjoint hunks), and objectstack-ai#37422, which shares the 11
locale files.
- **Not covered: a reload.** The chips are drawn from the live stream.
When the `/ai` page rebuilds history, it drops any `data-*` part other
than charts: `hydratedMessagesToChatMessages`, then `useObjectChat`'s
`initialMessages` rebuild, then the browser display cache
(`sanitizeChatMessagesForCache`). So a persisted citation list does not
come back after a reload yet; objectstack-ai#37487 carries it. Nothing on `main` emits
the part before cloud 10c. The changeset and both doc pages say so: the
console draws a verified citations part when a live answer carries one.
- Clause-②: yes because a new console URL parameter is reserved.
`onOpenRecord`'s argument gains an optional member (widening). No spec
file changed.

## Verification

- Browser: **NOT MEASURED** here. The seat carries it on objectstack-ai#37487's
acceptance: scroll under the sticky chrome, ring visibility, the lazy
face against the 4 s settle, the phone row, and `html`/`richtext`
bodies. In its place, `RecordDetailView.citedSection-37365.test.tsx`
renders the real record page with the real markdown face.
- Two-minute check: in the console, ask the assistant something an
answer with a `data-record-citations` part covers (cloud 10c). Click a
chip. Expected: the address is `/apps/APP/OBJ/record/ID?section=ANCHOR`,
the cited heading is scrolled into view with the accent ring, and an
edited-away heading opens the record at its top.

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

<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6CbeF2saT6wUBV4E9uc -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…uled; three smaller corrections (objectstack-ai#37518)

<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgNFUifusaHW7HJRgpb8tzNW)_

repo:objectstack#5 · os-bill · session_01Utp6CYNbcRTbq4QAT4wBXW

Fixes objectstack-ai#37514

Clause-②: no
Metadata-protocol: none
Container & model: `S`, `mode:thread`, `model: CONTRACT_REVIEW_TIER
(mandatory for docs/adr/**; served at tier, read from the thread's
session record)`, `effort: xhigh (ADR amendment, standing order)`

## 维护者速读

- 用户能看到什么变化:没有。只改架构记录 ADR-0084 的 9 行文字,不改任何决定。
- 为什么做:上一个 PR objectstack-ai#37470 的合同级审查提了几处小问题。当时它已在合并队列,没有再往里推,所以另开这个小 PR
补上。最要紧的一处:裁决 3 里「把散落项移进软件包时,按整组判定是否跨边界」那一句漏写了,第四阶段照记录拆卡会漏掉这条规则。
- 出错会怎样:不改代码,不改发布包。
- 要你做什么:批准合入(受管文件,需要 os-zhuang 和 hotlong 批准)。没有需要你裁定的问题。

## What changes

One file, text only:
`docs/adr/0084-application-builder-information-architecture.md`, +9 / −8
against `main` at `0b1411d4`. No decision changes. Each line answers a
nit of the contract record on PR objectstack-ai#37470 (comment 7188270415), which
passed that PR with the nits open; the seat's L1 accepted them as
deviations to carry to a follow-up (comment 7188379901).

| Nit | What the text now says | Its source |
|---|---|---|
| N3 | "Organization-level content": the door that moves loose items
into a package runs each through the judges a save runs, **judging the
selection as a set for the cross-boundary rule of ADR-0150 D3 (a)**. The
clause had been dropped. `Refs:` gains ADR-0150 D3. | Ruling record
7184753035 on objectstack-ai#37424, question 3 |
| N4 | `form` is "a type not yet registered" (was "registered after this
ruling"), and "the card that is to register the type" (was "that
registers"). | The registry at `0b1411d4` holds no `form` row; PR objectstack-ai#37422
is an open draft |
| N5 | "Decided by": the list of the epic's decisions that a ruling of
the day changes gains decision 1's line that revises ADR-0146's split. |
Epic objectstack-ai#37424's body, decision 1; ruling record 7187264388 on objectstack-ai#37451,
question 1 |
| N2 | Three sentences the 2026-11-26 amendment narrows now carry their
mark: the 2026-11-24 note at the top ("the development surface of one
app"); the `datasource` example in the 2026-11-24 "What stands" row; the
same example in item 2 of that day's list. | The amendment's own line:
"each sentence this replaces or narrows is marked where it stands" |

**Not in scope**, as the card says: N1 (item 11, where `form` sits among
the common types; named to the maintainer at the hand-off of objectstack-ai#37470, no
change owed), N6 (still true), N7 (ADR-0159 D10, carried on objectstack-ai#37087).

**Not touched:** the rows of the type → group table, which
`studioMenuPlacement.test.ts` pins; ADR-0146.

**The maintainer sources**: none new. This PR restores and corrects text
that carries rulings already recorded: 7184753035 on objectstack-ai#37424 (questions 2
and 3), and 7185703578 and 7187264388 on objectstack-ai#37451. It adds no quotation;
the one quotation on a changed line is already on `main`.

**Read first**: the N3 line against the ruling record's sentence, "runs
each item through the save door's judges, judging the selection as a set
for the ADR-0150 D3 (a) cross-boundary rule".

**Two-minute verification**: `cd ui && pnpm exec vitest run
--maxWorkers=2
packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts`
→ `Tests 12 passed (12)`. It reads ADR-0084 and proves the table pin
still holds.

## Tests

n/a — `docs/adr/**` text. The one test that reads ADR-0084 was run and
passes (above).

## Acceptance notes

- **The card's acceptance, line by line.** The delta the card lists and
nothing else: one file, +9 / −8. The pin test stays 12 of 12, and the
diff adds no line of the type → group row shape. Derived gates exit 0
(below). Tier H hand-off: the area sends the green head to the seat.
- **Why a second PR.** The fix was ready before PR objectstack-ai#37470 merged. An
approver had already put that PR in the merge queue, and a push would
have thrown it out of the queue and off the reviewed head. The commit
here is the one prepared then, replayed on `main` after the merge.
- **The claim was written by this thread**, as the area asked (comment
7188999386 on objectstack-ai#37514). `Blocked-by: objectstack-ai#37451` was cleared by the merge,
and the claim took `pm:blocked` off in the same write.
- **Tier H by path.** `docs/adr/**` (AGENTS.md Prime Directive objectstack-ai#14):
approvers os-zhuang and hotlong, and the maintainer merges. The PR stays
a draft. The `Rule-change` line is left out, as the template asks for a
diff that does not touch `.claude/**`.
- **No changeset.** `docs/adr/**` is not published; `skip-changeset` is
declared with the create.

## Verification

- Gate list derived on the head `6c0f3f2f`: `node
scripts/pm/dispatch-gates.mjs --commands` → 21 commands (1 path against
merge base `0b1411d4`).
- All 21 exited 0 on `6c0f3f2f`, each exit code captured before any
pipe.
- `--ran` reconciliation on `6c0f3f2f`: `21 derived famil(ies) accounted
for — 21 run, 0 NOT-MEASURED (a DERIVED zero — all 21 recorded an exit
code and none of them is 3)`.
- One commit. Its message names no card.
- The table pin: `studioMenuPlacement.test.ts`, 12 of 12 passed on
`6c0f3f2f`, under the verify lock.
- `overlap-check.mjs` on `6c0f3f2f`: clean against `origin/main`
`0b1411d4` and 0 PR heads. No open PR names ADR-0084 in its title or the
file in its body.
- `dispatch-gates --tier`: `docs/adr/**` is the mandatory contract tier;
changed lines 17 against the human-merge threshold 3000: under.
- `check-prior-rulings --paths` on the file at `0b1411d4`: the
2026-11-24, 2026-11-25 and 2026-11-26 amendments are the rulings in
force; this PR changes no decision of any of them.
- CI-owned families (type-check lanes, artifact rosters, `test:repo`,
the always-runs tail) are this PR's check-runs.

```text
Local gates (21, each exit 0)
node scripts/check-adr-links.mjs [+ --self-test]
node scripts/check-closing-keyword-parity.mjs [+ --self-test]
node scripts/check-comment-mask-corpus.mjs
node scripts/ci/plan-test-core-shards.mjs --self-test
pnpm --filter @objectstack/lint run check:doc-formula-expressions
pnpm check:adr-anchors · check:adr-index · check:adr-symbol-anchors
pnpm check:ci-filter-parity · check:closed-ceremony-text · check:cross-package-test-inputs
pnpm check:doc-authoring · check:driver-memory-census · check:gitlink-declared
pnpm check:nul-bytes · check:pm-governed-merges · check:pm-prior-rulings
pnpm check:refd-timer-probe · check:watch-hint-literal
```

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

https://claude.ai/code/session_01Utp6CYNbcRTbq4QAT4wBXW

<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6CYNbcRTbq4QAT4wBXW -->

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…writes keep it (uiReadonly / uiReadonlyWhen) (objectstack-ai#37436)

<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg8ZBQe4UHadd2fGHGeWRW9V)_

repo:objectstack#5 · os-bill · session_01Utp6CbdHk3orAeensH6EzS

Fixes objectstack-ai#36806

Clause-②: yes
Metadata-protocol: added
Skills-docs: follow-up objectstack-ai#37405

## 维护者速读

- 字段新增 `uiReadonly` / `uiReadonlyWhen`:控制台所有手工编辑面锁住该字段,动作、导入、API、流程照常写入。
- 写入仍由对象校验裁决(如 state_machine),引擎不读这两个键;`uiReadonly` 与 `readonly` 同为 true
时被拒。
- 控制台统一走 `@object-ui/core` 的 `fieldReadOnlyByHand`;看板顺带修好:`readonly`
分组字段此前可拖动且写入被静默丢弃。
- MCP describe_object 把两个键单列上报;导入映射与 Studio 读取保持原样。
- 返工(席位 L1 7183712080):`uiReadonlyWhen` 求值失败即锁定、编辑表单拒绝提交,`os validate`
检查该槽;表格与列表视图取回锁谓词的操作数;描述只列出已生效的界面(其余见 objectstack-ai#37448)。

## What changes

Ruling 7180466652 (scope items 1–6), surface per claim 7180490513 and
amends 7180683371, 7181406682, amend 3 and 7182190475.

**Spec (`packages/spec`)**
- `Field.uiReadonly: boolean` and `Field.uiReadonlyWhen` (CEL, the same
scope as `readonlyWhen`), both optional with no default (absent =
unlocked, so no parsed field grows a key), with describes and TSDoc.
- The field `superRefine` refuses `uiReadonly: true` beside `readonly:
true` at `['uiReadonly']` (every door that parses a field).
`uiReadonlyWhen` beside `readonlyWhen` is accepted.
- `deriveInlineGridColumns` skips a `uiReadonly` child field, as it
skips `readonly`.
- Liveness rows `uiReadonly` / `uiReadonlyWhen` (live); regenerated
reference docs, authorable-surface record and state counts.
- Studio field form (`field.form.ts`) offers both rows beside `readonly`
/ `readonlyWhen` (`uiReadonlyWhen` as a CEL code row). The label and
help text of each are translated in all 11 metadata-forms locale packs
(`packages/platform-objects`, the generator re-run after the leaf
values, so no fill hash is left); the translated-leaf count pin moves
837 → 839.

**Console (`ui/packages/**`)**
- `@object-ui/core`: `fieldReadOnlyByHand(def, record?, ctx?)`,
`fieldStaticallyReadOnlyByHand(def)`, `fieldHasConditionalHandLock(def)`
(new `evaluator/handLock.ts`). `resolveFieldRuleState` takes
`uiReadonlyWhen` (rules) and `uiReadonly` (statics) into its `readonly`
verdict; a faulted `uiReadonlyWhen` fails CLOSED (no server judges it),
unlike `readonlyWhen`.
- Hand surfaces swapped to the helper: create/edit dialogs
(`filterSystemFields`, `filterCreateModeFields`, `disabled`) and the
submitted payload (`sanitize.ts`); form renderer and wizard pass
`uiReadonlyWhen`; record page inline edit (`DetailSection`,
`InlineEditSaveBar`, `RecordDetailPanel`, stage path), highlight-strip
chip (`HeaderHighlight`), related list; grid inline edit
(`fieldInlineReadOnlyKind`, `cellReadOnlyKind` now judges the row, which
the data table's paste and multi-row staging read) and the required
prompt; kanban drag (`cardsMovable` and a refused `handleCardMove`);
calendar drag (`onEventDrop`, `endEditable`, and the drop handler over
the record); line-item grid (`deriveMasterDetail` carries
`uiReadonlyWhen` onto the column; `GridFieldWidget` folds it per row);
edit-form state lock (`editFormLockedByState`).
- Stays on raw `readonly`: import mapping (`importTargetFields.ts`),
Studio/designer reads, calendar quick-create's required exemption (it
mirrors the engine insert).

**Server**
- Engine untouched (`packages/objectql/**`): the strip keys on
`readonly` alone, so REST, import, actions and flows write a hand-locked
field and the object's validations judge each write.
- MCP `describe_object` reports `uiReadonly` / `uiReadonlyWhen` as their
own keys where set, on HTTP (`runtime/domains/mcp.ts`) and stdio
(`mcp/mcp-server-runtime.ts`); the tool description names them
(`mcp-http-tools.ts`).
- FieldSchema key censuses classify both keys: `driver-sql` storage
class (presentation), `metadata-core` FLS reference positions
(`uiReadonly: keep`, `uiReadonlyWhen: expression`), `/meta/types` field
count 87 → 89.

## Review rework (L1 7183712080, contract record 7183704697)

- **S1** Every surface passes the host predicate scope
(`usePredicateScope`) to `fieldReadOnlyByHand`: grid cell, record page
(inline edit, highlight chip, save bar, stage path), kanban drop,
calendar drop. The grid's own row load (`objectGridRowLoad.ts`) and
`ListView`'s `$select` fetch the operands of the `readonlyWhen` /
`uiReadonlyWhen` of every shown column, the kanban lane field and the
calendar start / end fields, through the same FLS and declared-field
gates as the other harvests.
- **S2** A `uiReadonlyWhen` that cannot be evaluated (a parse error, an
operand the row lacks, an unbound root) fails CLOSED
(`UI_READONLY_WHEN_FAULTED`): no server judges the hand lock, so the
field locks. The edit form refuses to submit and names the field and the
rule (`form.uiReadonlyWhenFaulted`, all 11 ui locales). `os validate`
checks the slot as it checks `readonlyWhen` (`validate-expressions.ts`:
the record-scoped check plus the field-rule root verdict, with its own
consequence clause).
- **S3(a)** `hydrateColumns` carries the child field's `uiReadonly` /
`uiReadonlyWhen` onto an authored line-item column, typed or not;
`GridFieldWidget` locks a `uiReadonly` column on every row. Gantt,
timesheet, swimlane, the assistant and N3 `palettePrefillField` are
objectstack-ai#37448.
- **S4** `uiReadonlyWhen` is judged on an existing record only: the
describe, the liveness note and the Studio help say so (help
retranslated in 10 locales, generator re-run, no fill hash).
- **Narrowing, N2** Both describes and the `describe_object` text name
the surfaces that honour the keys; `uiReadonly`'s describe says a
`required` field without `defaultValue` fails every console create.
- **N1** Changeset lines for `metadata-core`, `platform-objects`,
`lint`, `plugin-list`, `i18n`.

## Delta rework (contract 7186595753, L1 7186604968)

- **S5** The line-item grid judges `uiReadonlyWhen` on a stored line
only (`rowHasId`): a new line is not judged, as the create dialog does
not judge it. `ObjectGrid` has no inline add-record row (`addRecordForm`
opens the create dialog), so no second site exists.
- **S6** The FLS reference scrub (`metadata-core`) deletes a
`uiReadonlyWhen` that reads a field denied to the caller and now serves
the field `uiReadonly: true` in its place (unless it is already
`readonly`), so the lock never opens for that caller. The `ListView.tsx`
comment says so.
- **N4** This body's Console bullet now says fail-closed. **N6** The
form's hand-lock fault check short-circuits on `readonlyWhen` on both
evaluation paths. **N5** (detected kanban lane field) is carried on
objectstack-ai#37448.

## Main merge and queue fix

- `3eb2bcf8` merges main after objectstack-ai#37449 landed and keeps both
`...lockOperandFields` and `...quantityUnitFields` in `extraFields`.
`73681b48` regenerates `object.mdx` from the merged tree.
- `30090e73` adds the expression-conformance ledger row
`cel-field-ui-readonly-when` for
`data/field.zod.ts:FieldSchema.uiReadonlyWhen`
(`packages/qa/dogfood/test/expression-conformance.ledger.ts`: cel,
interpret, enforced, fail-closed, UI only, proof
`handLock-36806.test.ts`). The row was added after a merge-queue dequeue
(run 45802787226), because PR-side CI does not run
`packages/qa/dogfood/test/expression-conformance.test.ts`. That test now
passes 8 of 8 locally.

## Tests

- `packages/spec/src/data/field-ui-readonly.test.ts`: parse and absence,
the refusal (code `custom`, path, message) at the field and object
doors, controls, line-item column skip.
- `packages/qa/dogfood/test/ui-readonly-hand-lock-36806.dogfood.test.ts`
(booted stack, HTTP): a PATCH to the `uiReadonly` field lands with no
`X-ObjectStack-Dropped-Fields` (control: the `readonly` sibling is
stripped and advertised); the `state_machine` refuses an illegal move
with status 400, code `VALIDATION_FAILED` and its own message on the
PATCH, action and import doors; a create without the field lands on
`defaultValue`; an API create outside `initialStates` is refused by the
machine.
- `packages/runtime/src/domains/mcp-object-hand-lock-36806.test.ts` and
a block in `packages/mcp/src/__tests__/mcp-server-runtime.test.ts`: both
keys reported only where set, never folded into `readonly`.
- UI pins, each surface locked:
`core/evaluator/__tests__/handLock-36806.test.ts`,
`plugin-form/__tests__/dialogHandLock-36806.test.ts`,
`plugin-detail/__tests__/DetailSection.doubleClickEdit.test.tsx`
(hand-lock block),
`plugin-grid/objectGridCellFacts.handLock-36806.test.ts`,
`plugin-kanban/ObjectKanban.handLock-36806.test.tsx`,
`plugin-calendar/__tests__/ObjectCalendar.handLock-36806.test.tsx`,
`fields/widgets/GridField.handLock-36806.test.tsx`,
`plugin-form/deriveMasterDetail.test.ts` (line-item block); `types`
FormField coverage list gains `uiReadonlyWhen`.

## Acceptance notes

- Kanban side fix: the board read no field lock before, so a card
grouped by a `readonly` field was draggable and its PATCH was silently
stripped. Both locks now stop the drag.
- `uiReadonly` is `.optional()`, not `.default(false)`: absent means
unlocked, and no parsed field or snapshot grows a key.
- Overlaps objectstack-ai#37422 in object-lifecycle-panel-echo-decisions.test.ts count
pins (837 → 839 here); whichever lands second merges main and re-adds
its delta.
- objectstack-ai#37449: one-line union in objectGridRowLoad.ts `extraFields`; resolved
in the main merge `3eb2bcf8`, keeping both.
- Not in this PR: Gantt drag and in-place edit, the timesheet cell,
kanban swimlane drag, the assistant acting for a person, and
`palettePrefillField` (objectstack-ai#37448); skills pages (objectstack-ai#37405).
- No console screenshots: no example app declares either key, and adding
one is outside the claim's surface; the surface behaviour is pinned by
the UI tests above and ablated.

## Verification

Local, per os-dev local verification scope (CI runs the full farm):

- Pins: all new tests pass (spec 5, dogfood 6, runtime MCP 3, mcp stdio
block, core 6, dialogs 2, record page 2, grid 4, kanban 4, calendar 5,
line-item grid 2 + 1).
- Package suites: spec 28,424 passed after the form rows (the one red
before them was the form reconciliation pin, fixed by offering the
rows); runtime 12,030; mcp 1,512; driver-sql 4,551; metadata-core 1,061;
metadata-protocol 23,435; platform-objects 2,161; ui core 4,797, types
10,512, fields 5,033. The remaining ui package suites are reported in
the final-head comment.
- Typechecks green: spec, runtime (incl. test typecheck), mcp, dogfood,
metadata-core, driver-sql, and `type-check` in 10 ui packages.
- Ablations (each mutation proven on disk, restored, tree clean):
- UI read-only pin: `fieldStaticallyReadOnlyByHand` without `uiReadonly`
→ 8 pins red across kanban, calendar, record page, dialogs and grid.
- Write-keeps pin: the engine strip (`rule-validator.ts`) also stripping
`uiReadonly`, built to dist (marker in 4 files) → 4 dogfood pins red
(PATCH, the machine's refusal on PATCH, action and import); restored,
rebuilt, marker absent.
- `dispatch-gates --commands`: 124 derived commands run. Reds not from
this diff: `check-plugin-teardown-shape --self-test` (shallow clone
cannot reach its pinned fixture commit), `check:platform-checklist`
(ABSENT SYMBOL `FlowItemMoreMenu` in areas/automation.json; neither file
is in this diff), `check:dual-build-cjs-loads` (prerequisite: unbuilt
packages, nothing measured).
- Rework (head 309363d): new pins core 4, grid cell 2 + harvest 4,
ListView 5, form refusal 4, line-item 2, lint 5. Suites green: ui core
4,800, i18n 2,028, components 4,996, fields 5,034, plugin-form 2,796,
plugin-grid 2,800, plugin-list 2,075, plugin-detail 3,970, plugin-kanban
585, plugin-calendar 515; lint 9,634; spec data 6,865; mcp 1,512;
platform-objects translations 610. `type-check` green in 9 ui packages
and lint; `check:generated --fix` re-checked clean.
- Rework ablations (each mutation landed on disk and was restored):
fail-open fault → 6 pins red (core, grid, form); grid harvest dropped →
harvest pins red; ListView harvest emptied → 3 red; form refusal off → 2
red; `withHandLock` static half off → 1 red; GridField static read off →
1 red; lint slot dropped → 4 red.
- Delta rework (S5, S6, N6): pins GridField new line, FLS scrub ×3, form
readonlyWhen short-circuit; ablations: each mutation turns its pin red
(S5 1, S6 1, N6 1), restored. metadata-core 1,064, fields 5,035,
plugin-form 2,796, components form 643 green; typechecks green.
- overlap-check: clean against main and every open PR except the objectstack-ai#37422
count pin and the objectstack-ai#37449 union line above.

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

https://claude.ai/code/session_01Utp6CXSuJCALDHFWaV6Bv5

<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6CbdHk3orAeensH6EzS -->

---------

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

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuBUGgrNWoBUQKbyS4GaX5vM)_

Fixes objectstack-ai#36828

Clause-②: no (published prose only; names a list the read already
returns on main)
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:AI
助手照平台技能文档回答「我们在已安装的应用包上改了什么」时,现在知道答案里还有一份「整体编排」清单(字段分组、记录页标签页、操作布局),以前文档没提这份清单。
- 为什么做:属于「定制已安装应用包」专题的收尾。产品已经返回这份清单,说明文档也已更新,只有技能文档还停在旧说法。
- 出错会怎样:只改文档文字,不动产品。写错的话助手会漏读或误读这份清单,撤回这次改动即可。为了不让技能文档变长,同一文件里删了四处重复说法。
- 要你做什么:这是受管的技能文件,需要审批人批准后才能合并。

## What changes

`skills/objectstack-platform/SKILL.md`, the sentence that teaches `GET
/packages/hotcrm/customizations` (line 129), plus a `patch` changeset
for `@objectstack/skills`.

Before: "lists its overrides, extensions and switched-off items".

After: "lists its overrides, extensions, switched-off items and
`arrangements` (`{ object, key }` per `fieldGroups`, `relatedLists` or
`actionLayout` its object extension writes; no content, no diff)".

No paragraph is added. The file had 3 bytes of token headroom and the
new words cost 137 bytes, so four restatements in the same file are cut
to pay for them (136 bytes). Each fact keeps another home:

| Cut | Bytes | Where the fact still stands |
|:--|--:|:--|
| "— `createHonoApp({ kernel })` reaches better-auth at
`/api/v1/auth/*`" (HTTP Layer warning) | 71 | the same sentence:
"(`AuthPlugin` default `/api/v1/auth`)" |
| "with `create-objectstack`" in "Bundled with `create-objectstack` — no
network fetch" (The Template) | 25 | the line above: "the only template
`create-objectstack` offers" |
| ", and it is the default" (The Template) | 23 | the same sentence
("the only template") and `references/bootstrap.md` ("blank is the
default, and the only, template") |
| ", after AuthPlugin" on the platform-app plugins row (Runtime Boot
Sequence) | 17 | the list is headed "in this order" and the row sits
directly under `AuthPlugin` |

The ceiling row in the token ratchet is not moved.

## Why

PR objectstack-ai#36818 added the `arrangements` list to this read and corrected the
`content/docs/api/metadata-api.mdx` copy; the skill copy still named
three lists. A tab list, field-group or action-layout arrangement made
in the paired customization package appears only in `arrangements`, so
an agent taught from the skill missed it.

Shape checked against `main` (1af67b2), not the card text:

- `packages/spec/src/api/package-lifecycle.zod.ts`,
`GetPackageCustomizationsResponseSchema.arrangements`: a strict `{
object, key }`, `key` = `z.enum(CUSTOM_ARRANGEMENT_KEYS)`; its describe
says the entry "names it and nothing more: its content is the pair's
`object_extension` item, and nothing is compared with the base".
- `packages/spec/src/data/field-customization.ts`:
`CUSTOM_ARRANGEMENT_KEYS` = `fieldGroups`, `relatedLists`,
`actionLayout`.
- `packages/runtime/src/domains/packages.ts`, the customizations read
producer: `arrangements.push({ object: name, key })` for each key the
pair's extension body writes, sorted by object, then key.
- `content/docs/api/metadata-api.mdx`: "one `{ object, key }` entry per
object and key".

## Tests

Prose only: no behaviour a test pins changes, so no ablation. Skills
checks run on head `e00556f59b`:

<details><summary>Gate readings</summary>

- `node scripts/check-skills-token-ratchet.mjs` :: exit 0.
"skills/objectstack-platform/SKILL.md is 6148 tokens (ceiling 6149;
headroom 1)"; "61 authored bundle file(s) within their ceilings".
- `pnpm check:pm-skill-id-lint`, `check:skill-identifier-liveness`,
`check:skill-links`, `check:skill-top-level-keys`,
`check:skill-compatibility`, `check:skill-frame-sync`,
`check:doc-authoring`, `check:nul-bytes` :: exit 0 each.
- `pnpm --filter @objectstack/spec run check:skill-docs` :: exit 0
("Skill docs in sync"); `check:skill-refs` :: exit 0 ("10 generated
files in sync with packages/spec"), both after `pnpm --filter
@objectstack/spec build`.
- `node scripts/pm/dispatch-gates.mjs --commands` derives 50 commands
for this diff; reconciliation with `--ran`: 48 run with exit 0, 2 NOT
MEASURED (`check:dual-build-cjs-loads`, `check:lean-entry-closure`: they
need a whole-tree build and read no file of this diff; CI runs them).
- `node scripts/pm/overlap-check.mjs` :: "VERDICT clean exit 0".

</details>

Size readings for `skills/**` (lines / bytes, `wc`; tokens in the
ratchet's own convention):

| | Before (1af67b2) | After |
|:--|--:|--:|
| `skills/objectstack-platform/SKILL.md` | 422 lines / 24613 bytes /
6149 tokens | 421 lines / 24611 bytes / 6148 tokens |
| All 14 `skills/*/SKILL.md` together | 4961 lines / 261866 bytes | 4960
lines / 261864 bytes |

## Acceptance notes

- The four cuts sit outside the sentence the card names. They are the
only way to keep the token ratchet green without moving its ceiling;
each is listed above with the place its fact still stands.
- Open PRs objectstack-ai#37442, objectstack-ai#37422 and objectstack-ai#35129 also change
`skills/objectstack-platform/SKILL.md`. All three text-merge cleanly
with this branch, but the file is left with 1 token of headroom, so
whichever lands second re-measures against the ratchet.
- The skill sentence does not name `counts.arrangements`; the card asks
for the list only.

## Verification

Read first, by risk:

1. `skills/objectstack-platform/SKILL.md` line 129: the new clause.
2. The same file, HTTP Layer warning: the cut after "not `prefix`".
3. The same file, The Template and the boot-sequence row: the three
small cuts.

Two-minute check: `node scripts/check-skills-token-ratchet.mjs` prints
"skills/objectstack-platform/SKILL.md is 6148 tokens (ceiling 6149;
headroom 1)" and exits 0; `git grep -n "arrangements" --
skills/objectstack-platform/SKILL.md` prints one hit on line 129.

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` is CI's 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: not touched.
- [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.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

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

https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
… regions, parse prerelease versions in the MCP save test, key the objectui pin claim on the spec major (objectstack-ai#37557)

Fixes objectstack-ai#37549

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用户无感:发版流程里,版本号升到 19 之后,有三处会红,这里一起修掉:迁移登记表的生成不会再拒收第 19 版的下线条目;MCP
保存草稿的一条测试不再把预发布版本号(19.0.0-next.0)读坏;界面仓的版本说法检查不再写死 18。"版本发布"那个 PR
的核心测试和界面测试可以变绿。
- 为什么做:给发第一个 19 预发布版(next 渠道)清掉阻断。版本 PR 的必过检查一直是红的,现在没法合并。
- 出错会怎样:只给模板加了两个空区段,另外改了三份测试;不改任何已发布行为。出问题直接撤回这个 PR 即可。
- 要你做什么:无。

## What changes

- `packages/spec/src/migrations/registry.ts.template`: opens an empty
`retired-key:19` region in `RETIRED_KEYS_BY_MAJOR` and an empty
`retired-def:19` region in `RETIRED_DEFS_BY_MAJOR`, each placed and
shaped like its major-18 sibling. `semantic:19` and `step19` already
existed, so the migration-step side needed nothing.
- `retired-def:19` goes beyond the card's wording, as an in-place fix of
the same defect class. `build-schemas.ts` prescribes new retired-def
entry files under the same `CURRENT_MAJOR` (`renderNewEntryFiles`, used
for both kinds). So the first whole-def removal on the 19 tree would
have hit the same generator refusal. Same file, same gate family, same
mechanical fix.
- `scripts/build-migration-registry.ts` needs no change. Its lines
~422–441 are `--self-test` fixtures, not a region list: the generator
discovers regions from the template's markers.
- Pin (`packages/spec/scripts/build-migration-registry-entry.test.ts`,
new `describe`): every kind in `KINDS` has an open and close marker in
the template for each of two majors, the spec package's major (what
`build-schemas.ts` registers new entries under) and `PROTOCOL_MAJOR`. On
`main` today these are 18 and 19, so the pin reds on `main` before the
fix and names the missing region and the major.
- Why `PROTOCOL_MAJOR` and not "spec major + 1": the protocol major
moves first, on `main` (it reads 19 while the package is still 18.6.0).
It is the leading signal for the next major.
- "spec major + 1" would also red the Version PR tree itself (19 + 1 =
20), unless a major-20 region were opened now.
- Item 2 (seat-amended scope, card objectstack-ai#37549):
`packages/runtime/src/domains/mcp-authoring.test.ts`. The `[objectstack-ai#34774]`
describe parsed `SERVER` with `split('.')`, so on the Version PR tree
(`19.0.0-next.0`) the patch field was `0-next` and the built version was
`19.0.NaN`, which the door refuses as not SemVer. It now parses with
`SEMVER_2_0_0_VERSION_PATTERN` from `@objectstack/spec/kernel`, the
grammar the door itself judges with, and drops the prerelease from the
versions it builds. A new case declares the server's own version
verbatim and `${major}.${minor}.0-next.0`, and asserts both save
byte-identically to no declaration. Test-only; `@objectstack/runtime`
ships `dist` alone, so no runtime changeset is owed.
- Item 3 (seat-amended scope):
`ui/scripts/__tests__/doc-version-claims.test.ts`. The
`skills/objectui/SKILL.md` KNOWN_CLAIMS row was the literal
`@objectstack/spec 18.x`. It is now keyed on `SPEC_MAJOR`, read from
`packages/spec/package.json` under `workspaceRoot()`. The literal in the
skill can't go, because the root `check-skill-compatibility-version.mjs`
requires the pin and rewrites it with the version step. So `skills/**`
is not touched, and the PR stays off Tier H.
- Changeset `.changeset/37549-retired-key-19-region.md` (patch; the
template renders into the shipped `registry.ts`).

## Tests

<details><summary>Pin reds on the pre-fix template (origin/main 1af67b2
template restored, then put back)</summary>

```
× opens and closes `retired-key:19`
× opens and closes `retired-def:19`
AssertionError: src/migrations/registry.ts.template has no `os-generated retired-key:19` region, but major 19 is current (spec package 18.6.0, PROTOCOL_VERSION major 19); an entry registered there is refused by gen:migration-registry. ...
Tests  2 failed | 8 passed (10)
os-verify-lock: VERDICT command-exit 1
```
</details>

<details><summary>Version tree: spec temporarily at 19.0.0-next.0 (not
committed)</summary>

`pnpm gen:migration-registry && pnpm exec vitest run --maxWorkers=2
scripts/build-migration-registry-entry.test.ts
scripts/build-schemas-check-mode.retired-keys.test.ts` (both projects),
with `packages/spec/package.json` version set to `19.0.0-next.0`. The
run includes "the printed route registers: write exactly the files check
(b) names, run the generator, and (b) is silent", the case that fails on
objectstack-ai#35129.

```
Test Files  2 passed (2)
     Tests  20 passed (20)
os-verify-lock: VERDICT command-exit 0
```

The version was restored to `18.6.0` afterwards; `git status` was clean
apart from the intended diff.
</details>

<details><summary>18.6.0 tree: same two files</summary>

```
Test Files  2 passed (2)
     Tests  23 passed (23)
os-verify-lock: VERDICT command-exit 0
```
</details>

<details><summary>Items 2 and 3 on the Version tree (spec at
19.0.0-next.0 and the objectui skill pin at 19.x, both temporary,
restored after)</summary>

```
runtime mcp-authoring.test.ts      Tests 57 passed (57)
ui doc-version-claims.test.ts      Tests 29 passed (29)
```

Ablation on the same tree with the origin/main 1af67b2 versions of the
two tests: runtime `1 failed | 55 passed` (the `SemVer form (e.g.
18.6.0)` case), ui 2 failed (`skills/objectui/SKILL.md ::
@objectstack/spec 18.x`), matching objectstack-ai#35129's CI failures. On the 18.6.0
tree: runtime 57/57, ui 29/29. `ui` `scripts/` suite at the final head:
`172 passed | 2 skipped` files, `5130 passed` tests.
</details>

<details><summary>Spec package, local project, at 2fd0411: `pnpm
--filter @objectstack/spec test` and `pnpm typecheck`</summary>

```
Test Files  899 passed (899)
     Tests  28505 passed | 1 todo (28506)
os-verify-lock: VERDICT command-exit 0
typecheck (tsc + check:scripts-typecheck + check:test-typecheck): VERDICT command-exit 0
```

`test:repo` (the vitest `repo` project) belongs to CI's Test Core. Only
its one touched-path file,
`build-schemas-check-mode.retired-keys.test.ts`, was run locally
(above).
</details>

## Acceptance notes

- In-flight spec PRs objectstack-ai#37366, objectstack-ai#37371 and objectstack-ai#37422: `node
scripts/pm/overlap-check.mjs --pr=37366,37371,37422` gives `VERDICT
clean exit 0`. Their migration changes are major-18 semantic entry files
only, and none touches the template.
- L2: the template is the generator's skeleton for a gitignored
generated file. The two regions are empty, so no exported value or key
changes shape: `RETIRED_KEYS_BY_MAJOR[19]` / `RETIRED_DEFS_BY_MAJOR[19]`
become empty arrays.

Body amended by the seat (repo:objectstack#2 · os-sales ·
session_01L6bhgV6i8jfWwSXjpWJrjA) to cover the three items the card's
scope grew to; the dev report on objectstack-ai#37549 (7194227076) carries the full
evidence.

## Verification

Two-minute check: `pnpm --filter @objectstack/spec exec vitest run
--project local --maxWorkers=2
scripts/build-migration-registry-entry.test.ts`, expected to show `Tests
10 passed (10)`. Then set the spec version to `19.0.0-next.0` and run
`scripts/build-schemas-check-mode.retired-keys.test.ts`, which should
also be green.

Read first: (1) the two new template regions; (2) the pin's choice of
majors (spec package major and `PROTOCOL_MAJOR`).

Local gate subset at 2fd0411: derived by `node
scripts/pm/dispatch-gates.mjs --commands`. Verdicts are in the dev
report on the card. `check:doc-formula-expressions` is NOT MEASURED
locally (PREREQUISITE NOT MET: `@objectstack/formula` and
`@objectstack/lint` are not built in this worktree); CI runs it. The
full farm belongs to CI.

---

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

<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgV6i8jfWwSXjpWJrjA -->

---------

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

Part of objectstack-ai#35143

Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up objectstack-ai#37529

## 维护者速读

-
搭应用的人在发布对象和本地校验时,会被拦下两类“保存成功却不工作”的字段(汇总字段的子对象没有指回父对象、给不能关联记录的字段填了关联目标),另有两类只提醒不拦截。
- 属于“发布期作者规则第二批”中的数据模型一族,替搭应用的人在保存时就发现汇总永远是 0、记录选择器把编号写进文本字段这类问题。
- 已经存好的对象不会被改写也不会在启动时被拒,只是下次发布被拦并给出改法;误拦时撤回这次合并即可恢复。
- 无

## What changes

The Data model family of the card's second batch of publish-time checks,
five lines, each verified on `origin/main` first.

| Line | Verdict on main | This PR |
|---|---|---|
| D1 lookup named like a count or total | holds, no rule | new warning
`field/count-named-lookup` |
| D2 formula reading an unconfigured summary | **already covered** —
`field/summary-without-operations` refuses the summary itself | no rule;
a coverage pin at the runtime gate |
| D3 summary whose child has no reference back | holds, no rule | new
error `rollup/child-without-parent-reference`, added to the existing
`lintSummaryRollups` |
| D4 `reference` on a type that reads none | holds, no rule | new error
`field/reference-on-non-reference-type` |
| D5 approval detail editable while pending | holds, no rule | new
warning `approval-detail-editable-while-pending`, added to the existing
`validateApprovalApprovers` |

- **D3** follows the engine's summary index (`buildSummaryIndex`). It
reads `summaryOperations.relationshipField` when that is set. Otherwise
it looks for the first `master_detail` / `lookup` on the child that
references the parent. When the index finds no foreign key, the summary
is skipped with nothing logged, so the field reads 0 or empty while
every child write reports success.
- The check counts the child's fields as served, including fields added
by an object extension. It also counts the injected columns (`owner_id`,
`created_by` and `updated_by` back to `sys_user`, plus the tenancy
lookups).
  - A child the stack does not hold is not judged.
- The finding is reported beside the existing aggregand arms, not
instead of them.
- **D4** fires when a non-blank `reference` sits on any type outside
`REFERENCE_VALUE_TYPES` plus `summary`. `summary` is exempt because the
hosted blueprint reads `summary` + `reference`.
  - It runs on objects and on object extensions.
- The record page's inline editor sends any field with a `reference` to
the record picker, except the textual fallback types. For text, number
and date fields the message therefore names the record-id write; a
select and the other types the inline editor routes first are told only
that the key links nothing.
- **D1** and **D4** sit in one new gating entry,
`lintFieldReferenceShapes`, which runs on both the `object` and the
`object_extension` door. D1 is a warning, so it comes back as a 2xx
advisory.
- **D5**: an approval node with `lockRecord` not set to `false` makes
the rule look at the flow's start object. If that object has a
non-multiple `lookup` child drawn as a body table (`relatedList:
'primary'`, read through `isBodyTableRelationship`), the rule warns once
per flow. The approval lock covers `master_detail` children only.
- **Export surface:** no new exports and no new catalogs. The new rule
ids are module-local, which matches the Flows precedent's r2 PASS. The
authoring-rule count in four docs pages moves from 80 to 81.
- **Upgrade guide:** new ADR-0087 semantic entry
`publish-refuses-data-model-fields-that-save-and-do-not-work` in
`@objectstack/spec`. It is a notice only, because each fix is a choice
only the author can make.

## Tests

- `data-model-rules.field-reference-shapes.test.ts` (new) covers D4 and
D1:
  - both fire, and stay silent on legal shapes;
  - the object-extension location is reported;
- the runtime gate refuses D4 on `object` and on `object_extension`, and
returns D1 as an advisory.
- `data-model-rules.summary-rollup.test.ts` covers D3:
- fires on a child with no foreign key, and on a `relationshipField`
that names no field of the child;
- silent with `master_detail`, with `lookup`, with a `relationshipField`
that names a real child field, when the child is absent, for `sys_user`
via the injected column, and for a foreign key added by an extension on
the CLI;
  - the runtime gate refuses, and passes once fixed.
- `validate-functional-completeness.test.ts` covers D2: a bare summary
that a formula reads is refused at the gate as
`field/summary-without-operations`.
- `validate-approval-approvers.test.ts` covers D5:
  - warns on a primary lookup child;
- silent for a `master_detail` child, a non-body lookup and `lockRecord:
false`;
  - rides the flow door as an advisory.
- Door roster pins: `lintFieldReferenceShapes` is added to the exact
`rulesRun` lists in three runtime-gate test files.

## Acceptance notes

- **The Clause-② line differs from the dispatch order's literal
spelling.** The order asks for `Clause-②: no` together with
`Metadata-protocol: narrowed`. The changeset gate refuses `narrowed`
without the `(narrowing)` arm. Two of the checks refuse a publish that
used to be accepted, so the change narrows. This PR therefore carries
`Clause-②: no (narrowing)` and a `!` title, the same as the Flows
precedent.
- **D2 has no new rule.** On main, a summary with no `summaryOperations`
is already refused as itself, so the formula that reads it cannot
publish either. That is recorded and pinned.
- **D4 exempts `summary`,** because the hosted blueprint reads `summary`
+ `reference`. `formula` and `autonumber` still fire, but their message
drops the record-picker clause because they have no editor.
- **D1 and D5 are warnings.** They refuse nothing and make `os validate
--strict` exit 1, as any warning does. D1 rides the object door as a
gating-rule warning, so it comes back as an advisory, not a refusal.
- **Reading outside this card (R8 in `lintDataModel`).** R8 counts
`refOf(def)`, and the keys `optionsFrom` / `dataSource`, as select
option sources. Neither key exists in the spec. This is a carrier note
and is not filed.
- **Collision with objectstack-ai#37422.** That PR also bumps the authoring-rule count
in the same four docs pages, so they conflict textually. Whichever lands
second takes the higher count. `authoring-rules.ts` merges cleanly.
- **Skills-docs** follow-up is owed, as declared above.

## Verification

Two-minute check: `pnpm --filter @objectstack/lint exec vitest run
--maxWorkers=2 src/data-model-rules.field-reference-shapes.test.ts
src/data-model-rules.summary-rollup.test.ts`. Expect every case to pass.

Read first, by risk:
1. `packages/lint/src/data-model-rules.ts`, the D3 relation arm in
`summaryRollupFindings`. It must agree with the engine's foreign-key
choice, or it refuses roll-ups that compute.
2. `packages/lint/src/authoring-rules.ts`: the new entry's doors
(`object`, `object_extension`) and the served-fields map passed to the
roll-up check.
3. `packages/lint/src/validate-approval-approvers.ts`: the body-table
reading for D5.

Readings at final head ad43f0b: lint 237/237 files, 9682 tests (at
2740a17); app-shell narrowed set 221/221 files, 2429 tests (at
48d632c) plus the retype pin file at ad43f0b; dogfood battery 487
passed, 3 skipped files, 4129 passed, 68 skipped tests; CI 63 success,
11 skipped, 0 failed (after the body edit re-ran four jobs).

Follow-ups from the contract review nits: objectstack-ai#37577.

Also in this PR: 77ac3ce gives the objectql duplicatePackage roll-up
fixture's child a foreign key back to its parent (the new
rollup/child-without-parent-reference refusal turned that stale fixture
red); 48d632c and ad43f0b make the console field designer drop
reference on a retype to a type that reads none and strip a stored one
at its read door (contract review M1, under the seat's scope line
7190889569), with its own @object-ui/app-shell patch changeset.

<details><summary>Earlier local readings (head b26f2c1, tree identical
to the readings' tree 4e2ea58)</summary>

- `@objectstack/lint` full suite, under the lock: Test Files 237 passed
(237), Tests 9680 passed (9680), VERDICT command-exit 0.
- metadata-protocol battery, under the lock: Test Files 370 passed, 9
skipped (379); Tests 23440 passed, 45 skipped; VERDICT command-exit 0.
- New and changed lint test files: Test Files 7 passed (7), Tests 185
passed (185), VERDICT command-exit 0.
- `os validate` on app-crm, app-multi-package, app-showcase, app-starter
and app-todo: each "Validation passed", with zero findings from the four
new checks.
- The derived gate families (`dispatch-gates.mjs --commands`), the full
dogfood battery and the CI check-runs are read in the os-dev-report
comment on the card.

</details>

---

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

<!-- signed: repo:objectstack#6 · hotlong ·
session_01Q4EjjQkY5yXZrN9BEA3rEK -->

---------

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

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDqyPrPQvkURDXnUDgkyFWB)_

Part of objectstack-ai#36794 (PR-1 of 2: the spec reason and the importer; the Import
Wizard text follows in PR-2 on the same branch once this one lands)

Clause-②: yes (widening)
Metadata-protocol: added (`ValidateDataIssueSchema.scope`, a new
optional key on the import cell error; the new `FieldErrorCode` value is
a wire code, no author-writable key)
Skills-docs: follow-up objectstack-ai#37590

## 维护者速读

-
导入时,查找列填了一个只在别的父记录下存在的记录(例如合同属于另一个客户),服务端现在单独报“不在本行的范围内”,并把限定它的列和单元格作为数据返回;真正不存在的值照旧报“找不到记录”。
- 这是导入查找报错专题的后半段:上一张已让报错文字带上限定列,这张让依赖错误码的界面(导入向导)也能分清两种情况。
- 只影响导入失败行的错误码和多出的一个可选字段,成功导入不受影响;按旧错误码筛“找不到”的客户端,在这种情况下会收到新码,可整张撤回。
- 无。

## What changes

- **`FieldErrorCode` gains `reference_out_of_scope`**
(`packages/spec/src/api/errors.zod.ts`, ADR-0114 D2 closed catalog),
beside `reference_not_found`. Ruled route A on the card.
- **Catalog sentence `import_reference_out_of_scope`** in all four
platform locales (`packages/spec/src/system/validation-message.ts`). The
English text is byte-identical to the sentence the scoped refusal
already shipped with (`Contract: no record matches "CTR-0006" (Account =
"Acme")`), now with `{{scope}}` as a parameter, so a deployment can
override it under `validation.field.import_reference_out_of_scope` and
the other three locales say it in their own word order.
- **`ValidateDataIssueSchema` gains an optional `scope: [{ field, value
}]`** (`packages/spec/src/api/protocol.zod.ts`), present only on an
import cell error whose code is `reference_out_of_scope`. This is the
thread's route decision, agreed by the seat at claim time: the card asks
the Wizard to name the scoping column and its cell while keying on the
code and never parsing server prose, and the row result carried no
structured column at all. Same `{ field, value }` naming the importer
already uses for the columns; additive, optional, Clause-② widening. The
contract review below judges it.
- **Core importer** (`packages/core/src/utils/import-coerce.ts`,
`import-runner.ts`): the objectstack-ai#36735 unscoped probe now answers the new
reason with the new message key and the `scope` entries; the runner
copies `scope` onto the row's `errors` element. A value nobody has keeps
`reference_not_found`.
- **A scoped read the field-predicate guard refused is never probed**
(`RefMatch.scopeDenied`, `isScopeFieldDenial`). A caller who cannot read
the scope field (a hidden `master_detail` field, or the `param` a
`dependsOn` entry names) has the scoped lookup refused, so its miss says
nothing about where the value lives. Before this PR the probe still ran
and the objectstack-ai#36735 sentence named the scope; with a code that now claims
"under another parent", that answer would be wrong for a record sitting
under the row's own parent. It keeps `reference_not_found` and the plain
sentence, which is what `content/docs/data-modeling/import-mappings.mdx`
already says for that caller. The guard is read off the error's declared
`details.reason === 'field_predicate_denied'` (the reason all four
field-predicate guards answer) naming a scope field, never its message.
- `packages/runtime/src/dispatcher-error-vocabulary.ts`: the new code's
`foreign-vocabulary` row (ADR-0112 D6), same wording as its three
siblings.
- Docs: `content/docs/api/error-catalog.mdx` field-code table and
`content/docs/data-modeling/import-mappings.mdx` scoped-lookup section.
Regenerated: `content/docs/references/api/{errors,export,protocol}.mdx`,
`packages/spec/authorable-surface/api.json`
(`api/ValidateDataIssue:scope`), the strictness-ledger count for `api/`
(537 → 538, the new nested object).
- Changeset: `@objectstack/spec` minor, `@objectstack/core` and
`@objectstack/runtime` patch. `Metadata-protocol: added`, not the
claim's `none`: `Check Changeset` reads the new
`api/ValidateDataIssue:scope` row in
`packages/spec/authorable-surface/api.json` as a key entered, and a kind
other than `none` grades the package that carries it at least `minor`.

## Tests

-
`packages/core/src/utils/import-runner-reference-master-scope.test.ts`:
the objectstack-ai#36159 describe now pins `reference_out_of_scope` for a `dependsOn`
scope and a master scope, by name and by pasted id, single and
multi-value, with `errors[0].scope` as data; a value nobody has keeps
`reference_not_found` with no `scope` key; the two objectstack-ai#33523 pins whose
value lives under another master move to the new code; a new pin: a
scope the field guard refuses answers `reference_not_found` and no
unscoped probe runs.
- `packages/rest/src/import-integration.test.ts`: a new top-level
describe drives the real `POST /data/:object/import` route on a real
engine and sqlite with a real `dependsOn` declaration: one row resolves,
one answers `reference_out_of_scope` with `scope: [{ field: 'project',
value: 'Gemini' }]`, one answers `reference_not_found` with no `scope`.
- `packages/spec/src/system/validation-message.test.ts`: every locale
interpolates `{{value}}` and `{{scope}}`; the English render is the
shipped sentence; the zh-CN render.
- Ablation: with `if (scopedMatch.scopeDenied) return refusal;`
commented out, the guard pin goes red (1 failed / 15 passed), restored
green.

<details><summary>Local readings (tree f4a201e + 2e8b0b9)</summary>

- `pnpm --filter @objectstack/spec test`: Test Files 900 passed (900),
Tests 28505 passed, 1 todo.
- `vitest run src/utils/import-runner-reference-master-scope.test.ts`
(core): 16 passed. `src/utils/import-coerce.test.ts`: passed.
- `vitest run src/import-integration.test.ts` (rest): 62 passed.
- `pnpm --filter @objectstack/spec check:generated`: 2 stale before
`--fix` (references docs, strictness ledger), both green after.
- `typecheck` spec, core, runtime: green; rest: one TS18048 in the new
pin, fixed in 2e8b0b9, `check:test-typecheck` OK.
- `node scripts/check-dispatcher-error-vocabulary.mjs`: exit 0.
- `node scripts/pm/overlap-check.mjs`: VERDICT clean exit 0 (main,
objectstack-ai#37422, objectstack-ai#37371).
- The `dispatch-gates.mjs --commands` derived list (118 commands) is
running; its reading goes on the PR when done.

</details>

## Acceptance notes

- **Narrowing question left to the contract review, as the card asks:**
a client matching `reason === 'reference_not_found'` to mean "the lookup
cell did not resolve" stops seeing the out-of-scope case under that
value. The schema only widens (a new enum member, a new optional key),
so this PR declares `Clause-②: yes (widening)`; whether the move of that
case is itself a narrowing for such a client is the L2's call.
- **Skill text made false, not fixed here (`Skills-docs: follow-up
owed`):** `skills/objectstack-data/rules/relationships.md:117` says
another master's detail answers `reference_not_found`. `skills/**` is
governed, and this PR's `Clause-②: yes` keeps it off the low-risk arm,
so the line here would make the whole PR Tier H; its follow-up card is
objectstack-ai#37590.
- Between this PR and PR-2 the Import Wizard meets a code it has no
`case` for, so `formatDryRunError` falls through to the server's own
sentence (already in the caller's locale, naming the scope) on both the
dry-run panel and the completion screen. PR-2 gives the code its own
Wizard key built from `scope`.

## Verification

Read first: `packages/core/src/utils/import-coerce.ts`
`referenceNotFound` (the new reason and the guard),
`packages/core/src/utils/import-runner.ts` the resolver's `catch`
(`isScopeFieldDenial`), `packages/spec/src/api/protocol.zod.ts`
`ValidateDataIssueSchema.scope`.

Two-minute check: `pnpm --filter @objectstack/rest exec vitest run
src/import-integration.test.ts -t "under another parent"` — one test,
green; row 2 answers `reference_out_of_scope` with its `scope`.

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

<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgWgMUXf5juNBhN6rLX -->

---------

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

Part of objectstack-ai#37503
Clause-②: no
Metadata-protocol: none

## 维护者速读

-
开发者用命令行新建对象时,生成的文件现在和新项目自带的公司、联系人对象写法一致:字段改由分组的字段清单放入分组;文档里的命令输出示例换成了公司和联系人,入门页说明当前正式版仍生成旧的笔记项目。
-
为什么做:新项目模板已换成公司和联系人(上游模板替换的后续),生成器"与模板同一写法"的承诺在字段放置上失效了,文档和注释也还在讲旧的笔记对象。
- 出错会怎样:只影响新生成的对象文件写法,两种写法含义相同、都能通过校验;已有项目不变,可直接撤回。
- 要你做什么:无

## What changes

1. **`os g object` places its field the way the starter does.** The
object generator now writes `fieldGroups: [{ key: 'details', label:
'Details', fields: ['name'] }]` after the field map, and the `name`
field no longer carries `group: 'details'`. Measured on `origin/main`
c385d3b: `examples/app-starter/src/objects/company.object.ts` and the
blank template's `company.object.ts` / `contact.object.ts` place every
field through a group's `fields` list and carry no per-field `group`
(zero `group:` lines). The spec calls the list "the current spelling"
(`ObjectFieldGroupSchema.fields`: "new metadata lists members here").
The generated comment now tells the author to list each added field in a
section, and the doc comment cites the starter's current files instead
of `note.object.ts`. Route: the generator follows the starter, as the
objectstack-ai#32153 pin promises; the promise is not narrowed.
2. **`content/docs/deployment/cli.mdx`**: the `os compile` and `os info`
transcripts come from a real run of the current blank template plus the
ticket object, view and action from Build with Claude Code (companies,
contacts, the starter app, zero rows now printed, no plugins). The
callout describing the fixture is rewritten to match. The "Create a
project" step no longer says "a sample object".
3. **Getting-started pages**: `your-first-project.mdx` and
`build-with-claude-code.mdx` each get one callout sentence: `npm create
objectstack@latest` installs `create-objectstack` 18.6.0 today, which
still scaffolds the `note` project, and the companies-and-contacts
template ships with 19.0. The stale "One object, REST API" template row
in `your-first-project.mdx` now carries the template's real description.
4. **Stale comments only** in
`init-scaffold-file-name-registry-parity.test.ts` and
`platform-object-names.test.ts`. The item-4 comments in
`blank-template-console-disclosure.test.ts` and
`starter-comments-self-contained.test.ts` follow in a separate PR after
objectstack-ai#37441, so this PR touches nothing under
`packages/create-objectstack/**` and the card stays open for them.

Read first, by risk:
1. `packages/cli/src/commands/generate.ts`, the object template string
(the only behaviour change).
2. `packages/cli/test/generate-scaffold-validates.test.ts`, the objectstack-ai#32153
pin's new expectations.
3. `content/docs/deployment/cli.mdx`, the fixture callout under `os
info`.

## Tests

All readings on head 95d0446 (`claude/area-o1A-37503`), repo
objectstack-ai/objectstack.

- `pnpm --filter @objectstack/cli exec vitest run --project unit
--maxWorkers=2`: Test Files 446 passed, Tests 6379 passed.
- objectstack-ai#32153 pin (`generate-scaffold-validates.test.ts`): 26/26 pass.
Ablation: with `generate.ts` restored to c385d3b the pin fails with
`expected undefined to deeply equal [ 'name' ]`; restored to HEAD,
green.
- `OS_TEST_TIERS=nightly`, `generate-scaffold-gates.e2e.test.ts -t
'fresh os init project'`: 11 passed (the generated object, then `os
validate` / `os build` / `os lint` with zero findings, and the updated
text assertion).
- The comment-only test files still in this PR: 14 + 8 pass.
- `pnpm --filter @objectstack/cli typecheck`: exit 0.

<details><summary>Real run behind the cli.mdx transcripts</summary>

Blank template scaffolded with this branch's `create-objectstack` bin,
the ticket object, view and action copied verbatim from Build with
Claude Code section 3 and renamed to `my_app_`:

```text
  Data: 3 Objects  18 Fields
  UI: 1 Apps  3 Views  1 Actions
  Logic: 0 Flows
  Security: 0 Positions  0 Permissions
  Runtime: 0 plugins

  Objects:
    my_app_company (7 fields, user) — Company
    my_app_contact (7 fields, user) — Contact
    my_app_ticket (4 fields, user) — Ticket
```

The walkthrough's three `os generate` commands on a copy: all exit 0,
summary `Data: 4 Objects 19 Fields`, `UI: 1 Apps 3 Views 2 Actions`,
`Logic: 1 Flows`; `os validate` passes. The generated
`customer.object.ts` carries `{ key: 'details', label: 'Details',
fields: ['name'] }` and no `group:` line.

</details>

## Acceptance notes

- The ticket view in Build with Claude Code section 3 declares an
internal create and edit form; a real compile prints one
`form-view-internal-not-loaded` warning for it, while the page says the
form is where `description` is entered. The cli.mdx callout says so and
leaves the warning lines out of the transcript. Open PR objectstack-ai#37422 (form
type) edits that page; reported only.
- `os init -t app` (`packages/cli/src/commands/init.ts`) still writes
per-field `group: 'details'`. Out of this card's file surface; both
spellings are valid.
- The blank template's own comment says "A field shows on the form only
once a section lists it", but `deriveFieldGroupLayout` renders ungrouped
fields in a trailing untitled section. Read-only inference, not measured
in a browser; the generated comment here does not repeat the claim.
- `content/docs/deployment/validating-metadata.mdx` shows a support-desk
summary with `Runtime: 3 plugins` and no zero rows; not re-run, outside
this surface.

## Verification

Two minutes: `node packages/cli/bin/run-dev.js generate object customer`
in a scaffolded project, then open `src/objects/customer.object.ts`.
Expect `{ key: 'details', label: 'Details', fields: ['name'] }` after
`fields`, and no `group:` line on `name`.

---

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

<!-- signed: repo:objectstack#1 · os-elon-musk ·
session_016WV4cyyekQEqLjtrCLLAeV -->

---------

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

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

Fixes objectstack-ai#37102

Clause-②: yes
Metadata-protocol: added
Skills-docs: follow-up objectstack-ai#37310

## 维护者速读

- 用户能看到什么变化:应用声明需要“知识检索”后,平台自动装好检索服务和一个向量库(PostgreSQL
项目用同一个数据库,其他数据库用项目本地的一个文件);没有声明的部署前后完全一样。
- 为什么做:属于“知识检索平台化”专题,让本地开发和自建部署不用手工接线就有可用的检索。
- 出错会怎样:只影响声明了该能力的应用;检索源指向没装上的向量库时应用照常启动,检索会明确报错并说明可选的库;回退本改动即可恢复原状。
- 要你做什么:批准一次。本改动在两份对外技能文件里各补了一个能力名(受管的技能文件),需要你批准后才能合并。

## What changes

- **New capability token `knowledge`** in `PLATFORM_CAPABILITY_TOKENS` /
`PLATFORM_CAPABILITY_PROVIDERS` (provider
`@objectstack/service-knowledge`, edition `open`) and in core
`CAPABILITY_PROVIDERS`.
- **Store selection, shared by both boots** (`@objectstack/core`):
`resolveKnowledgeStore` / `resolveCapabilityExtras` +
`KNOWLEDGE_STORE_PROVIDERS`. PostgreSQL (driver `postgres` or a
`postgres(ql)://` URL) → `KnowledgePgvectorPlugin` on the same URL;
`:memory:` → in-memory turso; anything else → `KnowledgeTursoPlugin` on
`knowledge.db` in the data directory (`.objectstack/data/`, or
`<OS_HOME>/data/` when `OS_HOME` is set) with `urlFromSettings`.
`knowledge-memory` is never mounted.
- **`os serve`** reads the primary database it resolved and mounts the
one store; an extra that cannot be imported or constructed now warns
instead of being skipped silently. A host that mounts the service or a
store itself keeps its own (`hasPluginMatching` on the identities).
- **`@objectstack/verify`** `constructServedProviders` takes an optional
`database` (default in-memory SQLite) and mounts the same store as
serve.
- **Unmounted adapter** (`service-knowledge`): service mounts, boot does
not fail; at `kernel:bootstrapped` one `error` line per such source
naming the mounted adapters; index and search of that source answer
`SERVICE_UNAVAILABLE` 503 with the same message (existing code, no new
error code). A multi-source search keeps the other sources' hits and
names the refused one.
- **Carry from objectstack-ai#37107 (comment 7181713320)** (`knowledge-turso`): under
the token the store URL comes from settings (`knowledge.turso_url` /
`turso_auth_token`). `resolveSettingsStoreUrl` holds a saved `file:` URL
to the realpath'd `.objectstack/data/` (symlink escape, `..`, the
directory itself and the platform DB file are refused) and refuses a NUL
or other control character, all before `createClient`. `resolveStoreUrl`
refuses control characters too.
- **The saved store URL is read at `kernel:bootstrapped`, not in
`start()`** (`knowledge-turso`, fix round). The settings service answers
a saved value only once its data engine is bound, in its own
`kernel:ready` hook; a read in `start()` saw the manifest default while
the saved row sat unread, so the store opened the default file whatever
the operator had saved (`check:settings-bind-window` named it;
reproduced on a real kernel, see Verification). Under `urlFromSettings`
the adapter is now registered in `start()` with no database and answers
`SERVICE_UNAVAILABLE` 503; the plugin registers its
`kernel:bootstrapped` handler in `init()`, so it runs ahead of every
handler a plugin registers in `start()`: the knowledge service's
embedder, its reading of unmounted adapters, and the first build of
objectstack-ai#37099 find the store open. A store given `url` or `client` opens in
`start()` as before. The plugin's `optionalDependencies` keep only the
knowledge service: no ordering edge moves a `start()` read past the
settings bind.
- **Rework after contract record 7187791236 (FAIL on M1) and the seat's
REWORK note:**
- **M1, a percent-encoded control character is refused**
(`knowledge-turso`). `resolveStoreUrl` and `resolveSettingsStoreUrl`
tested the raw URL only, so a saved `file:…/k%00.db` passed both; libSQL
decodes the path it opens and its native library ends the process on the
NUL byte, at every boot. Both now read each `%XX` escape as the
character it encodes and refuse a control character in either spelling,
before anything touches the disk or the client. The check is in
`resolveStoreUrl`, so the plugin's own `url` option holds too.
- **S3, `@objectstack/knowledge-turso` is an optional dependency** of
`@objectstack/cli` and `@objectstack/verify` (it was a hard one in the
first round). Its libSQL client is a native module with an `os` / `cpu`
list; as a hard dependency it would refuse the whole CLI install outside
that list. `KNOWLEDGE_STORE_PROVIDERS.turso` and its `CapabilityExtra`
carry `optional: true`. `os serve` already warns when an extra cannot be
imported and boots on; `constructServedProviders` now does the same for
an optional extra (any other provider it cannot load is still a thrown
boot error).
- **S4, the store's file follows `OS_HOME`** (`os start --home` sets
it): `resolveKnowledgeStore` hands the store `stateDir`, and the data
directory is then `<OS_HOME>/data/`, the directory the boot keeps the
default platform database in (`resolveDatabaseStateDir`'s order). The
settings confinement moves with it, so an operator can keep the file on
the volume. Without `OS_HOME` nothing changes. New plugin option
`stateDir`; `dataDirectoryOf` and `defaultStoreUrl` take it as a second
argument. A database named by URL does not move the store (documented).
- Docs (`knowledge-rag.mdx`): where the file is, what more than one
replica means on MySQL, MongoDB or remote libSQL (one local file per
replica, each indexing only its own writes: use a shared `libsql://`
store or PostgreSQL), and an install without the libSQL client.
- Changeset: the sentence about a host-mounted service no longer
overstates (a host that mounts the service gets no store from the
runtime).
- **After the delta record 7193770862 (PASS) and the seat's note
7193780591: the auth token is checked too** (`knowledge-turso`, commit
664bd70). `turso_auth_token` is the second settings value handed to
the libSQL client. A token with a NUL byte, a line break or another
control character is refused in the plugin's one open path (`open()`),
for the saved setting and for the `authToken` option alike, before the
client is created; the store answers `SERVICE_UNAVAILABLE` with a reason
that never quotes the token. It is read as written, with no
percent-decoded reading: the client percent-decodes a URL (an
`authToken` in a URL's query is already covered by M1's check), never
this option, so `%00` in a token is three characters. Probed on the
installed `@libsql/client` 0.18.0 before the change, to know what the
check prevents: on a `file:` URL a NUL or a line break in the token
opens and answers a query (exit 0, no abort: the native open ignores the
token without a sync URL); on `http://` every request is rejected with a
catchable `TypeError` (invalid header value); on `ws://` the connection
was refused before the token was used, so that arm is unmeasured. So no
process abort was found; the check turns a failure at every call into
one refusal that names the setting. N4: the `knowledge.manifest.ts`
jsdoc now names the state directory's data directory and both spellings
of a control character.
- Settings manifest + 11 locales: the `turso_url` example path is now
`file:./.objectstack/data/knowledge.db`.
- Docs: `content/docs/ai/knowledge-rag.mdx` gains "Turning it on:
`requires: ['knowledge']`"; the old "Wiring" section is now "Wiring by
hand".
- **Skills enumeration rows only (Tier H)**, under the enumeration-row
case (ruling A on objectstack-ai#32584): the token's one `CAPABILITY_ROWS` line in
`packages/spec/scripts/lib/platform-catalog.ts` and its regenerated page
`skills/objectstack-project/references/platform-catalog.md`
(`gen:skill-refs`, no hand edit), and the bare `knowledge` token added
to the `@objectstack/service-` + token cell of the `requires:` table in
`skills/objectstack-platform/SKILL.md`. No teaching, examples or evals:
those ride objectstack-ai#37310.
- **Two ceilings, each raised by its row's measured delta and by no
more** (nothing else cut, nothing rides along):
- `skills/objectstack-platform/SKILL.md`
(`scripts/check-skills-token-ratchet.mjs`): priced text 24591 to 24603
bytes (+12), 6148 to 6151 tokens (ceil(24591 / 4) = 6148, ceil(24603 /
4) = 6151). `main`'s row is 6149, with 1 token of headroom since objectstack-ai#37568
took 2 bytes out of the file; that token is absorbed, so the ceiling
moves 6149 to 6151 (+2), pinned at the measurement. History of the
number: on the first three merges of `main` (4925039, cc38a91,
5dbcc02) the base was 24593 priced bytes and the row read 6152 (24605
bytes); objectstack-ai#37568 then landed, and after the fourth merge (758e145) the
row is re-pinned at 6151 (S5 of delta record 7196043543). The delta of
the row itself is 12 bytes throughout.
- the catalog's hand-written text
(`packages/spec/scripts/platform-catalog.test.ts`): 6902 to 6939 bytes
(+37), ceiling 1726 to 1735 tokens, pinned at the measurement. The row
was first shortened from 50 to 37 bytes ("knowledge search and its
vector store").
- **The two rulings the raise path names**, quoted:
- Ruling A on objectstack-ai#32584 (record 6819475461; maintainer, verbatim: 「同意 A」):
"a product PR that adds an authorable `defineStack()` top-level key, or
a live member of a schema symbol bound to a registered exhaustive skills
section, carries the matching skills enumeration row in the same PR.
Only that row; prose, examples and evals still go to the skills
sub-card."
- objectstack-ai#32673 letter A (record 6840575378; maintainer, verbatim: 「32843 32673
同意」): "a PR that adds a metadata key and, under ruling A on objectstack-ai#32584,
carries the matching enumeration row in a published skill may raise that
skill file's token cap by the row's measured delta, and by no more. The
PR body cites ruling A and this ruling. Nothing else in the file is cut
to make room, and no wider raise rides along."
- **Skills readings** on this head against `main` 758e145 (lines;
tokens as the ratchet prices them):
`skills/objectstack-platform/SKILL.md` 421 to 421 lines, 6148 to 6151
tokens; `skills/objectstack-project/references/platform-catalog.md`
(generated) 160 to 161 lines, 2878 to 2898 tokens; all `SKILL.md` files
together 4961 to 4961 lines; the whole shipped bundle reads 299348
tokens, of which this PR adds 23 (3 + 20).
- **`packages/cli/src/utils/boot-preparation-parity.test.ts`**:
`resolveCapabilityExtras` is a `SERVE_ONLY` entry (the declaration boot
reads a row's `extras` itself and composes no knowledge store: a store's
`init()` declares nothing, its tables are its own). Editing the file put
it in `check:test-source-alias`'s changed-file scope, so it now pays six
dynamic imports its step modules reach at collection (six module-top
side-effect imports, the gate's printed remedy).

## Tests

- `packages/verify/src/harness.required-providers.test.ts`: `requires:
['realtime','knowledge']` on SQLite boots the service + turso (not
pgvector), a record write is indexed and `search` finds it, a pgvector
source is refused 503 while boot succeeds; no token → no service and
`settings.getNamespace('knowledge')` rejects
`SETTINGS_UNKNOWN_NAMESPACE`; host-mounted service unchanged.
-
`packages/plugins/knowledge-pgvector/src/__tests__/capability-mount.live-postgres.test.ts`
(new, live cell): the token's resolution on PostgreSQL picks pgvector on
the same URL; a record write is indexed and `search_knowledge` finds it.
**It has not run in CI on any commit of this PR**: the job with a
PostgreSQL service, `temporal-conformance`, does not run on
`pull_request`, and Test Core collects the file with both cases skipped.
Its first CI run is the merge queue (the PR touches
`packages/plugins/knowledge-pgvector/**`, which is in the
`temporal_live` filter). It did run locally in the rework round, against
PostgreSQL 16.15 with pgvector 0.6.0 from the distribution's package (CI
pins pgvector 0.8.7): see Verification.
- `packages/core/src/capability-composition.test.ts`: store selection
arms (pg driver/URL, other DBs, in-memory, env fallback) and extras.
- `packages/plugins/knowledge-turso/src/__tests__/plugin.test.ts`:
`resolveSettingsStoreUrl` (NUL/control, inside, outside, symlink escape,
platform file) and the plugin never reaching a mocked `createClient`
with a refused URL. Fix round: the settings double now answers a saved
value only once bound, as the real service does, and the cases run a
boot in kernel order (`init()`, `start()`, the bind,
`kernel:bootstrapped`). New case: nothing is read and no file is made in
`init()` or `start()`, the mounted adapter answers `SERVICE_UNAVAILABLE`
/ 503 until the boot completes, then the saved file opens and the
default file is never made.
- Rework round, `plugin.test.ts`: `%00`, `%0a`, `%0A`, `%7f`, a
`file://` form and a `libsql://` URL are refused by both resolvers, with
a control (`%20` and a doubly encoded `%2500` are names, not control
characters); a saved `%00` or `%0a` URL never reaches a mocked
`createClient`; a state directory moves the default file and the
confinement.
- Rework round, `harness.required-providers.test.ts`: **a real-kernel
case for the file-database arm** (`constructServedProviders` with a
`file:` database under a temporary `OS_HOME`, a `turso_url` saved from a
`kernel:ready` handler: the store is healthy on the saved file, neither
default file is made, a record write is found by search); **an install
without the store** (the package made unimportable: the service is
constructed, the store is not, one warning); the dependency pin now
requires an `optional` store to be an optional dependency and nothing
else.
- Rework round, `capability-composition.test.ts`: `OS_HOME` is handed to
the file arm as `stateDir`, and to no other arm.
- Token round, `plugin.test.ts`: a token with a NUL byte, a trailing
line break, a CR LF or U+007F never reaches a mocked `createClient`,
through the settings door (on a `libsql://` URL and on a file inside the
data directory) and through the `authToken` option; no log line quotes
the token; controls: a JWT-shaped token and one with `%00` in it reach
the client as written.
-
`packages/services/service-knowledge/src/__tests__/knowledge-service.test.ts`:
boot reading, coded index/search refusals, the plugin hook.
- `packages/cli/test/serve-capability-identity.test.ts`: identity rows
for the service and both stores.

## Acceptance notes

- **Governed (Tier H)**: the diff touches `skills/**`, so this PR stays
draft until the maintainer's approval.
- **File surface**: the claim was widened twice. The take-over claim
(7184318627) lists what the first round measured; claim amendment
7184431271 adds the four files this fix round needed
(`packages/spec/scripts/platform-catalog.test.ts`,
`skills/objectstack-platform/SKILL.md`,
`scripts/check-skills-token-ratchet.mjs`,
`packages/cli/src/utils/boot-preparation-parity.test.ts`), and the
maintainer approved editing them in the card thread.
- **Between `kernel:ready` and `kernel:bootstrapped`** a store whose URL
is the operator's setting has no database yet: a record written by
another plugin's `kernel:ready` handler is not indexed into it (the call
answers 503). The knowledge service's own settings-configured embedder
is provided at the same phase, so a deployment without a host-registered
embedder indexed nothing in that window before either. The first build
of objectstack-ai#37099, now on `main` and merged here, builds the source after the
store has opened and so covers such rows.
- `@objectstack/knowledge-turso` is an **optional** dependency of
`@objectstack/cli` and `@objectstack/verify` (S3). On an install without
it `requires: ['knowledge']` on a non-PostgreSQL database boots with the
service and a warning, and sources naming `turso` answer 503.
- **Accepted nits, not changed** (the seat's record): N1,
`file::memory:` and an empty `wasm-sqlite:` URL take the file arm; N2,
the settings example `file:./.objectstack/data/knowledge.db` is read
from the working directory and names the project's directory, so under
`OS_HOME`, or from another working directory, it is refused with a
message naming the right directory (it fails closed; the example text
lives in the manifest and 11 locales). N3, the `ci.yml` step comment
still says three `*.live-postgres.test.ts` files where there are now
five: `.github/workflows/**` is outside this card's surface, so it is
not edited here.
- The double boot line for a source whose adapter is not mounted, and
the publish-time refusal, are carried by objectstack-ai#37479.
- **objectstack-ai#37099 (PR objectstack-ai#37439) landed first; `main` is merged here and the
first-build path re-checked.** Its after-boot build starts in the
knowledge service's `kernel:bootstrapped` handler and reaches
`getAdapter` through `readIndexState`, inside that method's own `try`.
Read on a real kernel (see Verification): a store whose URL is a saved
setting is open before the build starts (its handler is registered in
`init()`, the service's in `start()`), and the build of its source ends
`done`; a source naming an unmounted adapter is read as `unreadable`, is
not built, and the boot goes on. Such a source is logged twice at boot,
once at `error` by this PR's reading of unmounted adapters and once at
`warn` by the build pass; one line would do (carried by objectstack-ai#37479, not
changed here).
- **Merged with `main` four times** (`scripts/pm/os-regen-merge.sh`, no
rebase): at 4925039 for a GitHub conflict in the `requires:` table row
of `skills/objectstack-platform/SKILL.md` (resolved by keeping `main`'s
provider cell whole and adding the bare `knowledge` token after
`record-context`), at cc38a91 once objectstack-ai#37439 had landed (no conflict), in
the rework round at 5dbcc02 once objectstack-ai#37477 and objectstack-ai#37492 had landed (no
conflict), and at 758e145 for S5 once objectstack-ai#37568 had edited
`skills/objectstack-platform/SKILL.md` (auto-merged, no conflict). After
each, `git diff origin/main` names this PR's 38 files and nothing else;
`gen:skill-refs` and `check:generated` leave the tree clean.
- **Open PRs that will conflict with this one**: objectstack-ai#37422 in
`scripts/check-skills-token-ratchet.mjs`. Whichever lands second
re-measures the `skills/objectstack-platform/SKILL.md` row.

## Verification

First files to read, by risk:
1. `packages/plugins/knowledge-turso/src/plugin.ts`: `init()` /
`start()` / `openFromSettings` (when the store opens, and what it
answers before).
2. `packages/core/src/capability-composition.ts`:
`resolveKnowledgeStore` (which store, with what argument).
3. `packages/services/service-knowledge/src/knowledge-service.ts`:
`getAdapter` / `reportUnmountedAdapters` (the coded refusal).

Two-minute check: `pnpm --filter @objectstack/knowledge-turso exec
vitest run --maxWorkers=2 src/__tests__/plugin.test.ts`: expect 22/22,
including "refuses a percent-encoded control character too" and "reads
the settings at kernel:bootstrapped, never in init() or start()".

<details><summary>Local runs (under scripts/pm/os-verify-lock.sh): the
rework round on 806c55d, the token round on 664bd70, and what ran
again on head c25cc1a</summary>

- `pnpm install --frozen-lockfile`: exit 0. `pnpm turbo run build
--concurrency=2 --filter='./packages/**' --filter='./examples/**'`: exit
0, 85/85 tasks. `gen:skill-refs` then `check:generated`: exit 0, tree
clean.
- `pnpm --filter @objectstack/knowledge-turso test`: exit 0, 3 files,
155/155. `typecheck`: exit 0.
- `pnpm --filter @objectstack/core exec vitest run --maxWorkers=2
src/capability-composition.test.ts`: exit 0, 21/21. `pnpm --filter
@objectstack/core typecheck`: exit 0.
- `pnpm --filter @objectstack/verify exec vitest run --maxWorkers=2
src/harness.required-providers.test.ts`: exit 0, 15/15 (19.0 s of tests
locally; the header's budget is re-derived to 28). `pnpm --filter
@objectstack/verify typecheck`: exit 0.
- `pnpm --filter @objectstack/cli exec vitest run --project unit
--maxWorkers=2 src/utils/boot-preparation-parity.test.ts
test/serve-capability-identity.test.ts
src/commands/knowledge/knowledge.test.ts`: exit 0, 3 files, 143/143.
`pnpm --filter @objectstack/cli typecheck`: exit 0. The rest of the cli
suite is left to CI.
- `pnpm --filter @objectstack/service-knowledge test`: exit 0, 14 files,
452/452. `pnpm --filter @objectstack/service-settings test`: exit 0, 77
files, 1521/1521 (after objectstack-ai#37477's edits to the same manifest and
locales). `scripts/platform-catalog.test.ts` (spec): exit 0, 20/20.
- **The pgvector live cell**, as CI's step runs it:
`OS_TEST_POSTGRES_URL=postgres://postgres:postgres@127.0.0.1:5432/postgres
OS_EXPECT_LIVE_DIALECT_MATRIX=1 pnpm --filter
@objectstack/knowledge-pgvector exec vitest run live-postgres`: exit 0,
5 files, 65/65, none skipped (4 files, 59/59 before the merge of `main`
brought objectstack-ai#37492's file). Server: PostgreSQL 16.15 with the `vector`
extension 0.6.0 (the distribution's `postgresql-16-pgvector`), not CI's
pinned pgvector 0.8.7 image.
- **Ran again on the token commit 664bd70 (it touches
`knowledge-turso`, one comment in the settings manifest, the docs page
and the changeset):** `pnpm --filter @objectstack/knowledge-turso test`:
exit 0, 3 files, 156/156 (`plugin.test.ts` 22/22); its `typecheck`: exit
0; `turbo run build` of `@objectstack/knowledge-turso` and
`@objectstack/service-settings`: exit 0, 20/20 tasks. Everything above
this line was run on 806c55d and not again.
- **After the fourth merge (c25cc1a):** `pnpm install
--frozen-lockfile`: exit 0. `pnpm --filter @objectstack/spec build`,
`gen:skill-refs`, then `pnpm --filter @objectstack/spec
check:generated`: exit 0, tree clean.
`scripts/platform-catalog.test.ts`: exit 0, 20/20 (catalog ceiling 1735
unchanged). `node scripts/check-skills-token-ratchet.mjs`: exit 0,
`skills/objectstack-platform/SKILL.md` 6151 / 6151. No package test was
run again on this head.

</details>

<details><summary>Rework round: each new test turns red without its
fix</summary>

- **M1.** With the decoded read removed from `carriesControlCharacter`
(the raw test alone, as on abf337b): `plugin.test.ts` 2 failed / 19
passed, "refuses a percent-encoded control character too" and "a saved
URL with a NUL byte, or outside the data directory, never reaches the
libSQL client". Restored (byte-identical to the committed file): 21/21.
- **S2, S3, S4.** With `stateDir` and `optional: true` removed from core
and core rebuilt: `harness.required-providers.test.ts` 3 failed / 12
passed. The file-database case answers `{ ok: false }` (the saved file
under `OS_HOME` is outside the app's data directory); the missing-store
case throws the "could not load it" boot error; the dependency pin
reports `@objectstack/knowledge-turso` as not a dependency. Restored and
rebuilt: 15/15.
- **The auth token.** With the `acceptsAuthToken` check removed from
`open()`: `plugin.test.ts` 1 failed / 21 passed, "an auth token with a
control character never reaches the libSQL client, saved or given; the
reason never quotes it". Restored with `git checkout` (the committed
file): 22/22.

</details>

<details><summary>Fix round: reverse verification of the settings read
(one-off, no file kept)</summary>

A throwaway `@objectstack/verify` case booted a real kernel with
`KnowledgeServicePlugin`, `KnowledgeTursoPlugin({ urlFromSettings: true
})` and a plugin that saves `knowledge.turso_url` from its
`kernel:ready` handler (ordered after the settings bind).

- This head: the read in `start()` answers `source: 'default'`; after
the boot the store is healthy on the saved file and `knowledge.db` was
never made. Probe 1/1 green.
- `plugin.ts` restored to 969b372 (the pre-fix file), `knowledge-turso`
rebuilt (dist marker absent): the probe is red, the saved file was never
made and the default `knowledge.db` was opened; `plugin.test.ts` 3
failed / 16 passed (the two saved-URL cases and the new phase case).
- Restored from `HEAD` (blob hash equal, `git diff HEAD` empty), rebuilt
(dist marker present): probe green again.

</details>

<details><summary>The first build of objectstack-ai#37099 on a real kernel, after the
second merge (one-off, no file kept)</summary>

A throwaway `@objectstack/verify` case booted a real kernel with
`KnowledgeServicePlugin`, `KnowledgeTursoPlugin({ urlFromSettings: true
})` and an app plugin that registers an embedder, a source on `turso`, a
source naming the unmounted `pgvector`, and saves `knowledge.turso_url`
from its `kernel:ready` handler. 1/1 green; readings after the boot:

- the `turso` source: `buildRecord` is `{ trigger: 'boot', status:
'done', result: { ok: true, failed: 0 } }`, then `readIndexState`
answers `current` ("same fingerprint, same recipe hash"). The store is
healthy on the saved file and the default `knowledge.db` was never made.
- the `pgvector` source: no build record; `readIndexState` answers `{
state: 'unreadable', due: false }` with the coded refusal's text
("adapter 'pgvector' is not mounted (mounted: turso)"). Boot log: one
`ERROR` line from the reading of unmounted adapters, one `WARN` line "is
not built at boot" from the build pass.

</details>

<details><summary>Derived gates (node scripts/pm/dispatch-gates.mjs
--commands, 166 commands)</summary>

- On this head (c25cc1a, after the fourth merge and the re-pinned
row): the 37 derived commands that read skills, the ratchet, the
catalog, generated artifacts, docs or the changeset ran again, 37/37
exit 0 (among them `check-skills-token-ratchet.mjs` and its self-test,
`check:skill-docs`, `check:skill-examples`, `check:skill-refs`,
`check:skill-identifier-liveness`, `check:skill-links`,
`check:skill-top-level-keys`, `check:ratchet-remedy-authority`). The
other 129 were not run again locally on this head; CI runs them on the
merge.
- `overlap-check` before the push: `origin/main` (758e145) merges
cleanly; exit 1 only for open PR objectstack-ai#37422 (conflict in
`scripts/check-skills-token-ratchet.mjs`).
- Earlier rounds, for the record: 166/166 on the token commit 664bd70;
166/166 on 806c55d (the rework round); 166/166 on 63eba5b before the
first merges; the 56 commands a merge can reach, 56/56, at 64075a7 and
at abf337b.

</details>

## Remaining

- The ceiling-tier contract review owed by `Clause-②: yes`, then the
maintainer's approval (Tier H).
- The pgvector live cell has not run in CI on this PR (it cannot: see
Tests); the merge queue is its first CI run, and a red there ejects the
entry. Locally it passed against pgvector 0.6.0, not CI's 0.8.7.
- The seat re-scopes objectstack-ai#37479 before this lands; the re-pinned ratchet row
(S5) is re-checked by the same contract reviewer.

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

<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6CYE8s5v1UX96GEfkcR -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…s at the field, and a screen refusal reaches the user at its fields in their language (objectstack-ai#37643)

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuQVQdf3PvoJbKFFCUA4gwJB)_

Fixes objectstack-ai#37526

## What changes

**Client: spaces are no answer.** The flow screen dialog's `required`
check (`FlowRunner.tsx`, new exported `isUnanswered`) counts a string
that is empty once trimmed as missing, as the engine's `isPresent` does.
Three spaces in a required field are refused under the field with the
same `validation.required` message an empty field gets, focus moves
there, and no resume request is made. An unchecked `false` and `0` stay
answers.

**Wire: a screen refusal names its fields in a structured slot.** `400
INVALID_SCREEN_INPUT` now carries `error.details.fields`: one `{ field,
code, message }` per violated screen field, `code` an ADR-0114
`FieldErrorCode` (`required`, `invalid_type`, `invalid_value`,
`min_value`, `max_value`, `unknown_field`). These are the entries
`VALIDATION_FAILED` already serves in the same slot, and each parses
under `FieldErrorSchema`.
- `@objectstack/spec`: `AutomationResult` gains the optional `fields?:
FieldError[]`, set with `code: 'INVALID_SCREEN_INPUT'` only, and
`TriggerFlowResponseSchema.data` mirrors it as
`z.array(FieldErrorSchema).optional()` (the objectstack-ai#13078 identity pin
`TriggerFlowDataMatchesContract` holds the two equal). The generated
reference page `content/docs/references/api/automation-api.mdx` is
regenerated.
- `@objectstack/service-automation`: `refuseInvalidScreenInput` fills it
from the `validateScreenInputs` issues it already computed.
- `@objectstack/runtime`: `classifyResumeResult` serves it as
`details.fields` on that row only, so the REST door and MCP `resume_run`
answer it alike. Another row, or an empty list, serves no details, as
before.
- `error.message` is byte-identical: the sentence with the declared
field names stays for logs and API callers.

**Console: the refusal is placed at its fields, in the user's
language.** `interpretFlowResponse` reads the findings
(`screenInputFindings`, `{ field, code }` only) onto a failed outcome's
new `screenInput`. `FlowRunner` marks each on-screen field named, by the
label it shows and in the display language: `required` →
`validation.required`, a bound → `validation.min` / `max` when the field
declares it, anything else → new `flowRunner.fieldNotAccepted`. Focus
moves to the first. The banner and toast read new
`flowRunner.invalidScreenInput` instead of the engine's sentence, also
from a server that sends no findings. Both keys are in all 11 locales.
The objectstack-ai#36831 re-read of the run before a retry is unchanged and still runs
first.

Docs: `content/docs/automation/flows.mdx` § *A `screen` resume is
checked against the declared fields* documents `details.fields` and the
runner's behaviour.

## Why

The card measured on 18.6.0 (zh-CN console, HotCRM Close Case): three
spaces in the required `resolution` passed the dialog, the engine
trimmed and refused, and the dialog showed `Invalid screen input: Screen
field "resolution" is required — declared fields: 'resolution',
'resolved_by_article'` verbatim. Premise re-read on `main` 33a31dc: the
dialog's check did not trim (`FlowRunner.tsx:848-849`), the engine's
does (`screen-input-contract.ts:58-59`), and the refusal envelope
carried only `details.code`. The dialog's own header said why the
sentence stayed in the banner: "the envelope names no field in a
structured slot, so placing it at a field would mean parsing prose".
This PR adds that slot instead of parsing.

## Verification

- `service-automation`
`builtin/screen-input-whitespace-fields-37526.test.ts` (real
`AutomationEngine`, Close Case screen): `' '` refused `required` with
`fields` and the unchanged sentence, the pause kept; one entry per
violated field (`required`, `min_value`, `unknown_field`); a real answer
resumes with no `fields`.
- `runtime`
`domains/automation-resume-screen-input-fields-37526.test.ts` (REST
resume door): `details.fields` served, `message` unchanged, the envelope
parses under `ApiErrorSchema` and each entry under `FieldErrorSchema`;
an empty list and another row serve no details.
`automation-resume-refusal-codes.test.ts` (every row: empty details when
the engine sends no fields) and `mcp-resume-run.test.ts` stay green.
- `app-shell` `FlowRunner.whitespaceRequired-37526.test.tsx` (7 tests):
spaces refused at the field in en and zh with no request; findings
placed by label (`Resolution is required`, `Hours must be at least 0`),
focus on the first, catalog banner and toast, no API field name on
screen; zh banner and `fieldNotAccepted` message; no findings → catalog
banner, no field marked; editing retires the message and the resubmit
completes. **Ablation:** against `main`'s `FlowRunner.tsx` and
`flowResponse.ts`, 7 of 7 red.
- Two existing pins moved, same intent (a retryable refusal keeps the
screen, values and Submit): `FlowRunner.requiredAtField-26882.test.tsx`
and `FlowRunner.resumeResult.test.tsx` asserted the engine's sentence in
the banner. They now assert the catalog sentence, and that the engine's
is absent.
- Suites: service-automation `screen` + `resume` 30 files / 345 tests;
runtime `resume` + `http-dispatcher` 40 / 825; client
`automation-resume` 1 / 8; ui `i18n` + all `FlowRunner*` +
`flowResponse` 132 / 2237 (13 skipped).
- spec: `api/automation-api*` + `contracts` 58 files / 585 tests;
`check:generated` 14 of 14 green (incl. `check:test-typecheck`, which
caught the missing Zod mirror first).
- `tsc --noEmit`: service-automation and runtime exit 0. app-shell `tsc`
and `tsconfig.test.json` show no error in the changed files (the 6 / 7
errors are in untouched files, from stale local dists of other ui
packages). eslint on the changed files: 0 errors.
- `overlap-check` clean against `origin/main` d92684a and 1 PR head
(objectstack-ai#37422, shares the locale files and the generated reference page,
merges cleanly).

## Small decisions (dev thread)

- **What `details.fields[].message` carries, and why it is there.** The
claim said the findings would carry no message with author keys. The PR
uses the existing `FieldErrorSchema` entry `{ field, code, message }`
instead of a new two-member shape, because `message` is required there
and the slot is the one `VALIDATION_FAILED` already fills. The `message`
is the engine's English line for that one finding, verbatim, and it is a
substring of `error.message`, which this PR does not change: `Screen
field "resolution" is required`, `Screen field "hours" must be at least
0`, `Unknown screen field "nickname" — not declared on this screen`. So
it names the field by its machine name, which `field` names anyway. For
`unknown_field` it echoes the key the CALLER sent. It never carries the
declared-fields list, the other fields' names, or a value. Nothing new
reaches the wire: every string in `details.fields` was already in the
same response's `error.message`. The console never renders `message`.
`screenInputFindings` keeps only `{ field, code }`, and the text under a
field is the console's own catalog sentence with the field's label. The
server log is unchanged: the findings ride its structured slot (`{
issues }`), never its message (objectstack-ai#6654).
- **Bounds read the field's own declaration.** A `min_value` /
`max_value` finding reads as `validation.min` / `max` with the limit
taken from the screen field's declared `min` / `max`, because the
engine's entry carries no constraint. Without that declaration it falls
back to `flowRunner.fieldNotAccepted`.
- **Toast kept beside the banner.** On an engine refusal the dialog
keeps the toast plus banner it already raised for every resume failure
(`c40f3b8ca`), now with the catalog sentence. Only the client-side
required refusal raises no toast (objectstack-ai#26882), and that is unchanged.

Clause-②: yes (widening)
Metadata-protocol: none

Owed: L1 (seat); L2 (seat arranges: the new optional `details.fields`
member on `400 INVALID_SCREEN_INPUT` and `AutomationResult.fields`).

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(The wire member is Zod on `TriggerFlowResponseSchema`, element
`FieldErrorSchema`; the contract interface mirrors it.)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [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: its generated artifacts are
regenerated and committed. (`gen:docs`; `check:generated` 14 of 14 green
against a fresh build)
- [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.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

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

https://claude.ai/code/session_01L6bhgU7eeqHgQrtv5CeJK6

---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgU7eeqHgQrtv5CeJK6)_
<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgU7eeqHgQrtv5CeJK6 -->

---------

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

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuPE7uyDAJyqjwwMzomWv5ff)_

Fixes objectstack-ai#36950

Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: none — `skills/objectstack-i18n/SKILL.md` names the
`metadataForms` group only, never its leaf keys; the group is
platform-owned, so no app author writes the new key

## 维护者速读

- 用户能看到什么变化:非英文的搭建者在 Studio
里打开对象、字段、报表、仪表盘、钩子、动作、页面、智能体、技能的配置表单时,下拉框里的选项名(例如共享模型「私有 —
仅所有者」、字段类型、删除行为、默认时间段)改为显示当前语言;以前这些选项在所有语言下都是英文,周围的字段名却已经翻译。
- 为什么做:翻译包里没有放选项名的位置,服务端也不翻译它们。
- 出错会怎样:只多翻译一层显示文字,选项的值不变,保存下来的数据不变;某个选项没有译文时仍显示原来的英文。
- 要你做什么:这个 PR 改动约 3,790 行(主要是 10 种语言的译文),超过 3,000 行,按规则需要授权审批人批准后由座位落地。

## What changes

**The reading the card asked for** (at `021524cd`,
`METADATA_FORM_REGISTRY` walked with the extractor's path rule): of the
18 registered Studio forms, 9 carry a select row with `options` —
`object`, `field`, `hook`, `report`, `dashboard`, `action`, `page`,
`agent`, `skill` — 38 rows, 187 options (185 distinct `type.path.value`
keys: `object`'s `fields.deleteBehavior` is listed twice, with the same
names). Every one is seen by a builder: the console's `SchemaForm`
renders `fieldSpec.options` ahead of the schema enum
(`ui/packages/app-shell/src/views/metadata-admin/SchemaForm.tsx`, the
enum/select branch), and the server translated only `label`, `helpText`
and `placeholder` of a form field.

- **Spec, translation slot**
(`packages/spec/src/system/translation.zod.ts`). A
`metadataForms.<type>.fields.<path>` entry accepts `options`: a record
from option `value` to its translated name, the shape
`objects.<object>.fields.<field>.options` already has. `choices` and
`values` are refused there, as on the object-field face, and the refusal
names `options` as the key to write (the `aliases` row of the strict
object is the rename hint of that unknown-key refusal, not an accepted
spelling).
- **Spec, resolver** (`packages/spec/src/system/i18n-resolver.ts`).
`translateFormField` overlays each `options[]` entry's `label` with the
translation keyed by its `value`, along the locale chain; an option with
no translation, or with a non-string value, is passed through unchanged.
This is the walker `resolveMetadataFormLabels` uses, which
`/api/v1/meta/types` localizes served forms with.
- **Lint, extractor** (`packages/lint/src/i18n-walk.ts`).
`walkFormField` emits
`metadataForms.<type>.fields.<path>.options.<value>` for every option of
a row, seeded with its English label, so `os i18n extract` and `pnpm
check:i18n` offer exactly the keys the resolver reads.
- **Platform-objects, shipped locales.** `node
scripts/check-i18n-bundles.mjs --write` added the 185 keys to all eleven
`*.metadata-forms.generated.ts` packs; the ten translated packs then got
hand-written names (ar, de, es-ES, fr, ja-JP, ko, pt-BR, ru, zh-CN,
zh-Hant) and a second `--write` dropped every source-hash row they had
seeded. The 17 Default Period choices take the wording of the console's
own period chip (`ui/packages/i18n/src/locales/*`,
`dashboard.filters.range.*` and `dashboard.filters.custom`), so the
period an author picks reads as the period a viewer sees. Loanwords that
read the same as English (`URL`, `HTML`, `JSON`, `Markdown`, and per
locale words such as de `Text`, fr `Date`) are spelled so they are not
byte-echoes of the source, which the catalog's zero-echo pins require
(`object-lifecycle-panel-echo-decisions.test.ts`,
`report-form-echo-decisions.test.ts`): for example zh-CN `网址(URL)`, de
`Textfeld`, fr `Date (sans heure)`.
- `content/docs/references/system/translation.mdx` regenerated
(`gen:docs`).

Small calls made here (no card): the rename hints for `choices` /
`values` mirror the object-field face; a non-string option value is
passed through untouched rather than stringified, since every option a
registered form lists has a string value (the reading found none other).

## Why

A non-English builder saw a translated field label with English choices
under it on every server-rendered Studio form. The bundle had no slot
for the names, so no locale could fix it.

## Verification

- `packages/spec/src/system/i18n-resolver.test.ts`, new top-level
describe "select option names": a choice is renamed by its value and
keeps its other keys; a value with no translation keeps its English
label; a nested repeater row is reached by its dot path; the input form
is not mutated.
-
`packages/platform-objects/src/metadata-translations/form-option-labels.test.ts`
(new): through the SERVED bundle and the real registry, the object
form's sharing model reads `私有 — 仅所有者` in zh-CN; the reading floor (≥30
option rows over ≥8 forms) holds; for each of the ten translated locales
every choice of every form select has a non-empty name that differs from
its English label.
- Local runs on this branch: `packages/spec` full suite green (vitest,
618 s); `packages/lint` 236 files / 9,680 tests green;
`packages/platform-objects` translations + metadata-translations 29
files green; `packages/cli` `test/i18n-extract.test.ts` green; `node
scripts/check-i18n-bundles.mjs` exit 0; `pnpm check:i18n-coverage` could
not measure here (exit 3: the example apps are not built in this
worktree), so CI carries that one; `pnpm --filter @objectstack/spec
check:generated` exit 0 after `gen:docs`.
- `node scripts/pm/overlap-check.mjs` exit 0 against `origin/main` and
the open PRs sharing these files (objectstack-ai#37422, objectstack-ai#37366).

Contract review (L2) is owed before landing: the diff changes
`packages/spec/src/**` and declares `Clause-②: yes (widening)`. Changed
lines exceed 3,000, so landing needs an authorized approval.

## 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.
- [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: its generated artifacts are
regenerated and committed.
- [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.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

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

https://claude.ai/code/session_01L6bhgUpnvPnJ1hR74pUrVj

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

<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgUpnvPnJ1hR74pUrVj -->

---------

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

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDJAbBe3iTrFcF7GZrucZ32)_

Fixes objectstack-ai#36423

The card's second item, time in column, was dropped by the maintainer's
ruling 7122246952 (「不需要这个功能」); this card's acceptance is the first item
alone, the comment and attachment counts, under the seat routes recorded
with the stage-1 readings (7121884710): the comment count is the
open-thread count the record page's icon shows, the reader is shared in
`plugin-detail`, and the read is one grouped read per counted object
over the loaded cards, never one per card.

## What changes

- **Spec.** `KanbanConfigSchema` gains `cardFooter: { comments?:
boolean, attachments?: boolean }`, optional, no default, an inline
`strictObject` (an unknown member is refused by name, so a later foot
item is one more member). Regenerated: `authorable-surface/ui.json`,
`content/docs/references/ui/view.mdx`, the strictness-ledger counts; the
`kanban` liveness note cites the reader, the board and the pin test. New
`src/ui/kanban-config-card-footer.test.ts`.
- **Reader (`@object-ui/plugin-detail`, `comments/recordCounts.ts`).**
`useRecordCounts({ dataSource, objectName, recordIds, comments,
attachments, reloadKey })`, with `compileCommentCountQuery`,
`compileAttachmentCountQuery` and `readRecordCounts`. Both ride
`DataSource.queryGroupHeaders` (`POST /data/:object/query`, the reader's
permissions):
- comments: `sys_comment` where `object_name` is the object, `record_id`
is one of the cards, `parent_id` is empty and `is_resolved` is not
`true` (the SQL driver's `$ne` is NULL-safe, so a deployment that stores
no resolution counts every thread), grouped by `record_id`;
- attachments: `sys_attachment` where `parent_object` is the object and
`parent_id` is one of the cards, grouped by `parent_id`.
A refused read draws no count. A cut answer (`hasMore`: the door cut the
groups to `OS_DATA_DEFAULT_PAGE_SIZE`) is never read as the whole set:
`askRecordCounts` keeps the exact counts of the records it names and
asks again, still one grouped read per round, over the records it did
not name, until an answer is whole, names none of them, or
`MAX_COUNT_ROUNDS` (20) is reached; a record still unnamed then has no
count, never a zero.
The counts are asked again on a write to the counted object announced on
the data-invalidation bus (`sys_comment` / `sys_attachment`), and while
a new set of cards is asked (a lane's next page, a card created) the
cards in both sets keep their counts, so no foot blinks.
- **Attachments panel (`@object-ui/app-shell`,
`RecordAttachmentsPanel`).** An upload and the uploader's own delete go
through the storage route, not the data source, so no mutation event
carried them; the panel now announces each as a `sys_attachment` write
(`notifyDataChanged`). A delete through the data door is announced by
the data source's own mutation event, as a comment posted through the
data source is.
- **Record page (`@object-ui/app-shell`, `RecordDetailView`).**
Resolving or reopening a thread (the resolution door, `PUT
/api/v1/comments/:id/resolution`) and a member's delete of their own
comment (the own-comment door, `DELETE /api/v1/comments/:id`) go through
the authenticated fetch, not the data source; each stored write is now
announced as a `sys_comment` write. A refused write is not.
- **Board (`@object-ui/plugin-kanban`).** `ObjectKanban` asks comments
only on an object with `enable.feeds !== false` and attachments only on
one with `enable.files === true`, once its definition settles, and
re-asks on refresh, invalidation and a host reload. The counts reach the
cards through the existing `KanbanCardDisplay` context; `SortableCard`
draws a foot (`data-kanban-card-footer`) with each count above zero.
- **Relay.** `ListView` (`case 'kanban'`),
`ObjectView#generateViewSchema` and the Console's `kanbanViewOptions`
relay `cardFooter` only when declared.
- **视图设置.** Beside the two card toggles: 「显示评论数」 / 「显示附件数」, each offered
only where the object has that count, both off by default. A toggle
writes its member on or gone; turning the last one off writes no
`cardFooter`.
- **i18n.** `list.optionsMenu.kanbanFooterComments`,
`kanbanFooterAttachments`, `kanban.cardFooter.comments`,
`kanban.cardFooter.attachments` in all 11 packs (zh-Hant generated); the
two `{{count}}` labels join the count-neutral list (the number stands
after a label and a colon).

## Decisions made here

- **Orphan replies are not counted.** On the record page a reply whose
parent was deleted is a thread of its own. The server read counts
top-level comments only (`parent_id` empty), so such a reply does not
count on the card. Counting it would need the parent's existence per
row, which a grouped read cannot see.
- **A replaced ask is not called off (review N4, accepted).** When a
newer ask replaces one in flight (a write announced mid-read, several
files uploaded one after another), the older answer is dropped, but
`askRecordCounts` takes no cancel signal, so over a cut answer its
remaining rounds still run. Only a deployment that cuts grouped reads
sees the extra reads; the reader's header states it.
- **Unstamped comments are not counted.** The record page reads a
record's comments by `thread_id`; the card counts by the stamped pair
`object_name` + `record_id`, the indexed key the read gate narrows by. A
comment written before the pair existed is not counted on the card until
`os migrate comment-parent-pair --apply` has stamped it.
- **The footer toggles are offered by capability**, comments where
`enable.feeds` is on (opt-out, as the record page), attachments where
`enable.files` is on (opt-in), so an author is not offered a count the
object cannot have.

## Verification

- New tests, all green:
- `plugin-kanban/src/ObjectKanban.cardFooter-36423.test.tsx` (4): the
counts per card from exactly one `sys_comment` and one `sys_attachment`
read over the loaded ids (resolved threads, replies and another object's
rows not counted); nothing read or drawn without the key or with both
members off; a count the object lacks is never asked; a refused read
draws no count while the other still draws. With the board's footer read
turned off, 3 of the 4 go red (the "nothing read" case is a control).
- `plugin-detail/src/comments/recordCounts-36423.test.tsx` (8): the
compiled reads, the answer's reading, and the hook's asking (once per
set, again on a new set or reload key, never for a count not asked, no
records, or a source without the grouped door).
- `plugin-list/src/__tests__/ListView.kanbanCardFooter-36423.test.tsx`
(3): relay, the toggles' writes, and the capability gating.
- `spec/src/ui/kanban-config-card-footer.test.ts` (3), plus a case each
in `app-shell/.../kanbanDraft-36370.test.ts` and
`plugin-view/.../ObjectView.harness.test.tsx`.
- `pnpm --dir ui exec vitest run` over `plugin-kanban`, `i18n`,
`plugin-detail/src/comments` and the list's kanban and view-settings
tests: 2,785 green. `packages/spec`: 30,067 green; the one red
(`scripts/def-key-collisions.test.ts`) fails to find `tsx` in a temp
copy of this worktree's `node_modules` and does not touch this diff.
- `check:authorable-surface`, `check:docs`, `check:liveness`,
`check:variant-docs`, `check:api-surface`, `check:export-origins`,
`check:declaration-map`: pass. `type-check` for `plugin-detail`,
`plugin-kanban`, `plugin-list`, `plugin-view`: clean. `eslint` on the
changed files: 0 errors.
- `overlap-check`: exit 0 (shares files with objectstack-ai#37581, objectstack-ai#37422, objectstack-ai#37366;
each merges cleanly).

### Contract review round 1 (7202278679): S1, S2, N1, N2

- **S1** (a cut answer drawn as a whole one): `askRecordCounts` reads
`hasMore` off the answer and asks again over the unnamed records. Pins:
`recordCounts-36423.test.tsx` (the second round asks only the records
the first did not name; one read when whole; an answer naming none
stops) and board case (e) (a page of one group: every card past the cut
shows its count, two grouped reads).
- **S2** (no re-ask after a counted row is written): the reader
subscribes to the bus for each counted object it asks; the Attachments
panel announces its storage-route upload and own delete. Pins: the hook
re-asks on a `sys_comment` write and not on another object's; board case
(f) (a thread posted on another card draws its count);
`RecordAttachmentsPanel.announce-36423.test.tsx` (3: upload announced,
refused upload not, own delete announced).
- **N1**: both exceptions to "the record page's number" are now in the
changeset and above. The `cardFooter` jsdoc follows with the next change
to `view.zod.ts`, as the review allows; this round leaves
`packages/spec` untouched.
- **N2**: the counts of cards in both sets stay drawn while a new set is
asked; another object's counts never.
- With the cut loop and the bus subscription turned off, 4 of the new
cases go red. `vitest` over `plugin-detail`, `plugin-kanban`, the
Attachments panel tests and the list's footer test: 4,666 green.
`type-check` for `plugin-detail`, `plugin-kanban` and the changed
`app-shell` files: clean; `eslint`: 0 errors.

Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up objectstack-ai#37612

## 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; `eslint` on the changed files passes (the
full `pnpm lint` runs in CI).
- [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: its generated artifacts are
regenerated and committed.
- [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 *Before Submitting* list in CONTRIBUTING.md is done. (full
local suite not run; CI carries it)

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

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

https://claude.ai/code/session_01L6bhgUuauSMJu1nVSQRQri

### Contract review round 2 (7203377375): S2 remainder, N3, N4

- **S2** (the comment doors): `handleResolveComment` and the own-comment
branch of `handleDeleteComment` announce a `sys_comment` write once the
door answers. Pins in `RecordDetailView.commentsResolved-36075.test.tsx`
(4): a stored ✓ is announced, a refused ✓ is not, a member's door delete
is announced, a refused door delete is not. With the two announcements
removed, the two "announced" cases go red. The reader's header now lists
which drawer writes reach the bus and how.
- **N3** (seat ruling: in this commit): the `cardFooter` jsdoc and
`describe` in `view.zod.ts` and the `kanban` liveness note say one
grouped read per counted object, and over a cut answer one more over the
cards it did not name, up to 20; the jsdoc also names both exceptions to
the record page's number (round 1's N1). Regenerated
`content/docs/references/ui/view.mdx`; `check:generated`,
`check:authorable-surface`, `check:docs`, `check:liveness`,
`check:api-surface`, `check:variant-docs` pass. The changeset names
`MAX_COUNT_ROUNDS` and the 20-read bound.
- **N4**: accepted and stated (see Decisions).
- `vitest` over every `RecordDetailView` test (873),
`plugin-detail/src/comments`, the board's footer test and the
Attachments panel tests: green. `packages/spec` `view.test.ts` and the
footer spec test: 492 green. `type-check` on the changed `app-shell`
files: clean; `eslint`: 0 errors.

<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgUuauSMJu1nVSQRQri -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…ell was scoped by; a scope no read could filter by says so (objectstack-ai#37706)

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDqyPrPQvkURDXnUDgkyFWB)_

Fixes objectstack-ai#36794 (PR-2 of 2; PR-1 objectstack-ai#37567 landed the spec reason and the
importer)

Clause-②: yes (widening)
Metadata-protocol: none

## 维护者速读

- 导入向导在预检和完成页上,对“查找值属于另一个父记录”的情况显示专门的提示,例如 `"Design review" was found,
but not under Project "Gemini"`。提示会用标签说出限定它的列和本行填的值,11 种界面语言都已翻译。
- 补上契约审核提出的一个漏洞:如果 `dependsOn`
指向一个引擎无法筛选的字段(比如公式),限定查询一次都没跑成。这种情况以前会被误报成“在别的父记录下”,现在照旧报“找不到记录”,提示语改为说明无法在这个范围内查找,需要给
`dependsOn` 换一列。
- 只影响导入失败行的显示文字和一种配置错误时的错误码,成功导入不受影响,没有新增可写的元数据键。整张 PR 可以直接撤回。
- 无。

## What changes

- **Import Wizard** (`ui/packages/plugin-grid/src/ImportWizard.tsx`):
`formatDryRunError` gains `case 'reference_out_of_scope'`, rendered from
the cell error's structured `scope`. Each entry is named by the
importing object's field label (its api-name when it has none) with the
cell the row gave it, joined in the order the server sent them by the
pack's own separator (`grid.import.scopeSeparator`: `、` in ja and zh, `،
` in ar; review N3). The Wizard keys on the code and `scope` only and
never parses the server sentence; a cell error with no `scope` falls
through to the server's own sentence (already in the caller's locale),
the same path an unknown code takes. `scope` is carried onto
`ImportResult.errors` by both the synchronous import mapping and
`jobResultToImportResult`, so the completion screen renders the same
text as the dry-run panel. New keys `grid.import.referenceOutOfScope`,
`grid.import.scopeEntry` and `grid.import.scopeSeparator` are in the
Wizard's default dictionary and in all 11 locales under
`ui/packages/i18n/src/locales/`.
- **Review nit 2, a scope no read could filter by**
(`packages/core/src/utils/import-runner.ts`, `import-coerce.ts`): the
resolver records whether any scoped candidate read ran to an answer, and
whether a read was refused by the engine's filter seam for the scope:
`isScopeFilterRefusal`, the declared `code: 'INVALID_FIELD'` naming a
scope field in `fields`, read off the refusal like `isScopeFieldDenial`,
never its message. Only when no read answered and such a refusal was
seen (the `dependsOn` `param` names a target field the engine cannot
filter by, such as a `formula`) does it return
`RefMatch.scopeUnqueryable`. A lookup whose reads are all refused for
any other reason (no read grant on the target, a driver fault) keeps the
plain miss and the plain sentence (contract review S1, 7204641031). That
cell keeps `reference_not_found`, with no unscoped probe and no `scope`,
and gets its own catalog sentence `import_reference_scope_unqueryable`,
whose remedy names the target field the `dependsOn` entry filters by
("point that dependsOn entry at a stored field", review N1)
(`packages/spec/src/system/validation-message.ts`, all four platform
locales). **Chosen: the runtime answer, no lint.** A lint refusing such
a `dependsOn` would refuse metadata that publishes today, which is a
narrowing that needs its own card. Before this PR that cell answered
`reference_out_of_scope` once the unscoped probe found the value, which
claimed a fact the import never checked.
- **Review nit 1**: `ImportRowResultSchema.errors` describe
(`packages/spec/src/api/export.zod.ts`) and the runner's
`ImportRowResult.errors` jsdoc now say a `reference_out_of_scope`
element carries `scope`. Regenerated
`content/docs/references/api/export.mdx`.
- **Review nit 4**: `content/docs/api/error-catalog.mdx` now says
`scope` names the row's own scoping columns and the cells the row gave
them, not the parent's columns.
- `content/docs/data-modeling/import-mappings.mdx`, scoped-lookup
section: a `dependsOn` `param` naming a formula cannot scope the lookup,
and the cell answers `reference_not_found` with the could-not-look-up
sentence; any other refusal keeps the plain sentence.
- Changeset: `@objectstack/spec`, `@objectstack/core`,
`@object-ui/plugin-grid` and `@object-ui/i18n` patch.
`Metadata-protocol: none`: no key enters
`packages/spec/authorable-surface/*.json`, because `check:generated`
moved only the references page. The new catalog key is message
vocabulary, the same class as PR-1's `import_reference_out_of_scope`,
which its claim also read as `none`. `Clause-②: yes (widening)`: a new
catalog key a deployment can override, and a wire answer that only
becomes more precise for a case no released version answered
`reference_out_of_scope` for.

## Tests

- **Review nit 3, a real engine and the real field guard**
(`packages/qa/dogfood/test/import-reference-out-of-scope.dogfood.test.ts`):
a booted stack with the real `SecurityPlugin`, ObjectQL, SQL driver and
the REST import door, plus a fixture member whose permission set hides
`oos_task.project`. The guard is shown live first: the member's filter
on that field gets 403, the admin's gets 200. The pins:
- Admin, a task of another project: `reference_out_of_scope` with
`scope: [{ field: 'project', value: 'Gemini' }]`. The in-scope row
resolves and stores the id. A value nobody has: `reference_not_found`
with no `scope`.
- Member, the same rows: `reference_not_found`, plain sentence, no
`scope`, including the row whose task really is under its own project.
- A `dependsOn` whose `param` is a formula: `reference_not_found` with
the `import_reference_scope_unqueryable` sentence.
- None of these reads the guard's reason across a package as a string.
Each answer comes from the real seam.
- Ablation (dogfood): with the `isScopeFieldDenial` branch disabled, the
member pin goes red. With the `scopeUnqueryable` assignment disabled,
the formula pin goes red (2 failed / 2 passed). Restored: 4 passed.
-
`packages/core/src/utils/import-runner-reference-master-scope.test.ts`:
a new pin in which every scoped read is refused `INVALID_FIELD` naming
the scope field. It answers `reference_not_found` with the new sentence,
no `scope`, and no unscoped probe. Two pins for S1: every read refused
`PERMISSION_DENIED` naming no field, and every read refused
`INVALID_FIELD` naming a field outside the scope; both answer the plain
sentence.
- `packages/spec/src/system/validation-message.test.ts`: every locale of
`import_reference_scope_unqueryable` interpolates `{{value}}` and
`{{scope}}` and names `dependsOn`; the English render.
- `ui/packages/plugin-grid/src/importDryRun.test.ts`: the new case names
the scope column by its label and the row's cell; a multi-column scope
names every column (one without a label by api-name), joined by the
pack's separator; it is never rendered as "no matching record"; with no
`scope`, the server sentence is shown minus the api-name prefix.
`importAsyncPath.test.ts`: `jobResultToImportResult` carries `scope`
onto the error.

<details><summary>Local readings (tree 8b99fd1, on main fbcfdfb; round
2 head f9dcf30: core master-scope 19 passed, spec validation-message 45
passed, dogfood out-of-scope 4 passed, ui i18n + plugin-grid 428 files /
4822 passed, plugin-grid type-check and core tsc green)</summary>

- `pnpm --filter @objectstack/spec check:generated --fix`: 1 stale
(`content/docs/references/**`, the `errors` describe), green after;
nothing under `packages/spec/authorable-surface/` moved.
- `typecheck` core and spec: green. `type-check`
`@object-ui/plugin-grid` and `@object-ui/i18n` (deps built): green.
`lint` plugin-grid: 0 errors.
- `pnpm --dir ui exec vitest run packages/i18n/ packages/plugin-grid/`:
two i18n census pins moved with the new keys and were updated in this PR
(`de-quote-pairing-3876`, 133 → 135 paired spans;
`untranslated-identity-4376`, `grid.import.scopeEntry` allowlisted as a
format string). After that: i18n 111 files / 2028 passed; plugin-grid
files green (the first run's only 3 failures were those two i18n pins).
- spec `src/system/` + `src/data/mapping.test.ts`: 80 files / 2841
passed. core `src/utils/`: 51 files / 1356 passed.
- dogfood `import-reference-out-of-scope` + `import-reference-exposure`:
2 files / 15 passed (core built from this tree).
- `node scripts/pm/overlap-check.mjs`: VERDICT clean exit 0 (main,
objectstack-ai#37676, objectstack-ai#37667, objectstack-ai#37422).

</details>

## Acceptance notes

- The unfilterable-scope cell keeps the `reference_not_found` code, so
the Wizard shows its generic "No matching record" text there. The
precise sentence reaches API callers in the cell error's `message`. That
case is an authoring mistake that a Wizard user cannot fix, and a code
of its own would be a new `FieldErrorCode` member, which needs its own
contract review. Left as it is.

## Verification

Read first: `formatDryRunError` in `ImportWizard.tsx` (`case
'reference_out_of_scope'`), the resolver's `lookup` in
`import-runner.ts` (`asked`, `scopeUnqueryable`), and
`referenceNotFound` in `import-coerce.ts`.

Two-minute check: `pnpm --dir ui exec vitest run
packages/plugin-grid/src/importDryRun.test.ts -t
"reference_out_of_scope"` runs 4 tests, all green.

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

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

https://claude.ai/code/session_01L6bhgWgMUXf5juNBhN6rLX

<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgWgMUXf5juNBhN6rLX -->

---------

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

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuPE7uyDAJyqjwwMzomWv5ff)_

Fixes objectstack-ai#37625

Clause-②: no (published prose and comments only; no behaviour changes)
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:多语言技能文档里,「语言接口由翻译服务自己注册」这句话改成了「由运行时的 HTTP
分发器挂载,数据来自翻译服务」,同时在方法清单里补上 `getSourceLocale()` / `setSourceLocale()`。两处
spec 代码注释也做了同样的更正。代码和平台行为都不变。
- 为什么做:objectstack-ai#37614 的审核发现这句话与 main 不符:翻译服务从 objectstack-ai#23347 起就不再挂任何 HTTP
路由。自己手工组装内核的开发者照旧文档做,会以为装了翻译服务就有这三个接口,实际上没有。
- 出错会怎样:只改文字,撤回即可。为了不超出技能篇幅上限,同一文件里压缩了四处措辞,没有删掉事实。
- 要你做什么:这是受管的技能文件,需要审批人批准后才能合并。

## What changes

- **`skills/objectstack-i18n/SKILL.md`, Registration.** Before: "It
self-registers `GET /api/v1/i18n/locales`, `/translations/:locale` and
`/labels/:object/:locale`; …". After: "The runtime's HTTP dispatcher,
which `os serve` composes, mounts `GET /api/v1/i18n/locales`,
`/translations/:locale` and `/labels/:object/:locale`, served from the
i18n service; …". The rest of the sentence (the `isDefault` /
`sourceLocale` clause) is unchanged. Checked on `main`:
`packages/services/service-i18n/src/i18n-service-plugin.ts:27-39` ("It
mounts NO HTTP route", naming `createDispatcherPlugin` the one owner);
`packages/runtime/src/dispatcher-plugin.ts:1752`, `:1761`, `:1770` mount
the three paths; `packages/cli/src/commands/serve.ts` composes
`createDispatcherPlugin`.
- **Same file, methods list (the card's optional item).** The
`getLocales()` bullet gains `getSourceLocale()` / `setSourceLocale()`:
both shipped implementations provide them (`file-i18n-adapter.ts:302`,
`:307`; `core/src/fallbacks/memory-i18n.ts:275`, `:280`).
`getFallbackLocale()` is left out: the file adapter has it (`:285`) but
the in-memory fallback deliberately does not (its docblock at `:254`),
and the list is "methods both shipped adapters implement".
- **Paid in the same file, no fact removed** (6306 → 6333 tokens,
ceiling 6333): "is not in `node_modules` to read" → "is not in
`node_modules`"; "Methods implemented by both shipped adapters" →
"Methods both shipped adapters implement"; "full snapshot for a locale"
→ "a locale's full snapshot"; "You do not wire this plugin" → "Don't
wire this plugin".
- **Spec comments.** The `GetLocalesResponseSchema` docblock
(`packages/spec/src/api/protocol.zod.ts`) said the descriptor helper is
shared by the dispatcher's `/i18n` domain "and `service-i18n`'s
autonomous route"; it now names the dispatcher as the route's one owner
(`service-i18n` mounts none since objectstack-ai#23347). The `toLocaleDescriptors`
comment (`packages/spec/src/system/i18n-resolver.ts`) now says both once
served the route and the dispatcher owns it. Comments only: no schema,
describe or export changes.
- **Changeset**: `@objectstack/skills` and `@objectstack/spec` patch.

Small calls made here (no card): the skill names "the runtime's HTTP
dispatcher, which `os serve` composes" rather than the internal
`createDispatcherPlugin` name, which a client author cannot act on.

## Why

Review N1 of PR objectstack-ai#37614 (contract record 7197064778): a shipped skill
stated a wrong fact about where the i18n routes come from.

## Verification

Run at `a359107dd`, each exit 0:
- `node scripts/check-skills-token-ratchet.mjs`
(`skills/objectstack-i18n/SKILL.md` 6333/6333).
- `node scripts/check-skill-links.mjs`, `node
scripts/check-skill-identifier-liveness.mjs`, `node
scripts/check-skill-top-level-keys.mjs`.
- `pnpm --filter @objectstack/spec check:skill-refs`,
`check:skill-docs`.
- `node scripts/pm/overlap-check.mjs`: clean (objectstack-ai#37422 and objectstack-ai#37366 share
`i18n-resolver.ts` and merge cleanly).

The skill edit was drafted by a contract-tier subagent, as
`dispatch-gates --tier` requires for `skills/**`, and checked here
against the cited lines; the spec comments were edited here.

Contract review (L2) is owed before landing: `skills/**` is a governed
surface (Tier H).

## 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.
- [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: its generated artifacts are
regenerated and committed (comments only; none change).
- [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.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

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

https://claude.ai/code/session_01L6bhgUpnvPnJ1hR74pUrVj

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

<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgUpnvPnJ1hR74pUrVj -->

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…ways listed in the menu (objectstack-ai#37599)

<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wg2QYE8ncGrwckXw5L9fxrXY)_

repo:objectstack#5 · os-bill · session_01Utp6CbgELiNQU6e7me1RQy

Fixes objectstack-ai#37564

Clause-②: no
Metadata-protocol: none
Container & model: `M`, `mode:thread`, `model: CONTRACT_REVIEW_TIER
(dispatch-gates --tier: MANDATORY docs/adr/**; served at tier, read from
the thread's session record)`, `effort: xhigh (reason: ADR-0084 revision
plus a spec registry value, standing ADR-revision order)`

## 维护者速读

- 用户能看到什么变化:在 Studio
左侧菜单里,「数据集」从「界面」组的「高级」折叠里挪到「数据」组,紧跟在「对象」后面;「岗位」从「高级」折叠里挪到「访问」组,紧跟在「权限集」后面。两项始终显示,软件包里一个都没有也显示。
- 为什么做:属于「Studio 是开发软件包的入口」这一轮菜单整理,落实你 11 月 26 日对架构记录 ADR-0084
的裁定:数据集是图表和 AI 问数共用的语义层,归数据;数据集和岗位都是常用项。记录里的类型归组表同步改成和菜单一致。
-
出错会怎样:只影响这两类在菜单、类型目录里的位置和分组徽标,数据集本身的读写、图表、问数都不受影响,可以直接撤回。有一个对外可见的值变了:类型列表接口里数据集的归组由「界面」变成「数据」,按归组挑数据集的外部代码要跟着改。
- 要你做什么:批准并合入(改了架构记录,属于受管文件,需要 os-zhuang 和 hotlong 批准)。没有需要你裁定的问题。

## What changes

Nine files, +192 / −34 against `main` (merge base `9a65a48f`: `main` has
been merged in twice, each time for a neighbour that landed; head
`d2c2cb98`). This PR carries out ADR-0084's [Amendment (2026-11-26),
"Placements, and what moves to
Setup"](https://github.com/objectstack-ai/objectstack/blob/main/docs/adr/0084-application-builder-information-architecture.md#amendment-2026-11-26-moves)
for two rows, `dataset` and `position`, and decides nothing.

| Where | What changes |
|---|---|
| `packages/spec/src/kernel/metadata-plugin.zod.ts` | One value: the
`dataset` row of `DEFAULT_METADATA_TYPE_REGISTRY` reads `domain:
'data'`; it was `'ui'`. A comment above the row says why. The row keeps
its place in the block and its `loadOrder` (55). |
| `ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts`
| `dataset` and `position` move into the common rows, **by name**:
`dataset` directly after `object`, `position` directly after
`permission`. Each row carries its reason in a comment: a dataset's
schema requires one object, and a position is one slot per name in the
environment (ADR-0150 D7), so the rule's tests alone would sort each of
them advanced. Twelve common rows, twenty advanced. |
| `docs/adr/0084-application-builder-information-architecture.md` | The
type-to-group table: `dataset` is row 2 of 数据 Data, tier 常用, and the
five data types behind it are each one place later; its 界面 UI row is
gone; `position` keeps its place and its tier reads 常用. One note under
the table and one dated mark on the amendment's "not redrawn today"
paragraph say the two rows are rewritten and that `datasource` and
`form` still wait for their own changes. Nit N8 of the contract record
on PR objectstack-ai#37470: the 2026-11-24 top note's 2026-11-26 mark now links
`#amendment-2026-11-26-position`. Still 32 rows of the pinned shape, in
one table. |
| Four test files under `ui/packages/app-shell/src/views/studio-design/`
and `packages/spec/src/kernel/metadata-plugin.test.ts` | The pins,
below. |
| `.changeset/37564-dataset-data-domain-common-tier.md` |
`@objectstack/spec` patch, `@object-ui/app-shell` patch. |

**What follows from the registry value, with no edit.** The menu, the
type directory and the type page's group badge read the served `domain`,
so all three show datasets under 数据 Data. `studioMenuModel.ts` and
`StudioMenu.tsx` are not touched: the model reads the placement list and
needs no special case.

**A served value changes.** `GET /api/v1/meta/types` answers `domain:
"data"` for the `dataset` entry, and the listing is ordered by domain
and then by type, so the entry now sits first among the data types. Read
on a live showcase backend built from this branch: `data:dataset
data:field data:hook data:mapping data:object …`. Code that finds the
entry by `type` sees no difference. The changeset says this in the
release note.

**Why `Clause-②: no` and `Metadata-protocol: none`.** No accepted set
widens or narrows: the `domain` enum keeps its six values, no author
writes the registry, and a `*.dataset.ts` item validates and loads as it
did. No export, key or type is added, and the constant's declared type
is the same. `pnpm --filter @objectstack/spec check:generated` reads
"All 14 generated artifacts are up to date", so neither the API surface
nor the authorable surface moved.

**Not touched, as the card says.** The `datasource` row, and `form`
(ADR-0159): `form` is not registered at this base, so it has no row. The
`typescript-serializer.ts` entry that maps `dataset` to `['Dataset',
'ui']` is the spec subpath the schema is imported from, not the domain;
the schema still lives in `ui/dataset.zod.ts`.

**Read first**, by risk:

1. `packages/spec/src/kernel/metadata-plugin.zod.ts`, the one-value hunk
on the `dataset` row: it changes a served value.
2. `docs/adr/0084-application-builder-information-architecture.md`, the
table hunk: governed text, and the order of the 数据 Data rows is what the
pin test compares to the placement list.
3.
`ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts`,
the two rows that move into the common block.

**Two-minute verification**: after `pnpm --filter @objectstack/spec
build`, run `pnpm --dir ui exec vitest run
packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts`
and expect `Tests 17 passed (17)`. It reads the registry, the placement
list and ADR-0084's table, and fails if any two of the three disagree.

## Tests

- `packages/spec/src/kernel/metadata-plugin.test.ts`: a new case pins
`dataset` under `data`, `dashboard` and `report` under `ui`, and the
six-value domain set. 41 of 41.
- `studioMenuPlacement.test.ts`: the literal lists (twelve common,
twenty advanced), a case for the two placements by name, and a new block
that reads the three groups this change touches as ADR-0084 lists them.
The existing block that compares the list with the ADR's Order and Tier
columns, row by row, passes against the rewritten rows. 17 of 17.
- `studioMenuModel.test.ts` and `StudioMenu.test.tsx`: the served
fixture gains `dataset` under `data`; the common tier, the always-listed
set and the fold are pinned with both types above the fold; a new block
in `StudioMenu.test.tsx` asserts that 数据 draws object then dataset, 访问
draws permission then position, neither is inside the fold, and each
links to its type page on an empty package, with a control (`hook` stays
in the fold).
- `StudioPaletteGroups.surfaceScope-36900.test.tsx`: the command palette
draws the menu's entries, so `position` now follows `permission` there
and its list is read. Two expectations, test only.
- The four UI files together: 92 of 92 on `c2e09545`. On the merged head
`2762c831` the affected run (every test file that reads the placement
list, the directory grouping or the package overview) is 85 files, 730
tests, all passed, and the spec pin is 41 of 41. After the second merge,
on `d2c2cb98`: the same selection is 85 files, 747 tests, all passed
(the 17 tests more are `main`'s), and the spec pin is 41 of 41.

**Reverse verification**, read on `c2e09545` (neither merge changes the
registry row, the placement list, or a line this PR adds to or removes
from these pins), each mutation made with `scripts/ablation-replace.mjs`
on a committed tree and restored to `HEAD` (blob equal to `HEAD`, `git
diff HEAD` empty after each):

| Mutation | Reading |
|---|---|
| Registry: `dataset` back to `domain: 'ui'`, spec rebuilt, `dist` read
back as `ui` | spec pin: 1 failed, 40 passed.
`studioMenuPlacement.test.ts`: 5 failed, 12 passed (the ADR's group
against the served domain, the order inside the group, and the new group
block). |
| Placement list: `position` back to `advanced` | 14 failed, 78 passed,
in all four UI files. |
| Placement list: `dataset` back to `advanced` | 12 failed, 80 passed,
in three UI files. The palette file stays green: its fixture serves no
dataset. |

After the registry leg the package was rebuilt from the restored source
and `scripts/ablation-dist-preflight.mjs … --absent` read the marker
gone from all 614 built files; both pins passed again (41 of 41, 17 of
17).

## Acceptance notes

- **The card's acceptance, line by line.** The menu draws dataset under
数据 directly after 对象, and position under 访问 directly after 权限集, both
outside the 高级 fold: read off a live Console on the showcase package in
zh-CN, light and dark (`数据: 对象 24 · 数据集 4`, `访问: 权限集 9 · 岗位 10`; the
opened fold lists 18 entries and neither of the two). The dataset page's
group badge reads 数据. The pin test is green against the rewritten rows.
A spec test covers the registry value.
- **Screenshots.** Eight PNGs, light and dark: the dataset list with the
menu, the menu alone, the menu with the fold opened, and the position
list. They are in the project's shared files under
`objectstack-seat5/topic-37424/cards/shots-37564/` and attached in the
project thread; the relay cannot upload images to a PR.
- **One test outside the two the claim named.** The affected-test run
named `StudioPaletteGroups.surfaceScope-36900.test.tsx`, which pins the
entries a package always lists. The area confirmed it is inside the
claim's class before the edit was pushed.
- **The claim was posted by the area**, not by this thread (comment
7193675575 on the card). The dispatch order asked the thread to write
it; `os-dev.md` says a dispatched executor writes no claim and no
assignee, and that file wins over an order.
- **Neighbours.** `main` has been merged into this branch twice, each
time because a neighbour landed in a shared test file.
- First, at `4e10d4bf`, after PR objectstack-ai#37546 (card objectstack-ai#37454) landed at 16:13Z.
One conflict, in `StudioMenu.test.tsx`: `main` asserts that the overview
row leads the menu, and this branch's list of common types holds
`dataset` and `position`; both are kept.
- Second, at `9a65a48f`, after PR objectstack-ai#37602 (card objectstack-ai#37565) landed and the
merge queue removed this PR at 19:13Z for a merge conflict. One
conflict, in `studioMenuModel.test.ts`, on two adjacent lines of one
test: `main` builds the environment's menu with the Setup directory, and
this branch's comment on the next line no longer calls `position` an
advanced type. `main`'s call and this branch's comment are kept.
`StudioMenu.test.tsx` and the palette test merged without a conflict.
- PR objectstack-ai#37422 shares the registry file; `overlap-check.mjs` reads it as
merging cleanly with this head.
- **Contract record.** Comment 7196507657 on this PR reads PASS on
`c2e09545`, and the delta record 7198537944 reads PASS on `2762c831`,
each with no must-fix and no should-fix. Nit N1 is closed (the mark on
the "not redrawn today" paragraph opens with its date); N2 stays as the
accepted deviation the record names. Since the delta record, the lines
this PR adds and removes against its merge base are byte-identical in
all nine files (`git diff 4e10d4b 2762c83` against `git diff 9a65a48
d2c2cb9`, per file, added and removed lines only): the second merge
changed only what `main` brought.
- **Tier H by path.** `docs/adr/**` (AGENTS.md Prime Directive objectstack-ai#14):
approvers os-zhuang and hotlong, and the maintainer merges. The PR stays
a draft. The `Rule-change` line is left out, as the template asks for a
diff that does not touch `.claude/**`.
- **No docs page is owed.** No page under `content/docs/`, no skill and
no README places `dataset` in a Studio group or describes the menu's
tiers. The Docs Drift Check lists three pages that name
`DEFAULT_METADATA_TYPE_REGISTRY` (`concepts/metadata-lifecycle.mdx`,
`plugins/adding-a-metadata-type.mdx`, `protocol/objectui/concept.mdx`);
each was re-read, and none states `dataset`'s domain.

## Verification

- Head `d2c2cb98`: six commits on the branch, of which two are merges of
`main` (at `4e10d4bf` and at `9a65a48f`) and one dates the mark. No
message names a card.
- Gate list derived on `d2c2cb98`: `node scripts/pm/dispatch-gates.mjs
--commands` prints 98 commands, line for line the 98 derived on the two
earlier heads.
- All 98 exited 0 on `d2c2cb98`, each exit code captured before any
pipe, after `pnpm install --frozen-lockfile` and a full rebuild of the
merged tree (123 of 123 tasks, none cached). `--ran` reconciliation: `98
derived famil(ies) accounted for — 98 run, 0 NOT-MEASURED`.
- The same list was 98 of 98 on `2762c831` (after the first merge) and
on `c2e09545`. Two reds of the very first pass were the container, not
the diff, and each passed when run again alone:
`check-plugin-teardown-shape.mjs --self-test` needs a pinned fixture
commit that a shallow clone lacks; `pnpm --dir ui exec vitest run
scripts/` was killed by the container's memory limit while another test
run shared the box.
- Tests on `d2c2cb98` under the verify lock: spec pin 41 of 41; affected
UI run 85 files, 747 tests, all passed. On `2762c831`: 85 files, 730
tests, all passed. On `c2e09545`: 82 files, 664 tests; 662 passed on the
first run and the 2 that failed were the palette expectations above,
fixed in that head.
- Type checks were run locally on `c2e09545` (`pnpm --filter
@objectstack/spec run typecheck`, `pnpm --filter @object-ui/app-shell
run type-check`, `eslint` on the seven changed source and test files,
`pnpm --dir ui run check:new-line-citations`: each exit 0). They were
not run again locally on either merged head; the type-check lanes are
this PR's check-runs. The three reverse verifications were not run again
either, for the reason given above them.
- `overlap-check.mjs` on `d2c2cb98`: clean against `origin/main`
`1dbf19a1` and the one open PR head that shares a file.
- `dispatch-gates --tier`: `docs/adr/**` is the mandatory contract tier;
changed lines 226 against the human-merge threshold 3000: under.
- `check-prior-rulings --paths` on the ADR, the registry file and the
placement list (read on `c2e09545`; neither merge changed the ADR): the
2026-11-24, 2026-11-25 and 2026-11-26 amendments of ADR-0084 are the
rulings in force; this PR changes no decision of any of them.
- CI was green on `c2e09545` and on `2762c831` (72 check-runs: 60
success, 12 skipped, none failed). CI on `d2c2cb98` is this PR's
check-runs; the third report on the card cites them.

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

https://claude.ai/code/session_01Utp6CbgELiNQU6e7me1RQy

<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6CbgELiNQU6e7me1RQy -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…he record form and /forms/NAME (objectstack-ai#37743)

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDJAbBe3iTrFcF7GZrucZ32)_

Fixes objectstack-ai#37677

A `repeater` field with no `span` rendered one cell wide in a two-column
form, on the record form and on `/forms/NAME`, though the spec's form
field `span` docblock lists repeater among the types that take the whole
row on `span: 'auto'`.

## Premise, measured on `main` (94843b8)

A two-column form with a text field, a textarea and a repeater, no
`span` anywhere:

| Renderer | textarea row | repeater row |
|---|---|---|
| Record Edit dialog (`ModalForm`, `columns: 2`) | `@md:col-span-2` | no
span class (one cell) |
| `/forms/NAME` (`FormPage`, 2-column section) | `sm:col-span-2` | no
span class (one cell) |

The contract side is right and the renderers are wrong: repeater used to
reach the full row through the wide `field:grid` widget it mapped to.
Since objectui#11448 it maps to `field:object`, the JSON editor that
`json`, `object`, `composite` and `record` also take, and `field:object`
is not on the wide list. Only the docblock's "through the `field:grid`
widget" clause was stale.

## What changes

- **`@object-ui/plugin-form` (`autoLayout.ts`).** The `span: 'auto'`
default (`isWideFormField`) also reads the OBJECT field's type off
`FormField.field`, through a new `WIDE_DECLARED_FIELD_TYPES =
{repeater}`. The same set is matched on `FormField.type` too, for the
caller that passes raw object-field types (app-shell's
`ObjectFormDesigner`). Neither `repeater` nor `field:object` joins
`WIDE_FIELD_TYPES`: `isWideFieldType` is the type-only answer
app-shell's `richtextSurfaceParity` test holds equal to plugin-detail's.
- **`@object-ui/console` (`FormPage.tsx`).** The named-form page now
passes the object field's `type` beside its `multiple` into
`resolveColSpan`, so both renderers read the same declaration.
- **`@object-ui/app-shell` (`ObjectFormDesigner.tsx`).** The Studio form
designer canvas now asks the form's own `span: 'auto'` default
(`resolveColSpan`, with the widget id as `type` and the raw type in the
stash) instead of `isWideFieldType` on the widget id, so it lays a
repeater out across the row as the runtime form does (contract review
S1). Every other type answers as before: the stash carries no
`multiple`.
- **`@objectstack/spec` (`view.zod.ts`, describe only).** The `span`
describe now says repeater is wide "by its object-field type: the JSON
editor it maps to is shared with json, composite and record, which stay
one cell". `liveness/view.json` row `form.sections` carries the re-read;
`content/docs/references/ui/view.mdx` regenerated.

## Decisions made here

- **Width by declaration, not by widget id.** Adding `field:object` to
the wide list would also widen `json`, `object`, `composite` and
`record`, which the docblock does not list. The multi-file rule already
reads `FormField.field` the same way.
- **Detail view not touched.** plugin-detail's own wide list has no
repeater either, but the card and the docblock are about the form `span`
key; the detail view's width is not part of this contract.

## Verification

- New and extended pins, red on `main` and green here (4 red with the
two source files reverted):
- `plugin-form/src/__tests__/repeaterAutoSpan-37677.test.tsx` (5): the
record Edit dialog renders the repeater row `@md:col-span-2`; a `json`
field on the same widget and a text field stay one cell (control);
`resolveColSpan` on `field:object` is 1 alone, full with `field.type:
'repeater'`, 1 with `field.type: 'json'`; the bare designer type is wide
through `resolveColSpan` while `isWideFieldType('repeater')` stays
false; an authored `colSpan: 1` still wins (control).
- `app-shell/src/views/studio-design/ObjectFormDesigner.test.tsx`: the
repeater pin ("lays a `repeater` field out the way the runtime form
resolves it") now asserts `col-span-full`; a new `json` control on the
same widget stays one cell.
`ObjectFormDesigner.typeName-13148.test.tsx`'s catalog sweep derived its
expected span from the canvas's old rule and went red on `5c42345811`
(Test UI 10/16); its control now expects a repeater to span the row
(fourth commit). All 12 `ObjectFormDesigner*` files: 82 green.
- `console/src/components/FormPage.fieldSpan-37559.test.tsx` (+3): a
repeater takes `sm:col-span-2`; a `json` field stays one cell; `colSpan:
1` on a repeater wins.
- `app-shell/src/views/richtextSurfaceParity.test.tsx` (unchanged): the
detail and form type-only wide sets still agree on every spec type. It
went red on the first head (`bb58f2016b`, Test UI 5/16) when `repeater`
sat on `WIDE_FIELD_TYPES`; the second commit moves it to the declaration
rule, and the test is green locally.
- `vitest` over all of `plugin-form` and every `FormPage*` test: green;
plugin-form `__tests__` re-run after the second commit: 1,031 passed.
`tsc -p tsconfig.test.json` for `plugin-form`: no errors in the changed
files. `eslint` on the changed files: 0 errors.
- After the review fixes (third commit): `ObjectFormDesigner.test.tsx`,
`richtextSurfaceParity`, `repeaterAutoSpan-37677` and
`autoLayout.test.ts`: 80 green; app-shell `tsc -p tsconfig.test.json`
clean on the designer files (with a rebuilt plugin-form dist); `eslint`:
0 errors.
- `packages/spec`: built, then `check:generated` (14 artifacts up to
date) and `check:api-surface` unchanged.
- `overlap-check`: exit 0 (objectstack-ai#37422 and objectstack-ai#37366 share the spec files and
merge cleanly).

Clause-②: no
Metadata-protocol: none
Skills-docs: none

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(Describe text only.)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `eslint` on the changed files passes (the
full `pnpm lint` runs in CI).
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.

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

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

https://claude.ai/code/session_01L6bhgUuauSMJu1nVSQRQri

<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgUuauSMJu1nVSQRQri -->

---------

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

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DG44bgtJm8kWx4oK68re6GX)_

Fixes objectstack-ai#37630
Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用户无感:这是仓库内部的技能长度检查,发布给客户的技能文字一个字都没改。
- 为什么做:属于技能长度管控。以前文件变短后上限还停在原处,多出来的额度没人发现,后来的改动可以悄悄用掉;现在会直接报错,并给出该降到的数字。
- 出错会怎样:最坏是技能相关的 PR 被误拦,作者照提示把上限降到实测值即可;整个改动可直接撤回。
- 要你做的:无。

## What changes

`scripts/check-skills-token-ratchet.mjs` used to fail a row only when
the measured tokens were over its ceiling. A row whose file later shrank
passed and printed its headroom. On PR objectstack-ai#37442 that left a row 1 token
above the merged measurement, and only the reviewer's arithmetic caught
it.

- **The per-row check** (`verdict()`) now fails a row whose ceiling is
above its measurement. The message names the row, the measurement, the
ceiling and the gap, and tells the author to lower the row to the
measurement in the same PR. Lowering is the author's own act, so this
message carries no `⛔ MAINTAINER-ONLY` token. The over-ceiling refusal
is byte-for-byte unchanged.
- **The header's shrink-only bullet** now says the PR that shrinks a
file lowers its row to the new measurement in that PR. A row left above
its measurement is red.
- **37 CEILINGS rows are lowered to their measurement.** On
`origin/main` ce4d8c7, 37 of the 61 authored rows sat above their
measurement, 4813 tokens in all. The largest gaps were
`objectstack-api/SKILL.md` (981), `objectstack-query/SKILL.md` (940) and
`objectstack-data/rules/indexing.md` (746). Each row's number changes
and gains a `-N to the measurement (was C)` note, and one block comment
sits on the prose side of the CEILINGS doc comment (the placement note
says to keep new prose there). No `skills/**` text changes and no
ceiling is raised.

### Failure or warning

**I chose failure.** Reasons:

1. With the 37 stale rows lowered, every row on main sits at its
measurement, so a failure reds nothing that exists today.
2. A warning would be one more line in a log of 100-plus lines. A log
line is how the 1-token gap on PR objectstack-ai#37442 got through. The card's failure
mode is a reading nobody looks at, and a warning is still a reading
nobody looks at.
3. The header already has the gate's rule: every path that moves a row
pins it AT the measurement. Headroom left by a shrink is not budget.
Failing on it makes that rule hold mechanically, just as failing over
the ceiling does.
4. No header-documented reservation exists today. The header's one
reservation is `pending10402` (headroom held for an approved PR), and
its own record says it is spent ("`objectstack-data` measured 13817
against a 13817 ceiling … exactly zero"). So nothing needs an exemption.
A future reservation of that kind would need this gate changed, and the
header now says so.

**How unchanged rows on main are treated:** they are lowered in this PR,
not given a warning tier. Lowering is always legitimate under the
header.

Header lines that bound this change, quoted for the skills-lane
reviewer:

- Record 6139629628 item 2 (the A2′ stamp exclusion), as the header
quotes it: "counts authored content only: the frontmatter `version:`
line that the release bot rewrites is excluded from the count … ceilings
stay shrink-only and the current headroom (0 and 1 tokens) stays as it
is." I read this as bounding the A2′ re-pin, which lowered every stamped
row by exactly 5 so that no file's headroom moved. I do not read it as
protecting headroom against a later lowering.
- The `strippedInternalIds` note in `CEILING_BASIS`: "That is the
ratchet working as designed: shrink-only means a ceiling may be lowered
to the measurement whenever one is taken, not merely by the size of the
day's deletion." This is the authority for lowering all 37 rows in one
PR.
- The raise paths, all pinned at the measurement: ruling record
6513306068 ("may move the row by the measured remainder, pinned AT the
measurement"), and ruling A on record 6819475461, made standing by
record 6840575378 ("may raise that file's row by the row's own measured
delta and by no more").

**Side effect for the reviewer:** in failure mode every count change to
a skills file must edit its row. So two skills PRs that change one
file's count now always conflict on that row; before, only raises did.
This is the intended serialisation, because the merged measurement
differs from both branches. It is still new load on skills PRs.

**Overlap:** open draft PR objectstack-ai#36158 rewrites five of the lowered rows:
`objectstack-data` `SKILL.md`, `rules/field-types.md` (together with the
adjacent `rules/indexing.md`), `rules/relationships.md`,
`rules/validation.md` and `references/examples-objects.md`. That PR
already conflicts with main on its own skills files and re-measures
those rows when it rebases. overlap-check: origin/main, objectstack-ai#37676 and
objectstack-ai#37422 merge cleanly.

## Tests

<details><summary>Self-test, gate, ablation and reverse reading (head
d1295a6)</summary>

- `node scripts/check-skills-token-ratchet.mjs --self-test`: exit 0, `✓
check-skills-token-ratchet self-test: 111 cases pass.` The roster grew
104 to 111, and the floor was raised to match. `under the ceiling ->
green` became `under the ceiling -> red (a ceiling above its
measurement)`, and the shrink-direction row now pins red-until-lowered.
Seven new batteries: the red names the row, the measured count, the
ceiling and the gap; it tells the author to lower the row; it is not the
over-ceiling red (no `over by`, no authority token); one token above the
measurement is red. Each new case reads the verdict and its text
together.
- `node scripts/check-skills-token-ratchet.mjs`: exit 0, `61 authored
bundle file(s) within their ceilings`, and `ratcheted (authored) 199660
/ 199660 (+0)`. On main it read `199660 / 204473 (-4813)`.
- Ablation (`scripts/ablation-replace.mjs`, the new branch's `if`
disabled, anchor x1 to x0): self-test exit 1, `9 failure(s)`, which is
exactly the nine above-measurement batteries. After restore the blob
matched HEAD and `git diff HEAD` was empty.
- Reverse reading: main's CEILINGS judged by the new verdict, 37 of 61
rows red, gap 4813.

</details>

## Acceptance notes

- The card's acceptance asks the gate to report a row whose ceiling
exceeds its measured tokens, naming the row, the measurement and the
ceiling. It does that, as a failure; the choice is argued above for the
reviewer. A test pins the new reading. The existing over-ceiling
refusals are unchanged.
- `skip-changeset`: the only file changed is a root `scripts/` gate in
the private monorepo root package, so nothing ships.

## Verification

<details><summary>Local gates (head d1295a6)</summary>

- All 34 commands from `node scripts/pm/dispatch-gates.mjs --commands
--repo objectstack-ai/objectstack` exited 0. Each exit code was captured
before any pipe. They include `check-skills-token-ratchet` with its
`--self-test`, `check:ratchet-remedy-authority`, `check:doc-authoring`
and `check:nul-bytes`.
- `--ran` reconciliation: `34 derived, 34 run, 0 NOT-MEASURED, 0 UNRUN`.
- `check:pm-dispatch-gates` exited 0 on the previous head, ebc8fae.
The last commit touches only ratchet self-test lines.
- `check-published-list-mirrors` exited 0.
- The control-byte self-scan found 0.

</details>

**Read first:** `verdict()`, the new below-ceiling branch (the one
behaviour change). Then the header's "ratchet discipline" bullet. Then a
sample of the lowered rows against the gate's printed counts.

**Two-minute check:** run `node scripts/check-skills-token-ratchet.mjs`.
Expect exit 0 and the line `ratcheted (authored) 199660 / 199660 (+0)`.
Then raise any row by 1 locally and re-run. Expect a red that names that
row, its measurement and the ceiling, ending in `Lower the row to N`.

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

https://claude.ai/code/session_016WV4cwPhGV4g9p1BGQaZbP

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
… a token reads its stored sentence (objectstack-ai#37731)

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuPE7uyDAJyqjwwMzomWv5ff)_

Fixes objectstack-ai#37635

Clause-②: no
Metadata-protocol: none
Skills-docs: none (no page under `skills/**` describes the stored
milestone summary code)

## 维护者速读

- 用户能看到什么变化:应用作者给里程碑摘要模板新加了一个 `{token}`
之后,之前写下的动态记录在中文等翻译语言下不再显示“带空洞”的翻译句,而是显示当时存下的完整英文句。新写的记录不受影响,照常显示翻译。
- 为什么做:objectstack-ai#37582 的审核发现,旧行没有新 token 的值,翻译句里那个位置会变成空白,而存下的英文句是完整的。
- 出错会怎样:最坏是某行显示英文原句而不是翻译,不会丢数据,也不会出现空白。
- 要你做什么:无。

## What changes

- **Fallback (item 1)**, `activity-summary-message.ts` +
`audit-writers.ts`:
- The writer adds `names` to a fired milestone's summary code: every
distinct `{token}` name the fired template held, interpolated or not
(`milestoneTokenNames`).
- The composer renders a translated template only when each token it
names either has a stored value or is listed in `names` (it was in the
template and its value was empty, so it renders empty as in the stored
sentence). Any other token makes `composeActivitySummary` answer
`undefined`, so the row keeps its stored sentence, as it already does
for a locale with no entry.
- `readActivitySummaryMessage` accepts `names` only as a string list,
and still reads a code without it.
- **One token grammar (item 2, N3)**: `milestoneTokenRe()` moves to
`activity-summary-message.ts` and is exported; the writer imports it,
and the composer's literal `/\{(\w+)\}/g` is gone.
- **Per-read caching (item 3, N4)**, `readerSummaryLocale`: each
`(object, field, value)` milestone's answer is computed once per read,
and each object's packaged base is read once per read, shared by the
translated definition and every milestone answer.
- **Stale comments (item 4, N6)**: the `scalarOverridesPackagedBase`
jsdoc and the `valueOverridesPackagedBase` jsdoc in
`packages/spec/src/system/i18n-resolver.ts` name the five scalars (an
object's three, a rule's `message`, a milestone's `summary`) instead of
"three scalars" / "its two callers"; the header of
`audit-option-label-summary.test.ts` says a reader may now read the
milestone composed in its language (objectstack-ai#37524), while the stored sentence
stays untranslated.
- **Changeset**: `@objectstack/plugin-audit` and `@objectstack/spec`
patch.

Small calls made here (no card):
- **How a row tells "empty" from "added later"**: store the template's
token names on the row (the card's example). The alternative, a hash or
the whole template, carries more and still needs the names to judge a
translation.
- **A token only the translation names** (not in the authored template)
now also keeps the stored sentence. objectstack-ai#37582 rendered it empty; a
translation with a token the row never had cannot be composed whole
either, so one rule covers both.
- **Rows written before this change** carry no `names`: they compose
only when every token of the translation has a stored value. Such a row
with an empty value shows its stored sentence instead of the
translation; it never shows a hole.
- The cache key is `(object, field, value)`, one level finer than the
card's `(object, field)`, because the answer depends on the value; the
packaged base is cached per object.

## Why

Contract review records 7196337094 and 7197635792 on PR objectstack-ai#37582 (accepted
deviations and nits, adopted at ACCEPT), carried here per the
one-card-per-PR rule.

## Verification

Head `48cd3c9dd`:
- `packages/plugins/plugin-audit`: `vitest run src/`: 110 files, 1846
tests passed. New cases in `activity-summary-message.test.ts`: red-first
for a token added after the row (keeps the stored sentence), an empty
listed token renders empty, a translation-only token, a code without
`names` (composes when every token has a value, else keeps the stored
sentence), one packaged-base read for many rows and two milestones, and
`names` validation.
`activity-milestone-summary-locale.integration.test.ts` pins the stored
`names` and, through the real writer, SQLite driver and read middleware,
that a zh-CN reader reads the stored English for a row written before
the template gained `{note}`, with the lost row (whose template held
`{note}`) still composed as a control.
- `tsc --noEmit -p packages/plugins/plugin-audit` and `eslint` on the 5
touched plugin-audit files: exit 0.
- `check:changeset-fixed`, `check:test-source-alias`: exit 0.
- `node scripts/pm/overlap-check.mjs`: clean (shares `i18n-resolver.ts`
with objectstack-ai#37422 and objectstack-ai#37366, both merge cleanly).

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic
(doc comments only).
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; lint passes.
- [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 (comments only): no generated artifact
depends on them.
- [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.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

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

https://claude.ai/code/session_01L6bhgUpnvPnJ1hR74pUrVj

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

<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgUpnvPnJ1hR74pUrVj -->

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…a type with its loader, its registry and two authoring guards (objectstack-ai#37676)

<!-- claude-projects-attribution: {"github_login":"os-bill"} -->
_Requested by **Bill** · [project
thread](https://claude.ai/code/project/chan_016iMXWSZDzqWRWvWzdNo8wg?thread=cmsg_016iMXWSZDzqWRWvWzdNo8wgHittdG1nUD4Ne4ozfqAXgk)_

Fixes objectstack-ai#37304

Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up objectstack-ai#37310

## 维护者速读

- 用户能看到什么变化:知识源成为一种正式的应用配置,可以随应用一起发布,也可以在 Studio
里新建和修改;保存后平台自动建立、更新或清除对应的检索索引。旧写法升级时会被明确拒绝,迁移命令会列出每一处要改的地方。
- 为什么做:属于“知识检索平台化”专题,让应用写一份知识源配置就有可用的检索,并且谁能建知识源、能索引哪些数据都有人管。
-
出错会怎样:只影响用到知识检索的应用。旧配置没迁移时会报出要改的位置,不会悄悄丢数据或建错索引;新增的“管理知识源”权限默认只有平台管理员有;回退本改动即可恢复原状。
- 要你做什么:批准一次。这是一次不兼容的协议收紧,改了两份对外技能文件(各一两行),改动量也超过三千行,按规则要你批准后才能合并。

## What changes

**New metadata type: `knowledge_source`.** Registered in the metadata
type registry with the one schema `KnowledgeSourceSchema`; a stack
carries its sources in the new top-level collection `knowledgeSources`
(`*.knowledge-source.ts` or `.yml`). An item can be created and changed
at run time (Studio, MCP) and takes no environment overlay. Studio's
menu lists the type under AI, and ADR-0084's type table carries its row.

**New platform capability: `manage_knowledge_sources`.** Platform
administrators hold it by default. Nothing else grants it.

- **The schema is strict.** An undeclared key is refused. `id` becomes
`name`, `source.contentFields` becomes `source.content`, a non-empty
list of field names; `'*'` is refused with the instruction to list the
fields, and an empty-string member is refused too (it names no field).
`embedding`, `vectorStore`, `adapterConfig`, `refresh.cron` and the
`file` / `http` source kinds are retired with their ADR-0087 entries
(three conversions, six retired keys, six retired defs, four semantic
entries on protocol 19). `os migrate meta --from 18` lists every edit
and `--write` applies the ones it can prove.
- **The loader** (`service-knowledge`, `knowledge-source-loader.ts`).
`KnowledgeServicePlugin` reads the published items when it starts and
follows the type while it runs: an added source is registered and built
when a build is due; a changed one is registered again (a changed
`where` or `metadataFields` rebuilds inside the generation, a changed
`content` or `split` builds a new one); a removed one is unregistered
and its index dropped. The reap guard's object set follows the sources.
- **The registry** (`knowledge-source-registry.ts`), under the
maintainer's rulings on this card (record 7192063608, forks 6 and 4d,
both A). A source is held by `(package, name)`. A source registered in
code belongs to no package; it shares one slot with an
environment-authored item of the same name, and the second of the two to
arrive is refused `409 RESOURCE_CONFLICT`, naming both doors. A
package's source of the same name is a second source. Code names a
source by its face: the bare name for the package-less one,
`NAMESPACE-NAME` for a package's; a bare name several sources answer to
is refused `409`, naming the candidates. `search` hits carry the face as
`sourceId`. No `IKnowledgeService` signature changes for addressing.
- **`IKnowledgeAdapter.dropSource?(ctx)`**, implemented by
`knowledge-memory`, `knowledge-pgvector` and `knowledge-turso`; the
contract suite (`@objectstack/service-knowledge/testing`) takes
`implements.dropSource`. An adapter reads the source's index key from
`ctx.source.name` (it was `ctx.source.id`): the bare name for a
package-less source, so an existing index is found under the same key
and nothing is rebuilt.
- **Guard one: the capability.** A write of a `knowledge_source` through
`/meta` (REST and the dispatcher: save, publish, rollback, delete) and
through the MCP draft door needs `manage_knowledge_sources` beside
`manage_metadata`: `403 PERMISSION_DENIED` naming the capability, `401`
for an anonymous caller. It is one row in the existing per-type table
`META_TYPE_WRITE_CAPABILITIES`
(`packages/rest/src/meta-item-read-gate.ts`), so the three doors that
already ask that table ask it for this type too. The package doors ask
it as well (maintainer's ruling A, record 7207325373 on objectstack-ai#37304): each of
the twelve doors that write an existing package (enable, disable,
publish, publish-drafts, discard-drafts, the commit revert, rollback,
revert, adopt-orphans, duplicate, the manifest update, delete) refuses a
caller without the capability `403` when the package holds a knowledge
source: an item, a pending draft, or, for the commit revert and the
rollback, a commit that touched one. A package that holds none is
written as before; a holding that cannot be read refuses `503`. Two
doors are not asked, see Acceptance notes.
- **Guard two: source admission at save.** The same doors save a source
only when its author may themselves search what it would index: an
object of a disabled package, an object the API does not serve for
`search`, a system object without `enable.aiReadable`, or a field the
author may not query refuses the save `403`, naming the object or the
field; a verdict that cannot be reached refuses `503`. The fields a
source's `where` reads are judged with the fields it serves, at save and
at search. A knowledge service that is registered and cannot be resolved
refuses the save `503` at every door (REST, the dispatcher, MCP). The
duplicate door admits each knowledge source it would copy for the caller
before anything is copied, and refuses the whole copy when one is
refused. Over MCP the human is judged.
- **The push door leaves.** `IKnowledgeService.indexDocument` and
`deleteDocument` are removed with the `file` / `http` branches that
served them.
- **Removed exports**, twelve names from `@objectstack/spec/ai`. The
`embedding` module: `EmbeddingModelSchema`, `VectorStoreSchema`,
`VectorStoreProviderSchema` and the types `EmbeddingModel`,
`VectorStore`, `VectorStoreProvider` (the knowledge source was their
only composer). The retired source kinds: `FileKnowledgeSourceSchema`,
`HttpKnowledgeSourceSchema`, `KnowledgeSourceKindSchema` and the types
`FileKnowledgeSource`, `HttpKnowledgeSource`, `KnowledgeSourceKind`. The
changeset lists the same twelve.
- **Boot notice** (`packages/objectql`). A deployment that holds
`knowledge_source` items and mounts no knowledge service says so once at
boot, at warn, naming the items; it is not a boot refusal.
- **CLI.** `os knowledge status` prints the package that holds a source
and no longer a source kind.
- **Showcase.** `examples/app-showcase` ships `showcase_task_notes`
(object `showcase_task`, adapter `memory`) and mounts the knowledge
service and the memory store.
- **Docs.** `content/docs/protocol/knowledge.mdx` and
`content/docs/ai/knowledge-rag.mdx` describe the type, the loader, who
may author a source, and one name per source; the generated references
follow.
- **Skills (Tier H), enumeration row only**, under ruling A on objectstack-ai#32584:
`knowledgeSources` joins the top-level key list in
`skills/objectstack-platform/SKILL.md`.
`skills/objectstack-ai/SKILL.md`'s compiled `supportKb` example changes
two keys (`id` to `name`, `contentFields` to `content`) because the old
spelling is now refused at parse. Teaching the type (prose, tables,
evals) rides objectstack-ai#37310.
- **One ceiling, raised by the row's measured delta and by no more**
(`scripts/check-skills-token-ratchet.mjs`):
`skills/objectstack-platform/SKILL.md` was at zero headroom (24603
priced bytes, 6151 tokens, after objectstack-ai#37442's row); the `knowledgeSources`
row adds 20 bytes, so the priced text is 24623 bytes, 6156 tokens, and
the ceiling moves 6151 to 6156, pinned at the measurement. Nothing else
in the file is cut and nothing rides along.
`skills/objectstack-ai/SKILL.md` stays at 6799 tokens under its ceiling
of 6801.
- **The two rulings the raise path names**, quoted:
- Ruling A on objectstack-ai#32584 (record 6819475461): "a product PR that adds an
authorable `defineStack()` top-level key, or a live member of a schema
symbol bound to a registered exhaustive skills section, carries the
matching skills enumeration row in the same PR. Only that row; prose,
examples and evals still go to the skills sub-card."
- objectstack-ai#32673 letter A (record 6840575378): "a PR that adds a metadata key
and, under ruling A on objectstack-ai#32584, carries the matching enumeration row in a
published skill may raise that skill file's token cap by the row's
measured delta, and by no more. The PR body cites ruling A and this
ruling. Nothing else in the file is cut to make room, and no wider raise
rides along."

## Tests

- `packages/spec/src/ai/knowledge-source.test.ts`: the strict schema,
`'*'` refused, an empty-string member refused (and `minLength: 1` in the
JSON Schema), every retired key answered with its prescription.
-
`packages/services/service-knowledge/src/__tests__/knowledge-source-registry.test.ts`
(new): the slot rules above, both orders of arrival at each door, face
resolution and the `409` with its candidates.
- `.../knowledge-source-loader.test.ts` (new): boot read, add, change
(each of the two rebuild arms), remove with `dropSource`, an adapter
without `dropSource`, the reap guard following the sources.
- `.../knowledge-source-admission.test.ts`: each refusal of guard two
and its fail-closed `503`; the fields `where` reads (keys, `$and` /
`$or` / `$not`, `{ $field }` comparands) judged at save and at search.
- The adapter contract suite with `dropSource: true` in
`knowledge-memory` and `knowledge-turso`; `knowledge-pgvector` declares
it in `contract.live-postgres.test.ts` (see Remaining).
- `packages/rest/src/meta-type-write-capability.test.ts`: every write
shape of a `knowledge_source` for a caller with `manage_metadata` alone,
with `manage_platform_settings`, and with a record grant: `403
PERMISSION_DENIED`, store unchanged, no protocol call; a holder of both
saves, publishes, rolls back and resets; the capability without
`manage_metadata` is refused by the door's own admission.
- `packages/rest/src/meta-write-door-capability-enumeration.test.ts`,
`packages/runtime/src/domains/meta-save-capability-gate.test.ts`,
`packages/runtime/src/domains/mcp-authoring.test.ts`: guard two at REST,
the dispatcher and the MCP save door (the human is judged); on a real
kernel, a knowledge service whose factory throws answers `503` at the
dispatcher and at MCP, and one never registered is not asked.
-
`packages/runtime/src/domains/meta-type-write-capability-parity.test.ts`:
REST and the dispatcher answer the same for the new row.
- `packages/runtime/src/domains/packages-knowledge-source-gate.test.ts`
(new): each of the twelve package doors refuses a `manage_metadata`-only
caller when the package holds a source (item or draft) and the writer
never runs; a holder goes on with no listing read; a package with none
answers as before; a listing that throws refuses `503`; the engine's own
call is not asked; the commit revert and the rollback read the timeline;
the duplicate door's admission of each copied source; a host with no
metadata store holds none; the install door and the ensure-customization
door are not asked.
- `packages/runtime/src/domains/packages-ensure-customization.test.ts`:
a base that holds a knowledge source (a registered item and a stored
row) gets a pair that holds none, and the door writes one manifest and
no row.
- `packages/objectql/src/knowledge-source-unserved.test.ts` (new): the
boot notice.
- `packages/metadata-core/src/knowledge-source-save-admission.test.ts`
(new): the admission seam.

## Acceptance notes

- **Governed (Tier H) and over 3000 changed lines**: draft until the
maintainer's approval. The diff touches `skills/**` and declares a
narrowing.
- **Rulings this PR implements**: record 7192063608 on objectstack-ai#37304 (forks 6
and 4d, both A); earlier on the same card Q1 = B (the type sits in
ADR-0150's bucket 3) and Q2 = B (`manage_knowledge_sources` beside
`manage_metadata`, platform administrators only); and ruling A of
2026-11-27 (record 7207325373): every write door of an existing package
asks the capability when the package holds a knowledge source, and
install stays unasked. The ADR-0150 rows ride objectstack-ai#37545. One ADR line is
edited here, with the zone's approval (claim comment 7203310811 on
objectstack-ai#37304, amended by 7204020473): ADR-0084's type table gains the
`knowledge_source` row its item 6 prescribes for a type registered after
the ruling (AI, `ai`, 5, 高级), spelled as the `ai_context` row is.
Nothing else under `docs/adr/**` changes.
- **The loader's signal** is `protocol.onMetadataMutation` (a save, a
publish, a delete, a revert) plus the `metadata:reloaded` hook (a
package published, installed or removed, a dev reload), not
`metadataService.subscribe`. After either it reads the published set
again and reconciles, so a missed event is repaired by the next one.
- **Guard two is not asked where no knowledge service is mounted**
(there is nothing to ask, and the item is inert there), nor for a system
write.
- **Two package doors are not asked the new capability (limits).** The
install door (`POST /packages`): a package's source arrives by that
door's own admission, as the ruling leaves it. The ensure-customization
door (`POST /packages/:id/ensure-customization`): it writes nothing of
the base and creates an empty pair, so it creates, changes and removes
no knowledge source; the seat confirmed this reading on the condition
that the pair holds no source, which
`packages-ensure-customization.test.ts` pins.
- **The package gate reads before it answers.** For a caller without the
capability the twelve doors read the package's drafts and items (and its
commits, for the two timeline verbs) before the door's own request
checks. A host with no metadata store at all (the table was never
created, or the engine holds no `sys_metadata` object) reads as holding
none, by the same rule the protocol's overlay reads use; any other
failed read refuses `503`.
- **The read-side author exemption** stays keyed on `manage_metadata`.
- **A bare name two sources answer to** is refused `409` at the call
that names it (`resolveSourceRef`), listing the candidates; both sources
register. Where the host cannot place a package's namespace, the
package's face is its bare name, and that name answers `409` for both
sources until the package is placed.
- **The four narrowings the ADR-0150 addendum asks this card to declare,
each counted on this tree**: the install refusal inside a namespace (two
packages of one namespace holding a source of one name): 0. The name
grammar (a source whose name the grammar refuses): 0. The `409` for a
bare name two packages hold: 0. The package-less row under a name a
package holds: 0. The tree holds one knowledge source,
`showcase_task_notes`
(`examples/app-showcase/src/ai/task-notes.knowledge-source.ts`), and no
first-party code registers one through the plugin door.
- **`KnowledgeIndexStatusEntry.kind` is removed** with the source kinds;
`packageId` is added.
- **One ADR-0087 marker.** The gate allows exactly one marker per
breaking changeset, so the changeset carries `registered …` and names
`indexDocument` / `deleteDocument` in prose: they are runtime-interface
members with no metadata form, and the compiler reports each call
(`TS2339`).
- **The boot notice adds one boot read** of `knowledge_source` rows on a
kernel that does not hydrate from its database; it registers nothing
(`plugin.integration.test.ts` pins the permitted reads and now names
this one).
- **pgvector `dropSource` and a concurrent build in another process**:
the drop retires the active and the building generation in one
transaction but does not hold the builder lock across it, so a build
already running in another process could still write its generation
afterwards. Not changed here; it is a candidate follow-up.
- **objectstack-ai#37479 (unregistered adapter) is not folded in.** The loader runs
after publish, so it is not a refusal point for publish; objectstack-ai#37442 adds the
coded refusal for an unmounted adapter.
- **The showcase mounts the two plugins by hand** rather than declaring
`requires: ['knowledge']` (objectstack-ai#37442): the token mounts a libSQL or
pgvector store, which needs a configured embedder, and the demo runs on
the in-memory store with none. A host that mounts the service itself
keeps its own, as objectstack-ai#37442 specifies.
- **Merged with `main` three times** (no rebase). The first merge (at
`45ed022b`) followed objectstack-ai#37442, objectstack-ai#37570 and objectstack-ai#37578: four textual conflicts
(the migration registry template, the CLI knowledge test fixture, the
pgvector adapter's search refusal, the knowledge service's reindex chain
and unmounted-adapter refusal). Code and fixtures those PRs wrote
against the 18 source shape follow the 19 shape here: `source.id` is
`source.name`, `contentFields` is `content`, `reportUnmountedAdapters`
names a source by its face, and the unmounted-adapter index test calls
`reindexSource` now that `indexDocument` is gone. The second merge (at
`c2bfa3ef7`) was forced by a conflict: `main` had gained its own
protocol 19 conversion
(`permission-view-all-fields-beside-record-bypass`), so the conversion
registry, the migration registry template and the retired-key pin now
carry both sets, sorted as the registry sorts them;
`packages/spec/authorable-surface/ai.json` was merged three ways by hand
so that this PR's removals and `main`'s new `ai/Skill:context` both
stand; every generated spec surface was regenerated afterwards. The
third merge (at `8b9b9d235`) was forced by objectstack-ai#37723, which moved the
ADR-0150 D3 rule into
`packages/metadata-core/src/package-scoped-resolution.ts`: `core`'s file
is taken from `main` (a re-export) and the `knowledge_source` row with
its comment sits in `metadata-core`'s `PACKAGE_SCOPED_TYPES`;
`default-changes.ts` keeps both protocol 19 entries (`main`'s
`ai/AIModelConfig:provider` and this PR's `ai/KnowledgeSource:refresh`);
the Studio menu placement pin takes `main`'s move of `position` and
keeps this PR's row. The merge is its own commit and
`packages/spec/authorable-defaults/ai.json` was regenerated in the next
one (`737f44341`).
- **The declared default of `ai/KnowledgeSource:refresh`** sits under
major 19 in `default-changes.ts` (no parsed value changes: the published
JSON Schema now states the `{}` the parser always applied).
- **Enumeration pins found by CI, not by the first local pass.** The
first head was verified on the packages the change edits. CI then failed
on tests in packages it does not edit, each a list that counts metadata
types or the platform administrator's capabilities: the owner-stamp boot
fixture and the unbundled-type list (`packages/metadata`), the tier list
(`packages/metadata-protocol`), the type-label counts
(`packages/platform-objects`), four golden grant lists
(`packages/plugins/plugin-security`), and the generated `zh-Hant`
locale. Each gained the one entry; no product code changed for them. The
suites of those packages and the workspace type check now run locally as
well (see Verification).
- **Review round 1.** The contract review on `45ed21271` (comment
7206413701) read PASS with findings, and the seat ordered a rework
(7206423476). This head answers it: authoring guards cover more doors
and more of what a source reads (the package doors, the duplicate door,
the fields `where` reads, the service lookup at the dispatcher and at
MCP), the `content` member refuses the empty string, the changeset lists
the twelve removed exports, and this body is corrected on the face
collision and states the narrowing counts. The findings' detail is with
the seat. Two nits are carried by cards the zone files under objectstack-ai#37304
(ADR-0084 prose; tombstone wording for code-door registrants).
- **Existing tests edited outside the card's first surface** (claim
amended by the zone, comment 7207505784 on objectstack-ai#37304), each because a
package door now reads the package for a caller without the capability:
- `packages-publish-drafts-request-conformance.test.ts`: the
real-protocol case's caller also holds `manage_knowledge_sources` (its
engine is one nothing may touch; the case pins the protocol's own
order). Assertions unchanged.
- `packages-publish-drafts-probe-caller-context.test.ts`: the protocol
double gains a `getMetaItemsPerPackage` stub beside its `getMetaItems`
stub. Assertions unchanged.
- `package-state-host-store.test.ts` (a kernel with no driver) and
`domains/error-passthrough.test.ts` (a protocol double that throws from
every member): the caller also holds `manage_knowledge_sources`.
Assertions unchanged.
- `packages-ensure-customization.test.ts`, "duplicate: 400 before a row
is read": **the measure changes.** The door now reads the source
package's knowledge sources to admit them before the copy runs, so the
case counts the reads made inside `protocol.duplicatePackage` (still 0)
instead of every engine read; it also asserts the copy was entered once.
- **Open PRs that will conflict with this one** (overlap-check on this
head against 12 open PR heads; `main` itself merges cleanly): objectstack-ai#37422
(the generated references and `scripts/check-skills-token-ratchet.mjs`:
whichever lands second re-measures the row), objectstack-ai#37366
(`packages/spec/export-origins/ai.json`). Whichever of each pair lands
second merges `main`.

## Verification

First files to read, by risk:
1.
`packages/services/service-knowledge/src/knowledge-source-registry.ts`:
the slot and face rules.
2. `packages/services/service-knowledge/src/knowledge-source-loader.ts`:
what each metadata event does to an index.
3. `packages/rest/src/meta-item-read-gate.ts`
(`META_TYPE_WRITE_CAPABILITIES`) and
`packages/metadata-core/src/knowledge-source-save-admission.ts`: the two
guards.
4. `packages/runtime/src/domains/packages.ts`
(`refuseKnowledgeSourcePackageWrite`,
`refuseDuplicatedKnowledgeSources`): the guards at the package doors.

Two-minute check: `pnpm --filter @objectstack/service-knowledge exec
vitest run --maxWorkers=2
src/__tests__/knowledge-source-registry.test.ts
src/__tests__/knowledge-source-loader.test.ts`.

Head `cf128e59f` (review round 1). Verified so far on this head,
locally, every heavy run under `scripts/pm/os-verify-lock.sh`: build
exit 0; `@objectstack/runtime` full suite exit 0 (657 files, 13676
passed, 25 skipped); `@objectstack/metadata-core` and
`@objectstack/core` exit 0; `tsc --noEmit` on `packages/runtime` exit 0.
Running now on the same head, and written here when they end: the other
package suites, the workspace type check, the derived gates, the full
dogfood battery and the ablations. CI on this head is in progress. The
previous head's readings (`45ed21271`: 62 check runs green, 185 gates,
the dogfood battery, six ablations) are in the os-dev report, comment
7206197293 on objectstack-ai#37304.

<details><summary>Skills readings (the diff touches
<code>skills/**</code>)</summary>

| | Lines before | Lines after | Tokens before | Tokens after |
|---|---|---|---|---|
| `skills/objectstack-platform/SKILL.md` | 421 | 421 | 6151 | 6156
(ceiling 6156) |
| `skills/objectstack-ai/SKILL.md` | 486 | 486 | 6799 | 6799 (ceiling
6801) |
| All `SKILL.md` files together | 4961 | 4961 | | |
| Ratcheted (authored) bundle | | | 199660 | 199665 (ceiling 204478) |

`skills/objectstack-ai/references/_index.md` is generator-owned (53
lines to 52: the embedding module's row leaves, the knowledge source's
row is reworded) and is measured, not ratcheted. "Before" is `main` at
the third merge (`8b9b9d235`), read with the same script; the bundle's
before figure is this tree's reading less the row's 5 tokens.

</details>

## Remaining

- The same reviewer's read of the round 1 delta
(`45ed21271..cf128e5`), then the seat's hand-off.
- `knowledge-pgvector`'s `dropSource` contract cases have not run
anywhere yet: there is no pgvector in the build container, and the job
with a PostgreSQL service does not run on `pull_request`. Their first
run is the merge queue.

## 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.
- [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: its generated artifacts are
regenerated and committed.
- [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.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.

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

https://claude.ai/code/session_01Utp6CZe3KTAXogcUJuvYEx

<!-- signed: repo:objectstack#5 · os-bill ·
session_01Utp6CZe3KTAXogcUJuvYEx -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…h type's stored rows once (objectstack-ai#38164)

Fixes objectstack-ai#37709

Clause-②: yes (widening) —
ObjectStackProtocolImplementation.readFormRequest
Metadata-protocol: none

## 维护者速读

- 用户无感:匿名公开表单页和按名读取表单时,返回的内容与以前完全一样,只是同一次请求里不再把同一批元数据反复读好几遍。
- 属于"表单独立成为元数据类型"这一系列的收尾,解决上一轮评审留下的"同一请求重复读库"这一条遗留项。
- 若出错,公开表单可能打不开或判断错一个表单是否公开;改动不碰任何存储数据,可直接撤回。
- 无。

## What changes

The effective `form` read (ADR-0159 D5) resolves over both types: the
generic `form` list, the projection of the `view` list, and the
cross-type resolution (step 3) over the stored rows of both types. Each
of those readings, and each of the five reads an anonymous form door
makes, asked the store for the same rows again.

- **`packages/metadata-protocol/src/protocol-form-reads.ts`.**
`formRequestScope(host)`: one request's reading, over which each stored
row set (per type and package binding) and each flattened list (per
request, audience and layer) is read once. `readEffectiveFormList` reads
through it, so the generic `form` list and step 3 share one reading of
the `form` rows, and the `view` list and step 3 share one reading of the
`view` rows. `readInFormRequest(read)` runs `read` as one request
reading (an AsyncLocalStorage store): every protocol list read inside it
over the same host shares one scope, and once `read` settles the scope
memoizes nothing, so nothing outlives the request. The stored rows of
step 3 stay read whole (a container row's name is not the name its
expansion writes); they are read once per request. The
`readEffectiveFormList` docblock now states that.
- **`packages/metadata-protocol/src/protocol-meta-list-reads.ts`.**
`readFlattenedMetaItems` takes an optional stored-row reader (the
scope's); `getMetaItems` and `getMetaItemsPerPackage` read through the
open request reading when there is one; the package-scoped `form` list
face reads its envelope through the same scope.
- **`packages/metadata-protocol/src/protocol.ts`.** The private
`readFlattenedMetaItems` passes the row reader on. New server-only
extension `readFormRequest(read)` (feature-detected by the doors, like
`getMetaItemsPerPackage` and `getUnreadableFormBodies`): runs `read` as
one request reading.
- **`packages/rest/src/form-routes.ts`** (outside the claim's file
surface; the measured producer of the repeated door reads, see
Acceptance notes). `resolveFormBySlug` makes its five reads inside
`readFormRequest` when the protocol serves it, and exactly as before
otherwise. Both doors (`GET /forms/:slug`, `POST /forms/:slug/submit`)
go through it.
- **`packages/metadata-protocol/src/protocol-meta-item-reads.ts`.**
Comment only at `readEffectiveFormItem`: on this tree it calls
`readEffectiveForms` once (not up to three times), and that one call now
reads each row set once.

Every answer is unchanged: the same items, in the same order, from the
same served-row order. The ADR-0159 D5 cross-type resolution is
untouched; `names` and `packageId` handling is untouched (`names` was
already pushed into both generic reads, and the reason `packageId` is
not pushed down was already stated in the `readEffectiveFormList`
docblock, both landed in objectstack-ai#37422's rework; confirmed on this tree, not
redone).

### Measured counts (real protocol, real `ObjectQL` + SQLite store,
`OS_METADATA_OVERLAY_CACHE_TTL_MS=0`, one warm-up request)

"Row-set read" = one `readActiveOverlayRows` call (one `sys_metadata`
statement under the singular type, plus one under the plural when the
singular answers no row).

| Request | Form shape | `view` list (effective) before → after | `view`
row sets before → after | `form` row sets before → after |
|:---|:---|:---|:---|:---|
| by-name `form` read | authored `form` item | 1 → 1 | 2 → 1 | 2 → 1 |
| by-name `form` read | old-shape `formViews` entry | 1 → 1 | 1 → 1 | 1
→ 1 |
| form-door GET | authored `form` item | 2 → 1 | 5 → 1 | 3 → 1 |
| form-door GET | old-shape `formViews` entry | 2 → 1 | 4 → 1 | 2 → 1 |

Before = `origin/main` 93fa911 (with objectstack-ai#37422 merged); after = this
branch. The by-name read also issues one row read predicated on the name
(the generic by-name read's own, `readItemActiveRows`), before and
after. The door reads the `form` list, the per-package `form` layer and
the per-package `view` layer once each, before and after. With the row
cache on (default 30 s) the repeated reads were cache hits at the SQL
level, but each still ran its parse and merge; with it off (or on a cold
or invalidated cache) each was a statement.

## Tests

- New `packages/rest/src/public-form-reads-once-37709.test.ts` (8 cases,
both form shapes): the by-name read and the door GET read the `view`
list once and each type's row sets once (exact counts, answers
asserted); CONTROL 1, two requests read twice (the scope never spans
requests); CONTROL 2, the five door calls outside one reading (a
protocol without `readFormRequest`) read the `view` list twice and the
`view` rows four times, so the counter sees a repeated read when there
is one.
-
`packages/rest/src/rest-write-route-hook-refusal-sentence.ledger.test.ts`:
its catch-all protocol double rejects every method it does not list, and
the door now feature-detects `readFormRequest`, so the double's reads
table gains one pass-through entry, as it gained
`getMetaItemsPerPackage` and `getUnreadableFormBodies` when those door
extensions landed. No assertion changed. Every other form-door and D5
test is unchanged and green.

<details><summary>Suites on f97bc7d (merged with
origin/main)</summary>

- `@objectstack/metadata-protocol` `vitest run`: Test Files 372 passed,
9 skipped (381); Tests 23605 passed, 45 skipped.
- `@objectstack/rest` `vitest run --project local`: Test Files 433
passed (433); Tests 8981 passed, 351 skipped.
- `pnpm --filter @objectstack/metadata-protocol typecheck`, `pnpm
--filter @objectstack/rest typecheck`: exit 0.
- Final head 73983ef changes only `protocol.ts` text after that run
(the `readFlattenedMetaItems` docblock reflowed and the new method's
docblock made one line, so the facade stays at its 11705-line ceiling,
`check:facade-delegation-only`). On it: rebuilt, both typechecks exit 0,
and the pin plus 11 form-door files: Test Files 12 passed (12), Tests
898 passed (898).

</details>

<details><summary>Ablations on 6178fb1 (scripts/ablation-replace.mjs,
each leg built and checked in dist with
scripts/ablation-dist-preflight.mjs)</summary>

- A1, the effective `form` read without its scope (drop `host =
formRequestScope(host)` in `readEffectiveFormList`): 2 failed / 6 passed
(the by-name read of an authored `form` item, and CONTROL 1).
- A2, `readFormRequest` opens no reading (`readInFormRequest(read)`
replaced by calling `read` directly): 4 failed / 4 passed (the door GET
in both shapes, and CONTROL 1 in both).
- A3, the scope's list reads read their rows outside it (no row reader
passed): 6 failed / 2 passed.
- Restore leg: every marker absent from dist, tree clean against HEAD,
pin 8/8 green.

</details>

<details><summary>Local gates on 73983ef (the 75 families
`dispatch-gates.mjs --commands` derives for this diff)</summary>

- All 75 commands exit 0, each exit captured before any pipe. `pnpm
check:dual-build-cjs-loads` first answered PREREQUISITE NOT MET (exit 3:
it reads every package's `dist/`), and exit 0 when re-run after
`check:type-check-debt`'s full build on the same head (126 require entry
points across 74 packages load).
- `check:facade-delegation-only` held the line: `protocol.ts` is at its
11705-line ceiling (it went red at 11719 on f97bc7d, fixed in
73983ef).
- `dispatch-gates.mjs --ran`: 75 derived, 75 run, 0 NOT-MEASURED, 0
UNRUN.
- Raw control-byte self-scan of the changed files: no match.

</details>

## Acceptance notes

- **Landing point outside the claim's file surface:
`packages/rest/src/form-routes.ts`.** Measurement shows the door's
repeated `view`-list and row reads come from its five separate protocol
calls; no change inside `packages/metadata-protocol` alone can share a
reading across them. A first cut answered the five reads through one new
protocol call; it bypassed the doubles four existing door tests install
by overriding `getMetaItems` / `getMetaItemsPerPackage` /
`getUnreadableFormBodies` on a real protocol, so the door keeps its five
calls and runs them inside one request reading instead.
- **Premise check.** On 93fa911 `readEffectiveFormItem` calls
`readEffectiveForms` once (the card's "up to three times" no longer
holds); the repeats were inside that one call (the `form` and `view` row
sets twice each).
- **New seam worth a reviewer's eye:** `readFormRequest` is a new public
method on `ObjectStackProtocolImplementation` (server-only,
feature-detected), and `metadata-protocol` now uses `AsyncLocalStorage`
(`node:async_hooks`; the package is already node-only).

## Verification

First read, by risk:
1. `packages/metadata-protocol/src/protocol-form-reads.ts`,
`formRequestScope` and `readInFormRequest`: a memoized list is one
object handed to several callers in the same request (every caller reads
it, none writes it), and the `live()` check that stops memoizing once
the request settles.
2. `packages/rest/src/form-routes.ts`, `resolveFormBySlug`: the five
reads inside `inOneReading`, in their old order.
3. `packages/metadata-protocol/src/protocol-meta-list-reads.ts`:
`readRows` at the active-row read of `readFlattenedMetaItems`, and
`inFormRequestScope` in `getMetaItems` / `getMetaItemsPerPackage`.

Two-minute check: `pnpm --filter @objectstack/metadata-protocol build &&
pnpm --filter @objectstack/rest exec vitest run
src/public-form-reads-once-37709.test.ts` prints `Tests 8 passed (8)`.

---

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

<!-- signed: repo:objectstack#8 · sunhaolin ·
session_017xRBcSAaBEfQpU2yJexSJ8 -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…ut of step with main (week of 2026-11-25) (objectstack-ai#38289)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DDypKu7B9nwbu5WuV7AEio8)_

Fixes objectstack-ai#37245

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:用户无感;只在十份设计记录里补了带日期的说明,写明主线现在实际怎么做,原有的决定文字一个字没动。
- 为什么做:属于「每周设计记录修订」滚动清单(11 月 25
日这一周);清单每一行指出一处「记录写的和主线不一致」,这次一并补齐,免得照着记录干活的人被过时说法带偏。
- 出错会怎样:最坏是某条补充说明写得不准,读这些设计记录的人会碰到;纯文档、只增不删,可以直接撤回,不影响任何功能。
- 要你做什么:请审这些补充说明并亲手合并(设计记录须由你本人合)。

## What changes

Ten ADR files gain notes dated 2026-11-28. Every diff line is an
addition: 239 lines added, 0 removed. No original decision text is
rewritten, and no decision changes. Each note follows the note
convention its own record already uses.

Each row's "what is true now" was read against the code on `main` before
it was written. Where a row was wrong or had gone stale, the note says
what `main` does, and the table and the list under it say so.

| Row (comment id on the card) | ADR and section | Result |
|:---|:---|:---|
| Card body row (from objectstack-ai#37238) | ADR-0146, the 2026-11-24 amendment, "32
registered types" | **Landed. Row stale.** The row asks for 33; the
registry holds 35 entries on `main`. The note states no count and points
at the registry and at ADR-0084's table. |
| 7155511307, nit 1 | ADR-0160 D1, the door's page cap sentence |
**Landed. Row stale.** The row says the door has no page cap. PR objectstack-ai#37354
added one. The note says what `main` does: the list is cut one row under
the door's cap, not at it. |
| 7155511307, nit 2 | ADR-0160 D1, "only contains braces" | **Landed**
as the row asks. |
| 7155511307, nit 3 | ADR-0160 D3, the link-field sentence | **Landed as
a note that the sentence stands.** |
| 7161785832 | ADR-0158, Open items 9 and 12 | **Landed.** |
| 7178404228, anchor half | ADR-0066, line 146 | **No edit.** PR objectstack-ai#37621
already landed it (record 7198334624). |
| 7178404228, end-state half, with 7201928772 | ADR-0066 D2 ⑧ |
**Landed.** Its prerequisite, PR objectstack-ai#37371, is merged. The proposed text is
tightened in two places, listed below. |
| 7179515770 | ADR-0158 U3, U6, L4, Open item 10 | **Landed.** |
| 7184833647 | ADR-0159, Context, "One name already taken" (line 109) |
**Landed as a note. The anchor line is untouched.** This is not a
no-edit row: the anchor resolves, onto the opposite meaning. See below.
|
| 7187445064 | ADR-0158 L1, L2, Open items 6, 8, 10 and 11, and a new
Open item 13 | **Landed.** |
| 7195437501 | ADR-0010, the amendment note of 2026-11-24 | **Landed**,
with one arm `main` has gained since the row was written. See below. |
| 7212321297, first row | ADR-0067 D3 | **Landed. Row wording wrong.**
The note carries the revert rule that the `form` type brought. See
below. |
| 7212321297, second row | ADR-0160, implementation split, row 7's
bullet | **Landed.** The row places the stale path near line 425; it is
near line 491. |
| 7213085888 | ADR-0048 §3.5 | **Landed.** The row's ready text, dated
2026-11-28, with symbol anchors where it had line numbers. |
| 7215202653, corrected by 7215223685, with 7224476684 | ADR-0150 D3,
the note of 2026-11-26 | **Landed.** Item 2 of the first row said the
two doors were still open. The later row supersedes it: PR objectstack-ai#37948
merged, and both doors now refuse. |
| 7217585102 | ui ADR-0057, A2 and A3 | **Landed. Row stale on one
line.** The plan-marker line is written as `main` is today, after PR
objectstack-ai#37970, and not only as it was after PR objectstack-ai#37720. |

Comments that are not rows: 7186949648 (triage note), 7196224618 (a
one-row claim), 7196910014 (its report), 7198334624 (its landing record)
and 7237786310 (this claim).

**No row is held.** Every prerequisite is merged on `main`: PRs objectstack-ai#37219,
objectstack-ai#37240, objectstack-ai#37268, objectstack-ai#37354, objectstack-ai#37366 (which carried objectstack-ai#37422), objectstack-ai#37371, objectstack-ai#37389,
objectstack-ai#37423, objectstack-ai#37449, objectstack-ai#37640, objectstack-ai#37720, objectstack-ai#37818, objectstack-ai#37931, objectstack-ai#37948, objectstack-ai#37970, objectstack-ai#37065,
objectstack-ai#36138 and objectstack-ai#37021. The card has 19 comments as of this pull request; a
row added after comment 7237786310 is not in it.

### Where a note differs from its row

- **ADR-0146.** The row offers two forms, "give the count" or "point to
ADR-0084's table". The note takes the second. A count written today
would already be the third reading (32, then 33, now 35).
- **ADR-0160 D1, the page cap.** The row's premise was true when it was
written and is not now. `RecordContextDoor.pageCap` exists, and both
doors answer it. The note records the one-row difference between the
amendment's words and the code: a list whose cut plus its probe row
would pass the cap is cut one row under the cap.
- **ADR-0160 D3, the link field.** The note leaves the wording alone.
- **ADR-0066 D2 ⑧.** Two changes to the proposed text. The note says in
words that `viewAllFieldsReadVote` replaced `superuserFieldVote`, and
anchors only the function that exists. And it does not say that nothing
re-opens a lock across sets: another set's `viewAllFields` still makes a
hidden field readable, and another set's field row with `editable: true`
still grants the edit, because field grants union without deny.
- **ADR-0159, line 109.** PR objectstack-ai#37422 was merged into PR objectstack-ai#37366's branch,
so the anchor `view.zod.ts#defineForm` resolves and the gate is green on
it. It now resolves onto the `form` type's factory, while the paragraph
describes the Studio helper, which is `defineMetadataForm` today. The
paragraph is Context and describes the tree before the ruling was
carried out, so the note leaves it as written and states both names.
- **ADR-0010.** The row covers the three restore doors of PR objectstack-ai#37423. The
same rule has since gained a second refusal, from PR objectstack-ai#37640: a restore
that would write a version the platform registered into a package's row.
The note has one sentence on it. That sentence goes beyond the row; cut
it if the note should carry the row alone.
- **ADR-0067 D3.** The row asks for a note "naming `form` as a
translated metadata type". D3 is about undo granularity and has no such
notion. The contract reviews of PR objectstack-ai#37422 sent one fact to this record:
a `form` item is reverted only after every `view` row its commit edited
is put back, and it joins `failed[]` otherwise. The note records that.
- **ADR-0048.** The row's text was dated 2026-11-24. The note is dated
2026-11-28, the day it was written into the record.
- **ADR-0150.** Besides answering "Not judged yet", the note qualifies
one sentence of the 2026-11-26 note that said too much: the draft
discard is newly refused only over a stored package-less draft. Where it
was already refused, only its sentence moved.
- **ADR-0158.** Row 7179515770 points at a draft held by its seat, which
this session could not read. The notes are written from the two rows and
the code. Open item 13 is a new numbered item at the end of the list,
carried from the display card; it is marked not built and not settled.
- **ui ADR-0057.** The row asks for "what main does after objectstack-ai#37720".
`main` has moved once more: since PR objectstack-ai#37970 the entry's marker stands
for a write that waits for approval. The note says that, and that A5's
"Not recorded yet" bullet held until that pull request merged.

## Tests

Docs only. No package is touched, so no build closure and no package
test is owed for the change. No tested behaviour changed, so there is no
ablation.

What was checked by hand, on the committed text:

- Each phrase a note quotes from its ADR was compared with the base
file.
- Each verbatim maintainer quotation was compared, byte for byte, with
its record on GitHub.
- Each cited path and symbol exists on `main`. The one exception is
deliberate: the ADR-0160 note names `packages/spec/src/ai/skill.form.ts`
to say that no such file exists.
- Upstream moved ten commits while this was written (`e42520c67b` to
`e2a0e90025`). None touches an ADR file or a file a note cites.
`overlap-check` answers `VERDICT clean exit 0` against `origin/main` at
`e2a0e90025`, and no open pull request shares a file with this branch.

The local gate set is the `dispatch-gates --commands` derivation for
this change set, 27 commands, run on the final commit `c2c3345747`. Each
exit code was captured before any pipe. Reconciliation: `Run
reconciliation — 27 derived, 27 run, 0 NOT-MEASURED, 0 UNRUN`, all 27
with a recorded exit code.

<details><summary>ADR gates on c2c3345 (all exit 0)</summary>

| Command | Exit | Verdict line |
|:---|:---|:---|
| `pnpm check:adr-symbol-anchors` | 0 | `check-adr-symbol-anchors: 4525
anchors across 164 records resolve`, 0 line anchors survive. On the base
commit the same gate reads 4478. |
| `node scripts/check-adr-links.mjs` | 0 | `check-adr-links: 1268
relative link destination(s) under docs/adr/ resolve` |
| `node scripts/check-adr-links.mjs --self-test` | 0 | |
| `pnpm check:adr-anchors` | 0 | |
| `pnpm check:adr-index` | 0 | `adr-index --report: OK —
docs/adr/README.md is current, every record parsed` |
| `pnpm check:doc-authoring` | 0 | |
| `pnpm check:nul-bytes` | 0 | `check-nul-bytes: OK (scanned 28605 text
file(s)`, no raw control bytes |
| `pnpm check:closed-ceremony-text` | 0 | |
| `pnpm --filter @objectstack/lint run check:doc-formula-expressions` |
0 | run after building `@objectstack/formula` and `@objectstack/lint`
under the verify lock |
| `pnpm --dir ui run check:new-line-citations` | 0 | `VERDICT
new-cross-file-line-citations: 0 new citation(s)`. Not in the derived
list; run because a ui ADR changed. |

</details>

<details><summary>The other derived families on c2c3345 (all exit
0)</summary>

`node scripts/check-closing-keyword-parity.mjs` and its `--self-test`,
`node scripts/check-comment-mask-corpus.mjs`, `node
scripts/ci/plan-test-core-shards.mjs --self-test`, `pnpm
check:ci-filter-parity`, `pnpm check:cross-package-test-inputs`, `pnpm
check:driver-memory-census`, `pnpm check:gitlink-declared`, `pnpm
check:pm-governed-merges`, `pnpm check:pm-prior-rulings`, `pnpm
check:published-files`, `pnpm check:refd-timer-probe`, `pnpm
check:registry-log-declared`, `pnpm check:rest-log-spy-declared`, `pnpm
check:tier-file-adoption`, `pnpm check:undeclared-dep-imports`, `pnpm
check:watch-hint-literal`.

Before the push: `node scripts/check-commit-card-trailers.mjs --range
origin/main..HEAD` exit 0, one commit message, no card relation and no
model identifier in the trailer pair.

</details>

<details><summary>The ui scripts test family: one prerequisite failure,
then green</summary>

Derived command: `pnpm --dir ui exec vitest run scripts/`, run under the
verify lock with `--maxWorkers=2`.

- First run: `VERDICT command-exit 1`. `Test Files 1 failed | 171 passed
| 2 skipped (174)`, `Tests 1 failed | 5144 passed | 2 skipped (5147)`.
The one failure was
`scripts/__tests__/unit-registry-absence-collision.test.ts`, with
`Failed to resolve entry for package "@objectstack/client"`. The package
had no build output in the fresh worktree. That is a missing
prerequisite, not a verdict on this change.
- After building the `@objectstack/client` closure under the lock, the
same command on the same commit: `VERDICT command-exit 0`. `Test Files
172 passed | 2 skipped (174)`, `Tests 5145 passed | 2 skipped (5147)`.

</details>

Not run locally: the repository test project behind `test:repo`, which
CI runs on the pull request and on the merge group. Every other family
CI runs is read from this pull request's check runs, not re-run here.

## Acceptance notes

- **Changeset.** None, and the pull request carries `skip-changeset`.
`docs/adr/**` and `ui/docs/adr/**` ship in no package: the ui tree's
root is a private workspace root and `ui/docs` is under no package
directory.
- **Governed surface.** `docs/adr/**` lands by the maintainer's hand.
This pull request stays a draft; the seat hands it over.
- **The registry count.** The card row and the amendment both carry a
number. The repository rule for a volatile count is to remove it and not
to sync it, so the note adds none.
- **Seen and left alone.** These are outside the card and are not
changed here.
- ADR-0084, near line 226, says `form` is not a registered type. It is
about the working names of the 2026-07-01 table, and `form` is
registered now. It is a candidate row for next week's card of this name.
- One internal skill playbook and ui ADR-0056 still use the Studio form
helper's old name. The review of PR objectstack-ai#37366 already recorded both.
- Comments in the console's chat scope helper still describe the
`app:PKG:build` dock key and the Studio copilot.

## Verification

### Read first

1. `docs/adr/0066-unified-authorization-model.md`, the note of
2026-11-28 under D2 ⑧. It is the highest-risk hunk: one long paragraph
on authorization, and it supersedes parts of three earlier notes. Check
the sentences on what another set can still re-open, and the sentence
that stored sets are read with the new meaning and never rewritten.
2.
`docs/adr/0150-behavioural-metadata-addressed-by-package-objects-keep-the-literal-prefix.md`,
the amendment note of 2026-11-28. Check the four cells and their
remedies (enable, enable, name the package, name the package) against
the ruling it quotes.
3.
`docs/adr/0158-units-of-measure-standard-unit-table-org-units-quantity-unit-declaration-base-quantity.md`,
the notes under Open items 6 and 10 and the new Open item 13. Both notes
quote the maintainer, and item 10's records the shape of a new system
object.

### Two-minute check

Run `git diff --numstat origin/main...HEAD` on this branch. Expect ten
rows, nine under `docs/adr/` and one under `ui/docs/adr/`, each with `0`
in the removed column, and 239 added lines in total. Then run `pnpm
check:adr-symbol-anchors` and expect exit 0 with a line that contains
`check-adr-symbol-anchors: 4525 anchors across 164 records resolve`.

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

<!-- signed: repo:objectstack#1 · os-elon-musk ·
session_016WV4cxRDKprCtjpEdtiPFW -->

---------

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 pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue 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.

3 participants