Skip to content

feat(spec,ui): an object declares when a whole record is read-only by hand (object-level uiReadonlyWhen) - #38169

Merged
objectstack-fleet[bot] merged 16 commits into
mainfrom
claude/issue-37402-object-ui-readonly-when
Nov 28, 2026
Merged

objectstack-fleet[bot] merged 16 commits into
mainfrom
claude/issue-37402-object-ui-readonly-when

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Fixes #37402

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

维护者速读

  • 用户能看到什么变化:作者可以在对象上写一句「状态为已确认或已完成时整单人手锁定」,控制台的编辑对话框、记录页、表格、看板、日历、甘特图和工时表都改不了这条记录;备注这类字段可单独放开;按钮、接口、导入、流程照常写入。
  • 为什么做:父卡「字段只能通过动作修改」的裁决「按长远模型」把对象级这一半一并定下;确认后的订单、已过账的发票要整单锁,逐字段写条件容易漏。
  • 出错会怎样:漏掉某个界面入口时用户仍能手改,数据仍由校验规则兜底;去掉对象上的这一句即可撤回。「复制记录取默认值」一项控制台目前没有复制入口,本次未建,见下文。
  • 要你做什么:无。

What changes

Governing ruling (on #36806, 2026-11-26, the card's governing text, quoted): 「按长远模型」 — two tiers (server lock readonly/readonlyWhen; hand lock uiReadonly/uiReadonlyWhen) × two levels (field, object); a field's own declaration wins over the object default; write paths keep every write (the engine never reads the key). ADR-0085 §2 (the object-level key names the console as a whole, not a page) and ADR-0049 (a declared key is enforced on every surface it names).

Spec (packages/spec)

  • ObjectSchema.uiReadonlyWhen — optional CEL predicate over the record's own columns (EvaluatedExpressionInputSchema, the field key's scope), with TSDoc and describe. No default, so no parsed object grows a key.
  • Liveness row object.uiReadonlyWhen (live); Studio object form row (Advanced section, CEL code row); regenerated reference docs, authorable-surface record (data/Object:uiReadonlyWhen) and state counts.

Console (ui/packages/**) — item 3, one helper, no surface reads the key

  • @object-ui/core handLock.ts: effectiveUiReadonlyWhen(def, object) — the field's own uiReadonlyWhen when the field declares a hand lock of its own — uiReadonly: true or a uiReadonlyWhen — else the object's. uiReadonly: false is not a declaration of its own: it reads as absent and the field follows the object lock (seat ruling on the card, Q1 = B; the one opt-out spelling is uiReadonlyWhen: P\false`). fieldLockPredicates(def, object)for operand fetches.fieldReadOnlyByHand(def, record, { object, … })andfieldHasConditionalHandLock(def, object)take the object **as a required argument**, so the compiler asks every caller for it (the helpers first shipped in the19.0.0-next.0prerelease with the field-level hand lock and are in no stable release; a caller written against that prerelease must now pass{ object }` — the changeset carries the migration).
  • Every caller passes the object: record page (DetailSection, HeaderHighlight, InlineEditSaveBar, stage path), grid cell (cellReadOnlyKind gains a required object), kanban drop, calendar drop, Gantt write gate (ganttPatchByHand takes the object), timesheet cell.
  • The direct resolveFieldRuleState callers read the folded predicate from the producer, not the object: the edit dialog's form fields (sectionFields.fromObjectSchema, ObjectForm) carry effectiveUiReadonlyWhen(...), so form.tsx and WizardForm (which judge what a form field carries) fold the object lock with no change of their own; editFormLockedByState folds it the same way; line-item columns (deriveMasterDetail, derived and authored) carry the CHILD object's predicate, which GridFieldWidget already judges per row.
  • Operand fetches: the grid's own row load and the list view's $select fetch the object predicate's operands for every inheriting column / edited-in-place field.

Server

  • Engine untouched (item 6): nothing under packages/objectql/** reads the key.
  • MCP describe_object (item 5) reports the object's uiReadonlyWhen text at the answer's top level where authored, on HTTP (runtime/domains/mcp.ts) and stdio (mcp/mcp-server-runtime.ts); the tool description says how to read it.
  • FLS scrub (metadata-core): an object predicate that reads a field denied to the caller is served as the constant true (fail-closed, the field-level precedent: deleting it would open every record for exactly that caller).
  • os validate (lint): the object slot is checked as the field slot is (record-scoped check + root verdict), at object 'NAME' uiReadonlyWhen.
  • Studio form row translated in all 11 metadata-forms locale packs (platform-objects); translated-leaf pin 845 → 846.

Why

A whole-record lock (confirmed order, posted invoice) had to be written as a uiReadonlyWhen on every field — tedious, and one missed field leaves a hand edit open. The ruling adopted the object level now.

Item 4 (console duplicate) — no surface, not delivered

Measured on f72f3353: no person-triggered record duplicate exists in the console. Searched ui/packages and ui/apps for duplicate|clone|onClone|cloneRecord|data.clone(: the hits are the view switcher's view actions, Studio package/sharing-rule/permission-set clones, an unused detail.duplicate translation string, and the spec capability flag enable.clone. The only record clone is the REST door POST /data/:object/:id/clone (rest/data-action-routes.ts → cloneData), reached by the SDK's data.clone — an API write, which by the ruling keeps every value. Item 4 is reported as "no surface — not delivered" and nothing was built; the done-when clause "duplicating the confirmed record yields a record whose status is the field's defaultValue" has no surface to hold on. The rule is carried by #38202 as the acceptance of a future console Duplicate action (seat ruling on the card, Q3). Fixes #37402 stands.

Tests

  • @object-ui/core handLock-36806.test.ts (new top-level describe): object lock locks a non-declaring field while TRUE and only then; uiReadonlyWhen: 'false' (string and envelope) keeps a field editable; a field's own predicate / uiReadonly: true locks where the object does not (override both directions); explicit uiReadonly: false is NOT a declaration — the field follows the object lock (Q1 = B), with a CONTROL that uiReadonlyWhen: 'false' (alone or beside uiReadonly: false) still opens it; server lock does not cancel the object default; fail-closed on a faulted / operand-less object predicate; the fold helpers.
  • plugin-form dialogHandLock-36806.test.ts: dialog form fields carry the object predicate / the field's own; line-item columns (derived and authored) carry the child object's.
  • app-shell editFormLockedByState.test.ts: object lock greys Edit; a false override keeps it live; off while the predicate does not hold.
  • plugin-grid: cell verdict over the object lock and its override; the row load $select asks for the object predicate's operand and not for a column with its own lock.
  • plugin-kanban: a drop on a record the object locks writes nothing; a lane field with its own false writes the move.
  • lint: object slot accepted / bare reference / parse / undeclared field / unbound root refused (each authoring refusal has a test); read-surface pin gains uiReadonlyWhen.
  • metadata-core: denied operand → served 'true' (string and envelope); readable → served as written.
  • mcp stdio and runtime HTTP describe_object: the object predicate is reported; no field's readonly changes; a stored uiReadonly: false lists no hand-lock key; an object without it carries no key.
  • Dogfood (ui-readonly-hand-lock-36806.dogfood.test.ts, new top-level describe on one shared boot): the done-when object (state_machine on status, object uiReadonlyWhen: P\record.status in ['confirmed','done']`, notes P`false`); the served definition carries both predicates; a PATCH to a confirmed record lands with **no X-ObjectStack-Dropped-Fields`**; an import update writes and the machine still refuses an illegal move; a declarative action writes.

Acceptance notes

  • L2 record (contract review, PASS) S1 fixed in head 36e883f1: WizardForm.tsx's final-submit gate drops the carried uiReadonlyWhen on a CREATE wizard, at the evaluating site, as form.tsx and GridFieldWidget do. Fixed there rather than in sectionFields.fromObjectSchema because every other create surface already drops the predicate where it evaluates it; omitting it at the producer would make one of four readers behave differently from the other three, and the gate also reads predicates that never pass through fromObjectSchema. The same gate still judges the field's own readonlyWhen on a create, where form.tsx does not; that is pre-existing and left alone. Pin in wizardPredicateScope.test.tsx: a create wizard over a locked object still demands an empty required field (red before the fix: the create went through); CONTROL: an edit wizard on a confirmed record still treats the inheriting field as locked and saves without it (green before and after). N2 (this body and the @object-ui/core changeset now name 19.0.0-next.0) and N3 (describe_object: a field's own uiReadonlyWhen is judged by that predicate, which may itself lock it) are taken; N1 waits on the seat's maintainer question.

  • Seat rulings on the card's three open questions (newest seat comment on spec: an object declares when a whole record is read-only by hand (object-level uiReadonlyWhen), fields override it, and duplicating a record takes the locked fields' defaults #37402): Q1 = B, maintainer verbatim 「B 不算放开」 — implemented in head 696c37e9 (declaresOwnHandLock, the pin flipped, every describe / help / liveness / changeset / describe_object string names the two counting spellings; help retranslated in 10 locales). Q2 = A, kept as built. Q3: item 4 closes as "no surface — not delivered", carried by console: a person-triggered "Duplicate record" action, whose copy takes hand-locked fields' defaults (the rule ruled on #36806, no surface today) #38202.

  • requiredWhen prompt collector (fields/requiredWhenPrompt.ts) keeps reading the field's own key: the hosts' fillable callbacks already judge the object lock over the STORED record, which is the right record for a transition the person is still allowed to make.

  • The public intake form page (ui/apps/console FormPage.tsx) is create-only and never carried a hand lock; untouched.

  • A parent's object lock does not lock its child line-item rows: those rows are records of the child object and follow the child object's own lock.

  • The grid cell judges with the grid's own fetched object definition; while that read is in flight the cell sees no object lock (the same window the host field catalogue already has).

  • objectExtensions does not gain the key (not asked).

Verification

Two-minute check: cd ui && pnpm exec vitest run packages/core/src/evaluator/__tests__/handLock-36806.test.ts — expect the #37402 describe green (7 cases).

First files to read (by risk): ui/packages/core/src/evaluator/handLock.ts (the fold and its override rule); ui/packages/plugin-form/src/sectionFields.ts (how the edit dialog gets the object lock without form.tsx reading it); packages/metadata-core/src/object-schema-fls-references.ts (objectHandLock, the fail-closed serve).

S1 verification on head 36e883f1: wizard pins red before the fix (1 failed: the create case; CONTROL green), green after; wizard + dialog files 5 files / 31; @object-ui/plugin-form full suite 248 files / 2,805 and type-check 0; mcp typecheck 0, mcp-server-runtime.test.ts 20/20; overlap-check clean. The derived gate union on 36e883f1 is reported in the card's delta os-dev-report.

Q1 re-verification on head 696c37e9 (no conflict with origin/main, so no merge): ui hand-lock files 5/5 (49 tests); ablation restoring the old rule (uiReadonly !== undefined counts) turns the flipped pin red (1 failed / 14 passed), restore blob == HEAD; mcp mcp-server-runtime.test.ts 20/20, runtime describe 5/5; typecheck mcp, runtime and @object-ui/core type-check 0; spec check:liveness 0; spec check:generated all 14 up to date; check:i18n 0, check:i18n-stale-fill OK; platform-objects 130 files / 2,214; overlap-check clean. The derived gate union on 696c37e9 is reported in the card's delta os-dev-report.

Verification record (first head) — every reading below is taken on objectstack-ai/objectstack at head 0bee2a81 (the branch after merging origin/main at 0e361201) unless it says otherwise; locked runs went through os-verify-lock.sh.

Tests (package suites and targeted files)
  • @objectstack/spec full suite (pre-merge head 6ce7aa65, spec untouched by the merge; check:generated re-run green on 0bee2a81): 910 files / 28,814 passed.
  • @objectstack/runtime full suite (pre-merge): 655 files / 12,342 passed, 25 skipped; on 0bee2a81: mcp-object-hand-lock-36806.test.ts 5/5 and typecheck 0.
  • @objectstack/lint full suite on 0bee2a81: 245 files / 9,870 passed; typecheck 0.
  • @objectstack/metadata-core full (pre-merge): 244 files / 9,861; on 0bee2a81 the FLS file 68/68.
  • @objectstack/mcp full (pre-merge): 88 files / 1,644; on 0bee2a81 mcp-server-runtime.test.ts 20/20.
  • @objectstack/platform-objects full (pre-merge): 130 files / 2,214.
  • @objectstack/metadata-protocol protocol.meta-types-degenerate-derivation.test.ts on 0bee2a81: 18/18.
  • Dogfood ui-readonly-hand-lock-36806.dogfood.test.ts (booted stack): 10/10.
  • UI full suites (pre-merge): core 250 files / 4,843; plugin-form 248 / 2,803; plugin-detail 424 / 4,000; plugin-timesheet 3 / 46; plugin-grid 319 / 2,803; plugin-kanban 91 / 613; plugin-calendar 70 / 527; plugin-gantt 98 / 816; plugin-list 190 / 2,081 — all green. app-shell full suite: NOT MEASURED locally (stopped after 40+ min; CI Test UI runs it); its two lock files ran green.
  • UI hand-lock files on 0bee2a81 (15 files): 250/250. type-check on 0bee2a81: core, plugin-form, plugin-detail, plugin-grid, plugin-kanban, plugin-calendar, plugin-list, plugin-gantt, plugin-timesheet, app-shell — all Done.
  • Type-check (pre-merge): spec, lint, mcp, metadata-core, runtime, platform-objects, dogfood — all 0.
Shown red without the fix (ablation, restored to HEAD each time)
  • effectiveUiReadonlyWhen made to ignore the object (return undefined): 10 of the new UI pins red across core, plugin-form, app-shell, plugin-grid (cell and row load) and plugin-kanban; the override controls stayed green. Restore: blob equals HEAD, git diff HEAD empty.
  • Lint: the object slot read made undefined: the four refusal cases red, the accept case green. (A first attempt was refused by the ablation tool before running — its replacement text already existed — and re-anchored.)
  • FLS: uiReadonlyWhen: objectHandLock swapped for expression: the fail-closed pin red, the control green.
Gates (derived union on 0bee2a8)
  • node scripts/pm/dispatch-gates.mjs --commands: 127 families; all run; 124 exit 0; 3 exit 3 (PREREQUISITE NOT MET, NOT MEASURED): check-plugin-teardown-shape.mjs --self-test (shallow clone cannot read its pinned fixture commit), spec check:skill-examples (client SDK dist not built), check:dual-build-cjs-loads (a package without dist). CI runs all three.
  • dispatch-gates.mjs --ran with exit codes: "127 derived famil(ies) accounted for — 124 run, 3 NOT-MEASURED (3 DERIVED from a recorded exit 3)".
  • spec check:generated on 0bee2a81: "All 14 generated artifacts are up to date".
  • overlap-check.mjs before every push: VERDICT clean exit 0.
  • check-nul-bytes.mjs: 0.
  • Full dogfood battery: n/a (no !, no (narrowing) arm).

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 passes (CI).
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 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.

🤖 Generated with Claude Code

https://claude.ai/code/session_017xRBcRd37NZMCYvVAmVk4b


Generated by Claude Code

… hand (object-level uiReadonlyWhen)

WIP: spec key, console fold, MCP describe, FLS scrub, lint slot.

Claude-Session: https://claude.ai/code/session_017xRBcRd37NZMCYvVAmVk4b
Co-authored-by: Claude <noreply@anthropic.com>
… regenerated references

Claude-Session: https://claude.ai/code/session_017xRBcRd37NZMCYvVAmVk4b
Co-authored-by: Claude <noreply@anthropic.com>
…tems, edit lock, grid and kanban

Claude-Session: https://claude.ai/code/session_017xRBcRd37NZMCYvVAmVk4b
Co-authored-by: Claude <noreply@anthropic.com>
…uiReadonlyWhen leaves

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

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 6 package(s): @objectstack/lint, @objectstack/mcp, @objectstack/metadata-core, @objectstack/platform-objects, @objectstack/runtime, @objectstack/spec, touching 10 documentable anchor(s). ⚠️ 3 changed file(s) yielded no anchor (packages/spec/authorable-surface/data.json, packages/spec/liveness/object.json, packages/spec/liveness/state-counts/object.md), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

  • content/docs/concepts/metadata-driven.mdx (via ObjectSchemaBase (symbol, a top-level const object))
What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/authorable-surface/data.json, packages/spec/liveness/object.json, packages/spec/liveness/state-counts/object.md) — pages documenting those are invisible to this run
  • 2 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 — 187 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 73ec085afa2f9689ef96263a9c25b82cde6fda47 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 41f6f29da027d2570b0d4cc368468466d812a27b — the merge of head b012f9b6094cfc372f46c5a64cbecc127b733524 into base 73ec085afa2f9689ef96263a9c25b82cde6fda47, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 41f6f29da027d2570b0d4cc368468466d812a27b && git checkout 41f6f29da027d2570b0d4cc368468466d812a27b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 73ec085afa2f9689ef96263a9c25b82cde6fda47 b012f9b6094cfc372f46c5a64cbecc127b733524 && git checkout -B drift-repro 73ec085afa2f9689ef96263a9c25b82cde6fda47 && git merge --no-ff b012f9b6094cfc372f46c5a64cbecc127b733524

node scripts/docs-audit/affected-docs.mjs --json 73ec085afa2f9689ef96263a9c25b82cde6fda47

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

…follows the object lock (ruling Q1 = B)

Claude-Session: https://claude.ai/code/session_017xRBcRd37NZMCYvVAmVk4b
Co-authored-by: Claude <noreply@anthropic.com>
…rences name the two counting spellings

Claude-Session: https://claude.ai/code/session_017xRBcRd37NZMCYvVAmVk4b
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Contract-review-claim: session_017xRBcSAaBEfQpU2yJexSJ8 · head 696c37e · 2026-11-28T07:47Z

The lane seat runs the owed CONTRACT_REVIEW_TIER review through an isolated at-tier subagent.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 696c37e9089a35d06fc3be07c5893eb26987d05a
Local-runs: none
Scope: packages/spec/src/data/object.zod.ts, packages/spec/src/data/object.metadata-form.ts + ui/packages/core/src/evaluator/handLock.ts, ui/packages/plugin-form/src/sectionFields.ts, ui/packages/plugin-form/src/ObjectForm.tsx, ui/packages/plugin-form/src/deriveMasterDetail.ts, ui/packages/app-shell/src/utils/editFormLockedByState.ts, ui/packages/plugin-grid/src/objectGridCellFacts.ts, ui/packages/plugin-grid/src/objectGridRowLoad.ts, ui/packages/plugin-grid/src/ObjectGrid.tsx, ui/packages/plugin-list/src/ListView.tsx, ui/packages/plugin-kanban/src/ObjectKanban.tsx, ui/packages/plugin-calendar/src/ObjectCalendar.tsx, ui/packages/plugin-gantt/src/ganttHandLock.ts, ui/packages/plugin-gantt/src/ObjectGantt.tsx, ui/packages/plugin-timesheet/src/ObjectTimesheet.tsx, ui/packages/plugin-detail/src/DetailSection.tsx, ui/packages/plugin-detail/src/HeaderHighlight.tsx, ui/packages/plugin-detail/src/InlineEditSaveBar.tsx, ui/packages/plugin-detail/src/renderers/recordPathStageChange.tsx, packages/lint/src/validate-expressions.ts, packages/metadata-core/src/object-schema-fls-references.ts, packages/runtime/src/domains/mcp.ts, packages/mcp/src/mcp-server-runtime.ts, packages/mcp/src/mcp-http-tools.ts, packages/spec/liveness/object.json
Security-touching: yes
Rule-change-verified: none

Inputs read: card #37402 body and all six comments (rulings 7235326611 included), the governing ruling 7180466652 on #36806, PR #38169 body and file list (73 files), the net diff against the merge base 0e361201, and the check-runs on the head (every run success or skipped). Security-touching: yes because the metadata-core hunk teaches field-level-security behaviour; no hits path is under skills/** or .claude/**.

① Derived judgments

  • Accept-set, ObjectSchema: one new optional key uiReadonlyWhen (EvaluatedExpressionInputSchema.optional(), the field key's type). The object is a strictObject, so this is a widening. Right. No default, so no parsed object grows a key.
  • os validate: a new refusal at object 'NAME' uiReadonlyWhen; no stack valid on main carries the key. Right.
  • Served metadata: a predicate that mentions a denied field is served as constant true (the object-level twin of the field-level arm) — Q2 = A. Right.
  • MCP describe_object: one new optional top-level key on both answers plus the tool description. Additive. Right.
  • @object-ui/core: new effectiveUiReadonlyWhen, fieldLockPredicates, ObjectHandLockDef; fieldReadOnlyByHand / fieldHasConditionalHandLock signatures narrowed (see ②). Every in-repo caller updated; Type Check UI green.
  • Generated and pinned surfaces: the lane seat's remainder, gates green.
  • Engine: nothing under packages/objectql/** in the diff; item 6 holds by absence; the dogfood pin (no X-ObjectStack-Dropped-Fields on a PATCH to a confirmed record) green.

② Semver level

  • @objectstack/spec minor for one new optional authorable key: right.
  • @object-ui/core minor: stands (helpers added on 2026-11-26, never in a stable release, pre mode). The changeset's "not published yet … after 19.0.0-next.0" sentence is contradicted by the head's CHANGELOG (N2).
  • 13 other changesets patch, one per moved published package. Check Changeset green.
  • Clause-②: yes (widening), Metadata-protocol: added, consistent with the diff.

③ Boundary flags

  • Q1 = B (maintainer): implemented — declaresOwnHandLock is uiReadonly === true || uiReadonlyWhen != null; the rule is stated as B in every place it appears (TSDoc/describe, Studio form help and locales, liveness row, changesets, describe_object description, describedHandLockPredicate comments, handLock.ts header). No statement of A left. Pinned.
  • Q2 = A: implemented as ruled.
  • Q3: the PR body reports item 4 as "no surface — not delivered" and names console: a person-triggered "Duplicate record" action, whose copy takes hand-locked fields' defaults (the rule ruled on #36806, no surface today) #38202 (open, p3). A read-only search of ui/** at the head for a record clone or duplicate caller returned nothing.
  • Dev deviations: all accepted (Test UI 16/16 covers the app-shell suite).
  • ESCALATED to the seat — a product question: a parent's whole-record lock does not cover its inline child rows. Line-item columns carry the CHILD object's predicate (deriveMasterDetail.ts), and editFormLockedByState returns false whenever the object places an inline child collection, so a confirmed order with lines keeps every line row editable by hand unless the child declares its own lock (which cannot read the parent's status). This is the literal reading of the card's item 1, disclosed in the PR's acceptance notes, but the maintainer summary promises 「整单人手锁定」. It needs a carrier or the maintainer's word; it does not block this head.
  • Skills-docs: follow-up owed — skills/objectstack-data/SKILL.md names no carrier number; bind it to adr: field write locks are two tiers, two forms and two levels (readonly / readonlyWhen vs uiReadonly / uiReadonlyWhen, field over object); the data skill teaches the four spellings #37405 or a new card.
  • SQL push-down: no finding.

④ Design judgment

object.zod.ts holds against ruling 7180466652 and Q1 = B; effectiveUiReadonlyWhen agrees with the TSDoc sentence by sentence (a field's own uiReadonly: true or uiReadonlyWhen wins both ways; uiReadonly: false reads as absent; a server lock does not cancel the object default; a fault locks every inheriting field; a blank field predicate fails closed), with one exception, S1. object.metadata-form.ts states the B rule in Studio's own words. The implementing files agree with the contract.

S1 (should-fix) — "A create is not judged" does not hold in the wizard's final-submit gate. sectionFields.ts (fromObjectSchema) puts the object's predicate on every form field in every mode; form.tsx and GridFieldWidget drop it on create, but WizardForm.tsx gateFinalSubmit (line 905) passes it to resolveFieldRuleState with no create check and skips any field that resolves readonly. On a create wizard for an object with the lock, a TRUE or faulting predicate over the wizard's values makes every inheriting field read-only, so the whole-form required check is skipped. No hand lock opens and the server still refuses; the cost is the client-side gate. Fix at one site (omit the effective predicate when isCreateFormMode(ctx) in sectionFields.ts, or drop it on isCreateWizard in the gate) plus a pin. Read from code, not run.

N1 (nit) — the object describe lists "the line-item grid" among locked surfaces without saying line rows follow the CHILD object's lock; carry with the ③ escalation.

N2 (nit) — the @object-ui/core changeset's "not published yet" sentence (and the PR body's) is contradicted by the CHANGELOG at the head. Level unaffected.

N3 (nit) — mcp-http-tools.ts says a person "cannot edit any field … except a field that lists its own uiReadonlyWhen"; such a field is judged by its own predicate, which may lock it.

No must-fix found. S1 is open on this head and earns a delta review of its fix.

Implemented-by: claude/issue-37402-object-ui-readonly-when
Reviewed-by: session_017xRBcSAaBEfQpU2yJexSJ8

VERDICT: PASS

…and lock on a create (L2 S1)

Also: the @object-ui/core changeset names the prerelease the helpers first shipped in,
and describe_object says a field's own uiReadonlyWhen may itself lock it.

Claude-Session: https://claude.ai/code/session_017xRBcRd37NZMCYvVAmVk4b
Co-authored-by: Claude <noreply@anthropic.com>
…ls/list byte ceiling

Claude-Session: https://claude.ai/code/session_017xRBcRd37NZMCYvVAmVk4b
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Relay pr_dequeue · session_017xRBcSAaBEfQpU2yJexSJ8 · request fw-20261128T113340Z-73b0cf

Merge-queue dequeue of #38169 — cause seat-asks.

  • Relay read: landing seat repo:objectstack#8 · sunhaolin, signed by repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8.
  • Seat's reason: Queue run 46137914293 Dogfood Regression Gate (3/3): expression-conformance.test.ts UNCLASSIFIED surface data/object.zod.ts:ObjectSchemaBase.uiReadonlyWhen needs an ADR-0060 ledger row; deterministic, this PR adds the key. Patch round before re-queue.

The relay sends dequeuePullRequest after this comment and confirms the removal by reading the queue back; the run row of this request carries the outcome. Re-queue once the cause is fixed (landing-operations.md, the landing seat's queue duty).

@objectstack-fleet
objectstack-fleet Bot removed this pull request from the merge queue due to a manual request Nov 28, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Dequeued · 2026-11-28T11:34Z · head fe52e09c · correction to my re-queue receipt 7238605356.

That receipt read this PR's CI as "still in progress". It went on to fail on this PR's own diff:

  • Queue run 46137914293, Dogfood Regression Gate (3/3): test/expression-conformance.test.ts › "is a sound conformance ledger + ratchet (ADR-0060 checkLedger)". Failure: AssertionError: UNCLASSIFIED surface — add a ledger row (ADR-0060): data/object.zod.ts:ObjectSchemaBase.uiReadonlyWhen.
  • This is deterministic. The PR adds ObjectSchema.uiReadonlyWhen, a new expression surface, without its ADR-0058 D7 / ADR-0060 conformance-ledger row. PR CI does not run that dogfood shard, which is why the PR side was green.

The seat dequeued the re-queued entry (relay pr_dequeue, cause seat-asks, before its build ran) so the PRs queued behind it are spared. A patch round to the dev adds the ledger row. Then: a delta L2 on the new head, L1, re-queue.

…ema.uiReadonlyWhen

Claude-Session: https://claude.ai/code/session_017xRBcRd37NZMCYvVAmVk4b
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 46140292866 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Dogfood Regression Gate (3/3) — 失败步骤: Boot example apps and exercise real user flows

    @objectstack/dogfood:test:  FAIL   isolated  test/expression-conformance.test.ts > ADR-0058 D7 — expression surface conformance ledger > is a sound conformance ledger + ratchet (ADR-0060 checkLedger)
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: UNCLASSIFIED surface — add a ledger row (ADR-0060): data/object.zod.ts:ObjectSchemaBase.uiReadonlyWhen: expected [ Array(1) ] to deeply equal []
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • ⚠️ 本 PR 过去 24h 已在队列失败 1 次(不含本次)。 内容未变而反复失败 ⇒ 高度怀疑 flaky 测试或与同组 PR 的语义冲突,重排不解决。
  • 过去 24h 队列共有 29 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Contract-review-claim: session_017xRBcSAaBEfQpU2yJexSJ8 · head b012f9b · 2026-11-28T12:13Z

The lane seat runs the owed CONTRACT_REVIEW_TIER delta review (the conformance-ledger row) through an isolated at-tier subagent.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: b012f9b6094cfc372f46c5a64cbecc127b733524
Local-runs: none
Scope: packages/spec/src/data/object.zod.ts, packages/spec/src/data/object.metadata-form.ts + packages/qa/dogfood/test/expression-conformance.ledger.ts, ui/packages/core/src/evaluator/handLock.ts, ui/packages/plugin-form/src/sectionFields.ts, ui/packages/plugin-form/src/ObjectForm.tsx, ui/packages/plugin-form/src/WizardForm.tsx, ui/packages/plugin-form/src/deriveMasterDetail.ts, ui/packages/app-shell/src/utils/editFormLockedByState.ts, ui/packages/plugin-grid/src/objectGridCellFacts.ts, ui/packages/plugin-grid/src/objectGridRowLoad.ts, ui/packages/plugin-grid/src/ObjectGrid.tsx, ui/packages/plugin-list/src/ListView.tsx, ui/packages/plugin-kanban/src/ObjectKanban.tsx, ui/packages/plugin-calendar/src/ObjectCalendar.tsx, ui/packages/plugin-gantt/src/ganttHandLock.ts, ui/packages/plugin-gantt/src/ObjectGantt.tsx, ui/packages/plugin-timesheet/src/ObjectTimesheet.tsx, ui/packages/plugin-detail/src/DetailSection.tsx, ui/packages/plugin-detail/src/HeaderHighlight.tsx, ui/packages/plugin-detail/src/InlineEditSaveBar.tsx, ui/packages/plugin-detail/src/renderers/recordPathStageChange.tsx, packages/lint/src/validate-expressions.ts, packages/metadata-core/src/object-schema-fls-references.ts, packages/runtime/src/domains/mcp.ts, packages/mcp/src/mcp-server-runtime.ts, packages/mcp/src/mcp-http-tools.ts, packages/spec/liveness/object.json
Security-touching: yes
Rule-change-verified: none

Delta round on the full record 7238240401 (head fe52e09c, PASS, nothing open), rendered as a full record on this head.

Inputs read:

Security-touching: yes because the metadata-core hunk teaches field-level-security behaviour, as before. No hits path is under skills/** or .claude/**.

① Derived judgments

  • Unchanged since fe52e09c. The delta touches no hits file and no spec, lint, runtime, MCP or UI file. The earlier judgments stand:
    • ObjectSchema.uiReadonlyWhen is one new optional key on a strictObject, a widening with no default. Right.
    • os validate gains a refusal at object 'NAME' uiReadonlyWhen. Right.
    • A predicate that reads a denied field is served as constant true (Q2 = A). Right.
    • describe_object answers one new optional top-level key on both transports. Additive. Right.
    • The @object-ui/core helper signatures take the object as a required argument, and every in-repo caller passes it. Right.
    • Nothing under packages/objectql/** is in the diff. Right.
  • Delta, the ledger. The new key is an expression surface: it is typed EvaluatedExpressionInputSchema, a roster member, inside the column-0 declaration ObjectSchemaBase (object.zod.ts:4092, the key at :4774). The ratchet key the scan derives is therefore data/object.zod.ts:ObjectSchemaBase.uiReadonlyWhen, which is the string the queue printed and the string the new covers entry spells. No public surface or accept-set moves: the file is a dogfood test module. Right.
  • The gate that failed is not among the PR check-runs. PR CI does not run that dogfood shard, so the 61 green runs do not answer the ratchet on this head. Read statically it holds: the cover matches the discovered key, no other row covers it, the row is enforced with an enforcement cell, and the proof file exists. The dev reports 8/8 locally and an ablation that reproduces the queue message; I did not run either. The queue's Dogfood Regression Gate is the measurement.
  • main since the merge base. object.zod.ts moved on main in four hunks; the nearest is at line 4702, the PR's hunk is at 4745, and none adds an expression-typed key. The ledger and its test did not move on main.

② Semver level

  • Unchanged: @objectstack/spec minor, @object-ui/core minor, 13 patch changesets. Check Changeset is green on the head.
  • The delta needs no changeset: the ledger is a test file of the private dogfood package and ships in no tarball.
  • Clause-②: yes (widening), Metadata-protocol: added. Consistent with the diff.

③ Boundary flags

④ Design judgment

expression-conformance.ledger.ts — a second cover, not a row of its own. This holds.

  • What the rules ask. ADR-0058 D7 says "one row per expression-holding declaration". ADR-0060 and checkLedger state the checked form: each surface is covered by exactly one row, and no cover is stale. Neither forbids a row from covering several surfaces. checkLedger refuses a surface in two rows and an unclassified surface, nothing else about covers.
  • Precedent in this ledger. cel-field-rule covers three keys, the validation row covers three keys across three schemas, and the settings row covers two keys across two schemas. This is the first cover pair that spans two files; nothing in the ledger or the helper depends on the file.
  • The ledger's own split test. The comments on cel-field-deadline-settled and on this row give it: a surface gets its own row when its evaluator, its fault direction, or whether a server reads it differs. For the object key none differs:
    • Evaluator: effectiveUiReadonlyWhen returns the object predicate into the same resolveFieldRuleState slot (handLock.ts:117-123, :170-180).
    • Fault direction: the same UI_READONLY_WHEN_FAULTED = true (fieldRules.ts:367).
    • Server: no server evaluates either key.
    • Dialect, mode and binding: CEL, interpret, the row as record.
  • A row of its own would be worse. It would repeat the evaluator chain and host list of the field row, and the two cells could then drift apart on a claim that is one fact.

The changed enforcement text, sentence by sentence.

Claim Read in the tree Holds
Default of every field that declares no hand lock of its own (uiReadonly: true or a uiReadonlyWhen) declaresOwnHandLock, handLock.ts:106-108; uiReadonly: false reads as absent (Q1 = B) yes
Folded in by effectiveUiReadonlyWhen (core/evaluator/handLock.ts) handLock.ts:117-123; no host reads the object key itself yes
The same hosts Every host passes the object: edit dialog (sectionFields.ts:377, ObjectForm.tsx:1026, editFormLockedByState.ts:105), record page (DetailSection, HeaderHighlight, InlineEditSaveBar, recordPathStageChange), grid cell (objectGridCellFacts.ts:86), line-item stored rows (deriveMasterDetail.ts:323, :484), kanban, calendar, Gantt, timesheet yes
Faulting LOCKED likewise The folded predicate lands in the uiReadonlyWhen slot, whose fault answer is the constant above yes
A create is not judged Unchanged tree since fe52e09c; the seven create paths of record 7238240401 stand, and editFormLockedByState returns false with no record yes
Lint checks the object slot at object 'NAME' uiReadonlyWhen the same way validate-expressions.ts, the #37402 block: the same fieldRuleRootVerdict('uiReadonlyWhen', …), the same record-scoped check, no write gate, as the field slot yes
UI only; the server lock is readonlyWhen No packages/objectql/** path in the diff; the spec TSDoc says the engine never reads it yes

proof. It still points at ui/packages/core/src/evaluator/__tests__/handLock-36806.test.ts, and that file covers the object level. Its #37402 block (from line 96) pins:

  • the lock on a field with no own declaration, with the no-object control;
  • uiReadonlyWhen: false on a field as the opt-out;
  • uiReadonly: false following the object lock (Q1 = B);
  • the server lock not cancelling the object default;
  • fail-closed on an object predicate that cannot be evaluated, and on a row missing the operand;
  • the fold helpers.

The file exists, which is all checkLedger checks here: this ledger passes no attribution option, so no claim marker is owed. Test UI is green on the head.

N5 (nit) — the row's unchanged opening clause says the evaluator is "called directly by the edit dialog and the grid cell, and through the one verdict fieldReadOnlyByHand … everywhere else". The object grid's cell goes through fieldReadOnlyByHand (objectGridCellFacts.ts:86); the direct callers are form.tsx, the wizard gate, the line-item grid's cell (GridFieldWidget.tsx:860) and editFormLockedByState.ts:98. Every one reaches the same evaluator with the folded predicate, so the classification is unaffected. The clause is on main already. Accepted as written.

N6 (nit) — the row id stays cel-field-ui-readonly-when while it now also classifies an object key. Ids are stable handles and the summary names both keys. Accepted as written.

Everything else — unchanged since fe52e09c. object.zod.ts, object.metadata-form.ts, the liveness row and the implementing files agree with ruling 7180466652, Q1 = B and Q2 = A as record 7238240401 found. Re-read on this head: handLock.ts, the lint block, the spec key and its describe.

S1: closed

N1 (nit) — the object describe lists "the line-item grid" without saying line rows follow the child object's lock. Unchanged; carried by #38249.

N2: closed

N3: closed

N4 (nit) — the describe_object object clause says "every field" without "judged by the validations". Unchanged; accepted as written in record 7238240401.

No must-fix, no should-fix.

Implemented-by: claude/issue-37402-object-ui-readonly-when
Reviewed-by: session_017xRBcSAaBEfQpU2yJexSJ8

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

L1: ACCEPT · head b012f9b609 · 2026-11-28T12:18Z · card #37402

Seat checks

  1. Delta since ACCEPT 7238273754 (head fe52e09c): one commit, one file, +8/−3, packages/qa/dogfood/test/expression-conformance.ledger.ts.
    • It folds data/object.zod.ts:ObjectSchemaBase.uiReadonlyWhen into the existing cel-field-ui-readonly-when row as a second covers entry, with the summary and enforcement text widened to state it.
    • This answers the merge-queue failure that dequeued the PR (run 46137914293, Dogfood Regression Gate 3/3, UNCLASSIFIED surface).
    • The ledger is a test file of the private dogfood package, so no changeset is owed.
  2. L2: delta record 7239130920 on this head (CONTRACT_REVIEW_TIER, fable) is PASS, with nothing open.
    • Folding into the field row is right by the ledger's own split test: the evaluator, fault direction (fail-closed) and server reach are the same.
    • Every sentence of the new enforcement text was checked against the tree, and proof covers the object level.
    • N5 and N6 are accepted as written.
  3. Measurement note: the gate that failed (the dogfood expression-conformance shard) does not run in PR CI, so the 61 green check-runs here do not measure it. The dev ran it locally (8/8, with an ablation reproducing the queue message), and the reviewer read it statically. The queue build is the measurement; a red there on this signature is diagnosed, not re-queued.
  4. Gates at this head: 61 success · 9 expected skip · 0 failed · 0 pending. NOT governed. K = 3 < 15.

Landing: non-governed, ≤3000 lines, Clause-②: yes (widening) (no narrowing leg). The seat re-queues it through the ordinary queue.

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit c279520 Nov 28, 2026
70 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37402-object-ui-readonly-when branch November 28, 2026 13:11
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…r their amount and subtitle (objectstack-ai#38214)

<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoAvhxsnErQnmY8cTbgC3beU)_

Fixes objectstack-ai#37891
repo:objectstack#3 · os-tesla · session_01L9qibwy7XB37e8e1P6jRJ3

Clause-②: no
Metadata-protocol: none

## 维护者速读
-
用户能看到什么变化:在手机上看列表和相关列表时,卡片按对象声明的「最重要字段」显示:右下角是其中第一个金额(订单明细显示这一行的合计,不再是单价),副标题依次显示后面最多三个字段,数字类带名称,例如「数量
2 · 单价 ¥6,000.00 · 折扣 10.00%」;电脑上的宽表格不变。
- 为什么做:HotCRM 订单明细的手机卡片只写「1 · 2」、右下角是单价,要改只能动宽表格的列顺序;你 11 月 28
日选了「按对象的最重要字段」,不加新配置。
- 出错会怎样:声明了「最重要字段」的对象,手机卡片都会跟着变(事先粗量约 222 处里 180 处,大多在
HotCRM),哪个对象读着不对,调它的「最重要字段」顺序即可;整个改动可以直接撤回。
- 要你做什么:无。

## What changes

Governing ruling: the maintainer chose option A on objectstack-ai#37891 (ruling record
7235312203, 2026-11-28T06:25Z, anchor 7235198146): phone cards follow
the object's `highlightFields` (ADR-0085 §1), no new key, no line-number
title prefix. Built as the claim (7235321485) and its surface amendment
(seat, 2026-11-28T06:31Z) say.

- `ui/packages/plugin-grid/src/ObjectGrid.tsx`
(`buildMobileCardRenderer`): when the object declares `highlightFields`,
the card body is that list, in order (title excluded): the amount is the
first entry that draws as money (objectstack-ai#37890's `drawsAsMoney`), the subtitle
the next three, skipping the status field and the title formula's reads,
empty values dropped (0 is a value), and a number, currency or percent
part (a formula or summary by its value type) is drawn under its field
label (`grid-card-subtitle-label`). A highlighted field the view shows
is drawn through its column draft; one it does not show through the
synthesized draft. Masked fields stay masked: never the amount, never a
part. An object without `highlightFields` keeps the column-order card
(two unlabelled parts).
- `ui/packages/plugin-grid/src/objectGridGenerateColumns.tsx`: the
synthesized path's per-field draft is now its own callback,
`synthesizeFieldColumn` (same body: renderer, translated label, FLS),
which `generateColumns` calls and the card reuses. No behaviour change
for columns.
- Fetches, beside the declared name field and through the same gates
(declared, FLS-readable, not draft-only/withheld/redacted), on every
viewport so a width change never refetches:
- `ui/packages/plugin-grid/src/objectGridRowLoad.ts` `getSelectFields`
(the grid's own fetch);
- `ui/packages/plugin-list/src/ListView.tsx` harvest (the list page's
fetch);
- `ui/packages/plugin-detail/src/RelatedList.tsx` `selectFields` (the
related list's fetch; derived-columns lists still send no projection).
- Changeset: `@object-ui/plugin-grid`, `@object-ui/plugin-list`,
`@object-ui/plugin-detail` patch, naming the phone-card change.

## Tests
- `plugin-grid` `phoneCardAmount-34615.test.tsx`, new top-level describe
(HotCRM order-line fixture at 390 px): amount = highlighted total
(CN¥10,800.00) though the table shows the unit price first; subtitle
`Quantity 2 · Sales Price CN¥6,000.00 · Discount % 10.00%`; a text part
drawn bare; an empty part dropped; a highlighted field no column shows
is drawn and is in the grid's `$select`; CONTROL no `highlightFields`
keeps `1 · 2` and the unit price, no labels; CONTROL a `password` field
first in `highlightFields` is neither amount nor part and its value is
never printed.
- `plugin-list` `ListView.harness.test.tsx`, new top-level describe: a
highlighted field no column shows is in `$select` and not drawn; CONTROL
no `highlightFields` sends the old projection.
- `plugin-detail` `RelatedList.selectFls-10186.test.tsx`, new top-level
describe: a declared, readable highlighted field is requested, an
undeclared one never; an FLS-denied one is not requested; CONTROL no
`highlightFields` keeps the projection.

## Acceptance notes
- The fetches ask for `highlightFields` on desktop too (a few extra
columns per row), as they already ask for the name field, so crossing
the 768 px breakpoint never refetches.
- The status chip is unchanged: drawn when a column shows the status
field; the status field is never a subtitle part.
- The related list's non-enlarged mobile gallery (`object-gallery`) path
is untouched (objectstack-ai#37008 owns its labels).
- No "×" joiner and no title prefix, by the ruling. The HotCRM
`highlightFields` re-order (order line, quote line, and a review of its
other objects) follows in its own card after this lands, per the
anchor's 裁后执行.
- Measured before the ruling (anchor 7235198146, static simulation): 180
of 222 shipped phone-card surfaces change, 134 of 138 on HotCRM;
platform objects only gain a third part.

## Verification
Two-minute check: `cd ui && pnpm exec vitest run
packages/plugin-grid/src/__tests__/phoneCardAmount-34615.test.tsx -t
highlightFields`, expect the objectstack#37891 describe green (7 cases).

First files to read (by risk):
`ui/packages/plugin-grid/src/ObjectGrid.tsx` (the card body and the
label rule); `ui/packages/plugin-grid/src/objectGridGenerateColumns.tsx`
(the extracted draft, must be byte-equivalent for columns);
`ui/packages/plugin-detail/src/RelatedList.tsx` (the projection arm and
its gates).

Verification record: every reading below is on
`objectstack-ai/objectstack`, base `origin/main` 4f7aa88, through
`os-verify-lock.sh`, after rebuilding the closure (`turbo run build
--filter='@object-ui/plugin-grid^...'
--filter='@object-ui/plugin-list^...'
--filter='@object-ui/plugin-detail^...'`, 58/58).

<details><summary>Tests</summary>

- The three changed test files at 32340f2+: `Test Files 3 passed (3)`,
`Tests 168 passed (168)`; the plugin-grid file alone at the fixture fix:
`Tests 18 passed (18)`.
- Full suites `pnpm --dir ui exec vitest run packages/plugin-grid/
packages/plugin-list/ packages/plugin-detail/` at 5f2eee0 (head
512ad74 changes only test docblock comments): `Test Files 933 passed |
1 skipped (934)`, `Tests 8897 passed | 18 skipped (8915)`, VERDICT
command-exit 0.
- `type-check` in plugin-grid, plugin-list, plugin-detail: exit 0 each.
</details>

<details><summary>Shown red without the fix (ablation, restored to
HEAD)</summary>

- The five source files restored from base 4f7aa88 (tree only;
`objectstack#37891` marker count 0 on disk in each), the three test
files run: `Tests 9 failed | 159 passed (168)`. Red: all six grid cases
with `highlightFields` (the masked control too, on its amount half: the
base tree shows the unit price), both RelatedList projection cases, the
ListView projection case. Green: the three no-`highlightFields`
controls.
- Restored with `git checkout HEAD -- PATHS`: marker counts back
(2/1/1/1/1), `git diff HEAD` empty, each blob equal to its HEAD blob.
</details>

<details><summary>Gates</summary>

`node scripts/pm/dispatch-gates.mjs --commands` at 512ad74: 39 families
derived, all 39 run locally, all exit 0 (two first hit a 240 s per-gate
timeout, exit 124, and were re-run to exit 0: `pnpm
check:query-options-erasure`, `pnpm --dir ui exec vitest run scripts/` =
172 files passed). `--ran`: `39 derived famil(ies) accounted for — 39
run, 0 NOT-MEASURED`.

`overlap-check` before each push: VERDICT clean, exit 0 (objectstack-ai#38169 and
objectstack-ai#37924 share files and merge cleanly).

PR check-runs at 512ad74 (`pr-state`): 42 success, 13 expected skip, 0
failed, 0 pending; mergeable_state clean.
</details>

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

https://claude.ai/code/session_01L9qibwy7XB37e8e1P6jRJ3

---

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

<!-- signed: repo:objectstack#3 · os-tesla ·
session_01L9qibwy7XB37e8e1P6jRJ3 -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…d each whole column when it queries itself (objectstack-ai#38234)

<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoEynsd5XL1JYxPkwhkywADp)_

Fixes objectstack-ai#37844
repo:objectstack#3 · os-tesla · session_01L9qibwxBy3QieJMqJbJtTk

Clause-②: no
Metadata-protocol: none

## 维护者速读
- 泳道看板只拿到一部分记录时(列表视图交来的一页,或看板自己按 `limit` 读满一窗),每条泳道的计数只是已加载卡片数,带
`+`;看板自己读数时连列计数也是这样。现在发一次「列字段 × 泳道字段」两键分组读,泳道计数(自查询看板还有列计数)都显示整数。
- 接在 objectstack-ai#37326(泳道看板的列统计)和 objectstack-ai#37327(宿主一页的整列计数)之后,补上泳道这一维。
- 只多一次分组读,筛选、搜索与现有的分组读同源;已经拿到全部记录的看板不发;数据源不支持分组读、被拒、被截断时照旧带
`+`。不改数据和配置,可以直接撤回。
- 无

## What changes
- `ui/packages/plugin-kanban/src/ObjectKanban.tsx`: the swimlane read.
On a board drawn in swimlanes (`swimlaneField`, or `grouping.fields[0]`)
that holds a window of its query, one `queryGroupHeaders` read with
`groupBy: [laneField, swimlaneField]` and `COUNT(*)`, compiled by the
existing `compileLaneReadQuery` (same `where`, `search`, `searchFields`
as the lane read), plus the second key. "Holds a window": a board that
queries itself whose fetch filled its `$top` (`countsAreWindowed`), or a
board handed one page (`hostLaneRead`) once the lane read's counts add
up to more records than the board holds. The answer is folded twice with
`readLaneCounts`: by the swimlane key into `swimlaneCounts` (the
no-value group under `''`), and by the lane key into the column counts
of a board that queries itself (a board handed a page keeps the lane
read's). A cut or refused answer folds to `null`.
- `ui/packages/plugin-kanban/src/KanbanImpl.tsx`: a `swimlaneCounts`
prop. A swimlane row writes its whole count from it (`swimlaneRowCount`,
read the way `wholeLaneCount` reads a column), and falls back to today's
cards-plus-`+` (`swimlaneCountIsWhole`) where it gives none. The
no-value row reads the `''` group; a row keyed `''` (a stored empty
text) shares that group and keeps the fallback.
- `ui/packages/plugin-kanban/src/KanbanBoardCore.tsx`: passes
`swimlaneCounts` through, a package-internal prop like `laneCounts`.
- `patch` changeset for `@object-ui/plugin-kanban`.

No new export, spec key or host prop. Cells draw no new figure (claim:
A1).

## Tests

`ui/packages/plugin-kanban/src/ObjectKanban.swimlaneStatistic-37326.test.tsx`
(24 deals: open 20, won 4; north 12, south 12). The rig's grouped door
now groups by every `groupBy` key and can cut its answer.
- (c) a page handed in (3 north, 1 south on the page): the rows read
`12` and `12`, not `3+` and `1+`; the reads are the lane read, then one
`{ groupBy: ['stage', 'region'], aggregations: [{ function: 'count',
alias: 'count' }] }`; no `find`.
- (d) CONTROL, the page holds every record: bare counts, one read (the
lane read), no swimlane read.
- (f) CONTROL, a board that queries itself and holds every record: no
grouped read at all.
- New describe, a board that queries itself through `limit: 10`: rows
`12`/`12` and columns `20`/`4` from one two-key read, one `find`; under
the board's own filter (`amount >= 2`) rows `10`/`10`, columns `18`/`2`;
CONTROL no door / refused / cut keep `5+`/`5+` and `10+`/`0+`; CONTROL a
window the query does not fill (`limit: 50`) asks nothing; CONTROL a
handed page whose lane read is cut asks no swimlane read and keeps
`3+`/`1+`.

<details><summary>Readings (head c302aa2, base origin/main
f294277)</summary>

- Premise at f294277 (probe on the objectstack-ai#37326 rig, kept in the project at
`/mnt/project-files/card-37844/`, not in this PR): a board that queries
itself through `limit: 10` wrote columns `10+`/`0+`, rows `5+`/`5+`, and
asked no grouped read; a handed page wrote columns `20`/`4` and rows
`3+`/`1+` from one read grouped by `stage` alone; cells draw cards only.
- Real backend (scratch test, not in this PR, kept at
`/mnt/project-files/card-37844/real-backend-two-key-probe.test.ts`):
`RestServer`'s `POST /api/v1/data/:object/query` over `ObjectQL` +
`SqlDriver` (better-sqlite3), 26 deals, the query exactly as the board
compiles it. `200`, `records: [open/null 2, open/north 10, open/south
10, won/north 2, won/south 2]`, `hasMore: false`. With `where: { amount:
{ $gte: 2 } }`: open/null 2, open/north 9, open/south 9, won/north 1,
won/south 1. With `search: 'won'`: won/north 2, won/south 2. With
`OS_DATA_DEFAULT_PAGE_SIZE=3`: 3 groups and `hasMore: true`, which the
board reads as no counts. Folded as the board folds it: columns open 22,
won 4; rows no-value 2, north 12, south 12.
- Ablations on the committed fix through `scripts/ablation-replace.mjs`,
each restored to blob == HEAD with `git diff HEAD` empty:
- `swimlaneCounts={swimlaneCounts}` → `swimlaneCounts={undefined}`:
`Tests 3 failed | 15 passed (18)`, (c) and the two self-window pins;
- `laneCounts={boardLaneCounts}` → `laneCounts={hostLaneCounts}`: `Tests
2 failed | 16 passed (18)`, the two self-window column pins.
- `pnpm --filter @object-ui/plugin-kanban type-check` exit 0; `pnpm
--filter @object-ui/plugin-kanban test`: `Test Files 91 passed (91)`,
`Tests 621 passed (621)`; every test file outside the package that reads
`ObjectKanban.tsx`, `KanbanImpl.tsx`, `KanbanBoardCore.tsx` or
`KanbanLaneStatistic.ts` off disk, plus the app-shell kanban rig: `Test
Files 19 passed (19)`, `Tests 642 passed (642)`.
- eslint on the four changed source and test files: 0 errors.
- `overlap-check` before the first push: clean against origin/main and
objectstack-ai#38169 (shares `ObjectKanban.tsx`).
- Derived local gates: see Acceptance notes.
</details>

## Acceptance notes
- Scope is the claim's: swimlane row counts on a windowed swimlane
board, and on a board that queries itself its column counts too, from
one two-key read. Cells draw no new figure (A1); a "N not loaded" cell
line would be new UI with new i18n keys and is not built here. objectstack-ai#37517's
lane-foot "Load more" and objectstack-ai#38120's text-field lanes are untouched.
- On the board handed a page, the swimlane read follows the lane read:
the board knows it holds a window only once that read's counts exceed
its cards. A refused or cut lane read asks no swimlane read; the two-key
read would be refused or cut the same way.
- A swimlane whose records all sit outside the window draws no row (as
today); its count is in the answer but no row reads it.
- `KanbanLaneStatistic.ts` was in the claimed surface and needed no
change: `compileLaneReadQuery` builds the query, and the second key is
added beside it.
- Local narrowing: `@object-ui/app-shell`'s full suite is left to `Test
UI`.
- Derived local gate set at c302aa2: `dispatch-gates --ran` reconciles
38 derived, 38 run, every one exit 0, 0 NOT MEASURED, 0 unrun.

## Verification
Read first (by risk):
1. `ui/packages/plugin-kanban/src/ObjectKanban.tsx`: `hostWindowed` /
`selfWindowed`, `swimlaneQuestion` and `boardLaneCounts`, beside
`headerTotals`.
2. `ui/packages/plugin-kanban/src/KanbanImpl.tsx`: `swimlaneRowCount`
and the swimlane header.
3. The new pins in `ObjectKanban.swimlaneStatistic-37326.test.tsx`.

Two-minute check: from `ui/`, `pnpm exec vitest run
packages/plugin-kanban/src/ObjectKanban.swimlaneStatistic-37326.test.tsx`
shows 18 passing; set `swimlaneCounts={undefined}` in `ObjectKanban.tsx`
and (c) and the self-window pins fail.

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

https://claude.ai/code/session_01L9qibwxBy3QieJMqJbJtTk

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…ectstack-data teaches the four locks (objectstack-ai#38428)

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

Fixes objectstack-ai#37405

Clause-②: no (no accept set or export changes; governed rules text, so
one contract-review-tier review before the queue; Tier H)
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:给应用建数据模型的人和
AI,现在能从技能里学到「锁定一个字段」的四种写法各在什么时候用(比如销售订单的状态只让「确认」按钮改、不让人手改);把两种锁同时配在一个字段上时,校验报错会指出该看哪份设计说明。平台行为不变。
- 为什么做:你对「字段只读分两级」那张决策卡已经定了长远模型,功能也已上线,但设计说明和技能里一直没有记下来,这一步是补上记录。
- 出错会怎样:最坏是说明里某句话和平台实际做法对不上,作者照着配错了锁;只改文字和一句报错提示,可以直接撤回。
- 要你做什么:设计说明和技能文件的改动需要你批准合并。

## What changes

No key, schema, accepted value, default or runtime behaviour changes.
This records the ruling of record on objectstack-ai#36806 (ruling record 7180466652,
「按长远模型」) and the two object-level rulings on objectstack-ai#37402 (ruling records
7235326611 and 7237772411), whose code landed in objectstack-ai#37436, objectstack-ai#37888 and
objectstack-ai#38169.

-
`docs/adr/0163-field-write-locks-two-tiers-two-forms-two-levels-ui-prefix-admission.md`
(new, `Accepted (2026-11-26)` on the ruling record; it reaches `main`
only by the Tier H approval). D1 two tiers (server lock `readonly` /
`readonlyWhen`, hand lock `uiReadonly` / `uiReadonlyWhen`), D2 two forms
(`readonlyWhen: P\`true\`` is the set-once spelling), D3 two levels (the
object's `uiReadonlyWhen`; a field's own declaration wins; `uiReadonly:
false` is not a declaration), D4 what "by hand" is, D5 the admission
rule of the `ui` prefix (`uiVisibleWhen` / `uiRequiredWhen` are not
admitted), D6 contradictions, D7 the server lock stays a strip. The
record keeps two kinds of statement apart: Decision carries only what
the rulings say, quoted; "As built" says what `main` does at `c610020e`,
by symbol anchor. A third section, "Ruled and not yet held", lists the
three places the ruling covers and the code does not reach yet, each
with its open carrier card.
- `docs/adr/README.md`: regenerated by `node scripts/adr-index.mjs` (164
records).
- `skills/objectstack-data/rules/validation.md`: new section `## Locking
a Field`: a two-by-two table of the four keys (who is kept out, and
when), one checked sales-order example (the hotcrm#2716 case: a `status`
only the Confirm action moves), and five bullets on what each column
does at run time.
- `skills/objectstack-data/SKILL.md` § Conditional Field Rules: the
first bullet keeps its trap (the value is dropped, the write is not
refused, a declarative action's included) and routes to the new section.
- `skills/objectstack-data/evals/objects-fields-relationships.json`:
case 30, a `uiReadonly` status field (`must_contain`: `uiReadonly:
true`, `state_machine`). `evals/README.md` names it.
- `packages/spec/src/data/field.zod.ts`: the parse refusal for
`uiReadonly: true` beside `readonly: true` keeps its wording and now
ends `The two locks and which one to choose: ADR-0163 (D1, D6).` This is
the text `objectstack validate` prints for the pair. Pinned in
`field-ui-readonly.test.ts`.
- `.changeset/37405-field-write-lock-adr-skill.md`: `@objectstack/spec`
and `@objectstack/skills`, patch.

**One sentence of the skill is corrected, not only moved.**
`rules/validation.md` said "Imports and migrations are system-context
writes too." An import is not a system-context write. The `readonly`
describe in `FieldSchema` says so ("A normal (non-system) import is NOT
system-context and still strips"), `importControlOptOutRefusal` in
`packages/rest/src/import-prepare.ts` refuses the historical-import
opt-out to every HTTP caller, and the objectstack-ai#36806 measurement found the same.
The new section lists an import among the writes `readonly: true` drops,
and a migration among the system writers it lets through.

**Token ratchet** (`scripts/check-skills-token-ratchet.mjs`), two rows:

- `skills/objectstack-data/SKILL.md` 2239 → 2224: lowered to the
measurement.
- `skills/objectstack-data/rules/validation.md` 3466 → 3862 (+396). The
section is ordered into this skill by the ruling of record on objectstack-ai#36806
(ruling record 7180466652: the four spellings, which one to use, the
sales-order status example), and the raise follows the standing ruling,
verbatim: 「A:先削重复,余额按实测提高」 (ruling record 6513306068). Paid down first
in the same file, 1035 bytes cut against 2622 added:
- the two `readonly` / `readonlyWhen` bullets of § Conditional Field
Rules are now one pointer at the new section, which says the same once;
- § Conditional Validation loses its first example
(`enterprise_requires_manager`) and the lead-in of the second, whose
`when` / `then` / `otherwise` rule shows everything the first did.

### Skills readings (lines / bytes / tokens)

| | before | after |
|:-|:-|:-|
| `skills/objectstack-data/rules/validation.md` | 392 / 13861 / 3466 |
421 / 15448 / 3862 |
| `skills/objectstack-data/SKILL.md` | 167 / 8983 / 2239 | 167 / 8923 /
2224 |
| `skills/objectstack-data/evals/objects-fields-relationships.json` (not
ratcheted) | 520 / 37381 | 533 / 38751 |
| `skills/objectstack-data/evals/README.md` (not ratcheted) | 17 / 969 |
18 / 1016 |
| all of `skills/objectstack-data/**` | 4643 / 252853 | 4686 / 255797 |
| all `skills/*/SKILL.md` | 4386 / 228159 | 4386 / 228099 |
| all of `skills/**` | 23333 / 1230467 | 23376 / 1233411 |
| ratcheted (authored) total, tokens | 200510 | 200891 |

### Round 2 (head 6e397de): the contract review of 0922ab3

The review (comment 7248470779, PASS) left one should-fix and one nit.
Both are done in one commit.

- S1, `SKILL.md`: "a button's action included" was true of a declarative
action only. A script action's body runs in a system context, so its
write to a `readonly: true` field lands (ADR-0163, Alternatives, row 3).
The clause now reads "a declarative action's included". The ratchet row
follows the file to its measurement, 2224 (2223 at the previous head).
- N1, `rules/validation.md`: the table's left column was headed "Every
non-system write" over `readonlyWhen` too, which binds system writes as
well. The header is now "Every write" and the `readonly: true` cell
carries "(system writes pass)". The right header lost one word to pay
for it ("Only a person at the console"), and the Confirm sentence names
"a declarative Confirm". The file is 15448 bytes and its row stays 3862.
- The changeset's sentence on the Confirm action says "a declarative
action's own write" to match.

## Tests

- `packages/spec/src/data/field-ui-readonly.test.ts`: the existing
refusal case also asserts the message ends with `ADR-0163 (D1, D6).`
`vitest run src/data/field-ui-readonly.test.ts` in `packages/spec`: 5 of
5 pass.
- The new skill example carries the `os:check` marker, so
`check:skill-examples` type-checks it against the built
`@objectstack/spec` declarations. Exit 0: 353 marked examples
type-check, this one among them. The example was also parsed by
`ObjectSchema` and read by `validateStackExpressions` in two scratch
vitest files (not committed): it parses, and the expression lint reports
no issue for `readonlyWhen: P`true`` or `uiReadonlyWhen: P`false``.
- `check:skill-eval-tokens`: exit 0; both `must_contain` tokens of case
30 are taught by the bundle.
- Not run: a model-driven round of the skill evals. Case 30 has a new
hash and no recorded answer yet.

## Acceptance notes

- Done-when, line by line. "ADR accepted on `main`": the record's status
is `Accepted` on the ruling record and it lands by the Tier H approval
of this PR. "Skill section in place and its eval exercises a
`uiReadonly` status field": the section and case 30. "`objectstack
validate`'s refusal text for `uiReadonly` + `readonly` points at the
ADR": the message above.
- The card's Asked lists what the ruling says. Three points of it are
not held by code on `main` yet. The ADR says so in "Ruled and not yet
held" and names the open carrier of each: objectstack-ai#37898 (the assistant is among
the hands the ruling names; cloud AI service), objectstack-ai#38202 (console Duplicate
carries a hand-locked value), objectstack-ai#38249 (inline child lines of a
hand-locked parent). The skill section teaches only what `main` does
today.
- "`uiVisibleWhen` / `uiRequiredWhen` refused" (card wording): the
ruling's rule is that a key earns a `ui` twin only when an action must
write what a person may not, and only read-only meets it. Neither key
exists in the schema, so a strict parse answers each as an unknown key.
No dedicated refusal is added here; the ADR records the rule (D5) and
the skill says there is no `uiVisibleWhen`.
- D3 records that an object-level server lock (`readonlyWhen` on the
object) is not filed anywhere; it is named so a later reader does not
infer it from the hand lock's object level.
- The refusal message names the ADR by number, the form the spec's other
messages use (`ADR-0158 U2`, `ADR-0049`).
- Branch `claude/project-thread-bqsxpg` is assigned by the harness, not
the repo's `claude/issue-N-…` convention.

## Verification

Two-minute check: `node scripts/check-skills-token-ratchet.mjs`, expect
exit 0 with `skills/objectstack-data/rules/validation.md` 3862 / 3862
and `skills/objectstack-data/SKILL.md` 2224 / 2224.

Read first, by risk:

1. `skills/objectstack-data/rules/validation.md` § Locking a Field (it
ships to third parties verbatim): the left-column bullet, where the
writers `readonly: true` drops and lets through are listed, and the
import correction.
2. `docs/adr/0163-…md` D3 and D4 against the ruling records, then "Ruled
and not yet held".
3. `scripts/check-skills-token-ratchet.mjs`: the two rows and their
arithmetic.

<details><summary>Local gates at 6e397de (only what reads the two
changed skill files)</summary>

Not the whole list again: the second commit changes two skill files, the
ratchet rows and one changeset sentence. Re-run, each exit 0:
`check-skills-token-ratchet.mjs` (and `--self-test`), `ui`
`check:skill-eval-tokens`, `check:skill-links`,
`check:skill-frame-sync`, `check:skill-identifier-liveness`, spec
`check:skill-examples` (353 examples), `check:skill-docs`,
`check:skill-refs`, `check:skill-served-sections`,
`check-nul-bytes.mjs`.

</details>

<details><summary>Local gates at 0922ab3</summary>

`node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack
--ran FILE`, each command recorded as `CMD :: exit N`: **124 derived,
120 run, 4 NOT-MEASURED, 0 UNRUN**. Every run family exit 0, among them
`check-skills-token-ratchet.mjs` (and `--self-test`), `check:adr-index`,
`check:adr-anchors`, `check:adr-symbol-anchors`, `check-adr-links.mjs`,
`check:skill-links`, `check:skill-frame-sync`,
`check:skill-identifier-liveness`, spec `check:docs` /
`check:api-surface` / `check:authorable-surface` / `check:skill-docs` /
`check:skill-refs` / `check:liveness`, `check-empty-changeset.mjs`,
`check-adr-0087-registration.mjs --base origin/main`,
`check:ratchet-remedy-authority`, `check:type-check-debt`.

- The four recorded exit 3 (prerequisite not met), as the tool reads the
record:
- `check-plugin-teardown-shape.mjs --self-test`: NOT MEASURED. Its
positive control is pinned to a commit this shallow clone cannot reach.
The gate itself (without `--self-test`) ran, exit 0.
- `check:doc-formula-expressions`, `check:dual-build-cjs-loads`,
`check:lean-entry-closure`: exit 3 on the first pass (their build
closures were missing). After the closures were built each was run again
alone, exit 0. The record keeps both lines, and the tool reads a command
with two codes as the worse one, so its count stays 4.
- Outside the derived list, run by hand: spec `check:skill-examples`
(exit 3 before the `@objectstack/client-react` closure was built, exit 0
after: 353 examples), `ui` `check:skill-eval-tokens` (exit 0), `ui`
`check:skills-paths` (exit 0).
- `scripts/pm/overlap-check.mjs`: clean against `origin/main` (3579cf1)
and the one open PR that shares a file (objectstack-ai#38192,
`skills/objectstack-data/SKILL.md`).
- Built at `c610020e` plus this diff; `main` moved three commits since
(none under this diff's paths), not merged in.

</details>

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

https://claude.ai/code/session_01L6bhgTpyo8gQyqf9Tj9mfz

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…er-detail lines in the edit form (objectstack-ai#38388)

Fixes objectstack-ai#38249

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

## 维护者速读

-
用户能看到什么变化:对象上写了「整单人手锁定」条件的单据(如已确认的订单),在控制台编辑对话框里,明细行也一并锁住:不能加行、复制行、删行、拖动排序或改单元格;明细字段自己写了「始终可改」的那一列仍可编辑;整单与明细都没有可改之处时,记录页的「编辑」按钮置灰并说明原因。
-
为什么做:对象级整单锁定上线后,表头字段锁住了,明细行却还能手改,与「整单人手锁定」的承诺不符,维护者裁定按字面先落地、再立此跟进卡补上明细这一半。
-
出错会怎样:漏锁时用户仍能手改明细行,服务端校验照常兜底;误锁时只影响手工编辑,按钮、接口、导入、流程照常写入;去掉对象上的锁定条件即可撤回。
- 要你做什么:无。

## What changes

Governing ruling: the maintainer on PR objectstack-ai#38169 (the object-level hand
lock), 「本 PR 按字面落地+立跟进卡」; this card is that follow-up. The opt-out reads
the existing override rule of the two-tier lock model (ruling on objectstack-ai#36806,
Q1 = B on objectstack-ai#37402): a field that declares a hand lock of its own —
`uiReadonly: true` or a `uiReadonlyWhen` — is judged by it instead of
any object-level default, and `uiReadonly: false` is not such a
declaration. No key, value or schema property is added.

**`@object-ui/plugin-form`**
- `MasterDetailForm.tsx` (the edit dialog's line grids): the header
record feed also lands the parent object's `uiReadonlyWhen` with its
field names. On an EDIT form the lines judge it over the live header
record (every header field seeded `null`, the stored row as `previous`,
the host's predicate scope) through the one hand-lock verdict
(`fieldReadOnlyByHand` of a field that declares nothing, i.e. the object
lock itself, failing closed). While it holds: no Add, Duplicate, Remove
or drag-reorder, no per-row editor, and every line column whose child
field owns no hand lock is locked on every row. A create is not judged.
- `deriveMasterDetail.ts`: derived and hydrated line columns carry an
in-memory mark when their child field owns a hand lock
(`childFieldOwnsHandLock`, which asks `effectiveUiReadonlyWhen` itself
rather than restating the rule). `lockColumnsByParentHandLock` locks
every unmarked column. `childLinesOpenUnderParentHandLock` answers
whether some child field owns a non-static hand lock (exported from the
root and from `/core`).

**`@object-ui/app-shell`**
- `editFormLockedByState.ts`: an object that places an inline child
collection no longer keeps Edit live unconditionally. It greys Edit when
the object's own `uiReadonlyWhen` holds over the record, every drawn
header field is read-only, and no placed child object has a field that
could open a line cell. That needs the child definitions, through a new
optional `childObjectDef` argument; without it, or for a child it cannot
answer, Edit stays live (fail open, as before).
- `RecordDetailView.tsx`: passes the served object list as that
resolver.

Declared writes (REST, import, actions, flows) are untouched: nothing on
the server reads either key (ruling on objectstack-ai#36806).

Published surface, both additive (a non-protocol widening, so `patch`):
`@object-ui/plugin-form` exports `childLinesOpenUnderParentHandLock`
from its `.` and `./core` entries, and the exported
`editFormLockedByState` of `@object-ui/app-shell` takes an optional
fourth argument, `childObjectDef`; a caller that omits it behaves as
before.

## Why

PR objectstack-ai#38169's acceptance notes recorded that a parent's object lock did
not reach its line rows, and its contract review (record 7236877945)
escalated it. The maintainer summary of objectstack-ai#37402 promises 「整单人手锁定」 for a
confirmed order, while a person could still edit its lines.

## Tests

- New `MasterDetailForm.parentHandLock-38249.test.tsx` (real
`MasterDetailForm` and `GridField`): a locked parent offers no add /
duplicate / remove / reorder and locks a line cell; a child field with
its own `uiReadonlyWhen: 'false'` stays editable while its sibling is
locked; `uiReadonly: true` stays locked; a fully configured entry (no
child schema read) locks every cell; CONTROL draft parent edits as
before; CONTROL a create is not judged.
- `__tests__/dialogHandLock-36806.test.ts`, new top-level describe:
`childFieldOwnsHandLock` over each spelling (`uiReadonly: false` and a
server lock are not ownership); derived and authored (typed and untyped)
columns; an unmarked column fails closed;
`childLinesOpenUnderParentHandLock`.
- `editFormLockedByState.test.ts`, new describe: true when the lock
holds and no child field can open; false with a `'false'` child
override; true with only a static child lock; false when the predicate
does not hold; false when the header is locked field by field only;
fail-open without child definitions.
- `RecordDetailView.editLockedByState-32756.test.tsx`, new top-level
describe: Edit disabled with the state reason on a locked document with
lines; CONTROL a `'false'` child override and a draft record keep it
live.

## Acceptance notes

- Measured on `main` first: the new rendered pin against the unfixed
code, 4 failed / 2 passed (a confirmed parent's line cell was editable;
both controls green).
- Precedence, as the existing override rule gives it: a child field with
its own conditional `uiReadonlyWhen` (say over the line's own columns)
is judged by that predicate, so the parent's lock does not reach that
cell. Its default (no declaration) is now the child object's lock OR the
parent's.
- A row-level opt-out for adding or removing lines does not exist: under
a locked parent no line is added, duplicated, removed or reordered,
whatever the child fields declare. A field-level declaration opens only
that field's cell on stored lines.
- The per-row editor is not offered under a locked parent, because it
edits every child field. So in a form-factor collection (`inlineEdit:
'form'`, lines shown as a list) a child field's own opt-out has no
surface while the parent is locked: that collection reads fully locked.
- A fully configured entry (typed columns and the relationship field)
reads no child schema, so its columns carry no ownership mark and all
lock under the parent lock (the hand lock fails closed).
- Before the header record lands, the parent predicate is judged over
`null`-seeded header fields; a predicate such as `record.status ==
'confirmed'` then reads open until the record lands. This is the same
window as the grid's own object-definition read noted on PR objectstack-ai#38169.
- Scope: the console edit form and the record page's Edit state. The
record page's own line-items panel (`LineItemsPanel` / the record body
table editor) is not changed here; whether it should follow the parent's
lock is for its own card.
- The four commits' `Claude-Session:` trailers name the dispatching
seat's session (`session_017xRBcSAaBEfQpU2yJexSJ8`) instead of this dev
session (`session_017xRBcSPkRxFWubkD5XfiDh`), a transcription slip; the
history is left as pushed.
- File surface beyond the two claimed files, each `check-handover.mjs
--inflight` clear: `MasterDetailForm.tsx` (the line grid),
`RecordDetailView.tsx` (the Edit state's caller), `core.ts` and
`index.tsx` (one export each).

## Verification

Patch round (seat claim amendment 7247687945, head `1933251b`):
`Clause-②` corrected to `yes (widening)` here and in both changesets
(still `patch`, `Metadata-protocol: none`); `origin/main` merged twice
(`212babcf`, `1933251b`), no incoming commit touching this diff's files.
On `1933251b`: the four pin files 4/4 files, 42/42 tests;
`dispatch-gates.mjs --commands` 38 families, all run, all exit 0 (the ui
`scripts/` suite 172 files passed, 2 skipped / 5,159 tests); `--ran`:
"38 run, 0 NOT-MEASURED"; `overlap-check.mjs` VERDICT clean exit 0;
`check:nul-bytes` OK. The readings below are the first round's.

Two-minute check: `cd ui && pnpm exec vitest run
packages/plugin-form/src/MasterDetailForm.parentHandLock-38249.test.tsx`
— expect 6 passed.

First files to read (by risk):
`ui/packages/plugin-form/src/MasterDetailForm.tsx` (the
`parentHandLocked` verdict and the three grid props it gates);
`ui/packages/plugin-form/src/deriveMasterDetail.ts`
(`childFieldOwnsHandLock` and the mark);
`ui/packages/app-shell/src/utils/editFormLockedByState.ts` (the subform
branch).

Readings on `objectstack-ai/objectstack`, head `9166fa40` (the gate
union on `81f9ef2c`; the one later commit adds only the record-page test
describe, and the derived list on `9166fa40` is byte-identical).

<details><summary>Tests</summary>

- `@object-ui/plugin-form` full suite: 249 files / 2,816 passed, 1
skipped.
- `@object-ui/plugin-form` and `@object-ui/app-shell` `type-check` (both
`tsc --noEmit` and the test tsconfig): exit 0.
- app-shell targeted:
`RecordDetailView.editLockedByState-32756.test.tsx` +
`editFormLockedByState.test.ts` 27/27. The app-shell full suite is not
run locally (CI `Test UI` runs it).
- New and extended pins together (plugin-form + app-shell utils): 35/35.
</details>

<details><summary>Shown red without the fix
(scripts/ablation-replace.mjs, restored to HEAD each time, blob equal
and git diff HEAD empty)</summary>

- `MasterDetailForm.tsx` parent verdict forced `false`: rendered pin 4
failed / 2 passed (controls green).
- `editFormLockedByState.ts` back to returning false for any subform: 2
failed / 18 passed (the two "is true" cases).
- `deriveMasterDetail.ts` ownership mark removed: 3 failed (derived and
authored column cases, and the rendered `'false'` override case).
- `RecordDetailView.tsx` resolver dropped: 1 failed / 6 passed (the
Edit-disabled case).
</details>

<details><summary>Gates</summary>

- `node scripts/pm/dispatch-gates.mjs --commands`: 38 families, all run
on `81f9ef2c`; 37 exit 0. `pnpm --dir ui exec vitest run scripts/` exit
1: SIGKILLed by the container's memory limit while the plugin-form suite
ran beside it, so not measured on that run. Rerun alone under the verify
lock with `--maxWorkers=2`: 172 files passed, 2 skipped / 5,159 tests,
exit 0.
- `dispatch-gates.mjs --ran`: "38 derived famil(ies) accounted for — 38
run, 0 NOT-MEASURED" over the raw record (the exit 1 above as recorded).
- `overlap-check.mjs` before every push: VERDICT clean exit 0.
- `pnpm check:nul-bytes`: OK.
- Full dogfood battery: n/a (no `!`, no `(narrowing)` arm).
</details>

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes (CI).
- [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.

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

https://claude.ai/code/session_017xRBcSPkRxFWubkD5XfiDh

---

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

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:data 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

2 participants