Skip to content

feat(studio): the Field History setting offers Default, On and Off, and Default says what it resolves to - #36580

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-91elwa
Nov 23, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-91elwa

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #36482

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

维护者速读

  • 字段表单、对象表单的字段列表、对象「功能」里的「字段修改值」从开关改成三选一:默认 / 开 / 关。
  • 「默认」不写任何值(跟随平台),并直接写出它对这一行意味着什么:大多数类型显示「默认(开)」,媒体、JSON、凭据字段显示「默认(关)」。
  • 以前关掉后回不到「跟随默认」,现在选「默认」即删掉这个键;开、关照旧写 true / false。
  • 「默认是开还是关」与动态写入时的判断用同一个函数(新放进 spec),两边不会再各写一份类型清单而对不上;写入行为不变。
  • 若出错,可能表现为某个字段类型的「默认」标成开、实际写入时却不显示值(或相反),已有测试逐类型钉住。
  • 11 个语种的帮助文字同步改写,去掉了「开关显示为关」的说明。

What changes

Spec (packages/spec/src/data/field-history-default.ts, new, exported from @objectstack/spec/data):

  • resolveFieldHistory(field, object): whether a changed field's old → new values show on the activity timeline. Off when the object writes enable.fieldHistory: false, or the field writes fieldHistory: false, or the field is a credential (isMaskedOnReadFieldType, with the object's managedBy). On when the field writes fieldHistory: true or trackHistory: true. Otherwise on unless the type is in FIELD_HISTORY_DEFAULT_OFF_TYPES.
  • FIELD_HISTORY_DEFAULT_OFF_TYPES: the 14 types that were a private Set in the audit writer, unchanged, now frozen and typed FieldType[].
  • Same home and same reason as isMaskedOnReadFieldType (finding(spec): the protocol declares no masked field-type set — objectql's collectMaskedReadFields and objectui's MASKED_FIELD_TYPES each own a copy of one fact #20141): two consumers ask the question, so it is declared once.
  • field.form.ts and object.form.ts: the three fieldHistory rows (field form, the fields repeater, the enable composite) name widget: 'field-history'; the repeater and composite rows drop type: 'boolean' so the widget is what renders. Help text rewritten: no "though the switch shows off"; the field rows say what Default means per type (fixes the L2 nit on feat(audit): the activity stream shows each changed field's old → new values by default, served only for fields the reader may read #36399 that "Unset means ON" was too broad for media, JSON and credential fields).
  • Names per the seat's ruling (comment 7088708778): resolveFieldHistory (the resolved value of the authored key, as resolveDisplayField is for displayField), FIELD_HISTORY_DEFAULT_OFF_TYPES, input interfaces FieldHistoryField / FieldHistoryObject.
  • api-surface/data.json and export-origins/data.json regenerated: 4 added, 0 removed.

Writer (packages/plugins/plugin-audit/src/audit-writers.ts): changeValuesShownFor(objectDef) now returns (_key, field) => resolveFieldHistory(field, objectDef). The local NO_LINE_VALUE_TYPES set is gone. Equivalence: the old credential test was collectMaskedReadFields(objectDef).has(key), which is isMaskedOnReadFieldType(def.type, objectDef.managedBy) over objectDef.fields; every caller passes field = getObjectDef(object).fields[key] (getFieldDefs), so the two read the same definition. The full plugin-audit suite passes unchanged.

Studio (ui/packages/app-shell/src/views/metadata-admin/widgets.tsx): new registered widget field-history, labelling control (the host label names the Select trigger). Three options: Default (On|Off), On, Off. Default calls onChange(undefined), which removes the key. A field row (one carrying type) resolves Default through resolveFieldHistory({ type, trackHistory }, undefined); the enable block resolves to on. A non-boolean stored value draws as Default, as the writer reads it. New i18n keys engine.form.fieldHistoryDefault / fieldHistoryOn / fieldHistoryOff in the studio namespace (en, zh).

Translations: the three help texts in all 11 *.metadata-forms.generated.ts bundles, hand-translated (extract does not overwrite a present leaf).

Tests

  • packages/spec/src/data/field-history-default.test.ts (new, 12): each arm of the predicate, every no-line type, the better-auth password exemption, literal-boolean reads.
  • ui/.../FieldHistoryWidget-36482.test.tsx (new, 10): the three published rows name the widget; Default (On) / Default (Off) per type and with trackHistory: true; stored true / false draw On / Off; choosing Default after Off calls onChange(undefined); On / Off write true / false; read-only disables it. Ablation: with the resolver replaced by true, "names Default (Off) for a media, JSON or credential type" fails; with Default writing false, "a stored false goes back to unset" fails.
  • Registry tables extended with a field-history row, as each one requires for a new key: SchemaForm.widgetLabelling.test.tsx, SchemaForm.controlWidgetGridNaming-9889.test.tsx, __tests__/SchemaForm.controlWidgetFailureArmNaming-9931.test.tsx (164/164).
  • Local runs: plugin-audit 109 files / 1815 tests; spec src/data 190 files / 6778 tests; platform-objects translations 26 files / 610 tests. Derived gates are in the seat's gates file; CI runs the full farm.

Acceptance notes

  • The field rows cannot see the object's own enable.fieldHistory (a field form, a repeater row has only the field), so Default names the field's own resolution; the help text says the object's off wins.
  • Accepted deviation (contract review 7088768550, N3): the widget passes no object to resolveFieldHistory, so two cases differ from the writer: an object with enable.fieldHistory: false (disclosed in the help text), and a password field on a managedBy: 'better-auth' object (label Default (Off), writer on). No better-auth object declares a password-typed field today, so the second is unreachable; passing the object needs row-to-document plumbing in RecordField, not owed by this card.
  • Contract review N1 and N2 fixed in 5df919cb: module header wording; the field rows' help text now says a credential field never shows values (11 locales).
  • Contract review N4 (delta 7088846404) fixed in e285ca09: the widget docblock and the changeset no longer read as if Track History could turn a credential field on; a credential field's Default is Off always. Wording only, no code change.
  • Accepted deviation (contract review 7089359334, N5): one rewrapped comment line in the FieldHistoryWidget docblock is 121 characters. Comment formatting only; ESLint is green on e285ca09. Left for a later touch of the file rather than moving the head.
  • Out of scope, carried by 字段修改历史:动态里的修改显示「旧值 → 新值」;字段和格子上可以看这一个字段的历次修改(数据后端已有) #36290's remaining PRs: the Studio field designer and object field inspector (FieldDesigner.tsx, ObjectFieldInspector.tsx) and an enable.fieldHistory control in ObjectSettingsPanel. They do not render these spec form rows.
  • ADR-0052 §5b.1 amendment for the reversed default is already carried by ADR revisions, week of 2026-11-21: rolling checklist of ADR text out of step with main (one governed PR) #36086 (from feat(audit): the activity stream shows each changed field's old → new values by default, served only for fields the reader may read #36399); this PR adds no ADR sentence.

Generated by Claude Code

…nd Default says what it resolves to

The fieldHistory rows on the field form, the object form's field list and
the object's capabilities were a plain switch: unset drew as off, and a
switch turned off could not go back to unset. They now name the new
`field-history` widget, a three-way choice whose Default removes the key
and names what it resolves to for the row.

The resolution is `fieldChangeValuesShown` in @objectstack/spec/data,
beside the no-line type list that used to be private to the audit
writer; plugin-audit now asks the same predicate, so the form's default
and the writer cannot drift. Help text updated in every locale.

Claude-Session: https://claude.ai/code/session_01ADHkmPedgY4mKE12ad7oAo
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m 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 23, 2026
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/platform-objects, @objectstack/plugin-audit, @objectstack/spec, touching 22 documentable anchor(s). ⚠️ 3 changed file(s) yielded no anchor (packages/spec/api-surface/data.json, packages/spec/export-origins/data.json, packages/spec/src/data/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

20 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 79d9c1435586d9b411b51a0ac395ea0c23dc3ddc.

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

What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/api-surface/data.json, packages/spec/export-origins/data.json, packages/spec/src/data/index.ts) — pages documenting those are invisible to this run
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 68 of 251 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 — 178 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 79d9c1435586d9b411b51a0ac395ea0c23dc3ddc → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 79d9c1435586d9b411b51a0ac395ea0c23dc3ddc

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

… protocol does not move

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

objectstack-fleet Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmRY38EZf38Yy3zthbY

Seat ruling on the new public names in this PR (card #36482). Read at main today and the PR's diff at a0607f1e.

  1. Widget field-history: accepted. Precedent: the spec forms' kebab-case widget ids named after what they edit (related-list-entries, key-only-record, filter-condition).
  2. fieldChangeValuesShown(field, object) → rename to resolveFieldHistory(field, object). It answers what the authored fieldHistory key resolves to once the type default applies. Precedent: resolveDisplayField in the same @objectstack/spec/data entry (the effective value of a declared key with its default). Carrying the key's own name lets an author or an AI find the rule from the key.
  3. NO_LINE_VALUE_FIELD_TYPES → rename to FIELD_HISTORY_DEFAULT_OFF_TYPES. It is the set of types whose fieldHistory defaults to off. The private name it had in plugin-audit (NO_LINE_VALUE_TYPES) described the audit writer's line, not the key; once public on @objectstack/spec/data, the name follows the key.

Rename in the export-origins and api-surface baselines, the changeset and the PR body in the same push. L2 still reviews semantics; this ruling covers names only.

Addendum (head cdad0018): the parameter interfaces FieldHistoryField and FieldHistoryObject that follow the rename are accepted (named after the key, like the function).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmT4eA4YqtxfiPyLPih

Contract-review-claim: session_01ADHkmT4eA4YqtxfiPyLPih · head a0607f1 · 2026-11-23T00:52Z

…ldHistory, FIELD_HISTORY_DEFAULT_OFF_TYPES

Seat naming ruling on the new public names: the predicate is the
resolved value of the authored `fieldHistory` key (as resolveDisplayField
is for displayField), and the type set is the types whose fieldHistory
defaults to off. The two input interfaces follow: FieldHistoryField,
FieldHistoryObject. Baselines regenerated.

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

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmT4eA4YqtxfiPyLPih

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: a0607f1e7701adc7467cc7f2446d769cc6824183
Local-runs: none
Scope: packages/spec/src/data/field-history-default.ts, packages/spec/src/data/field.form.ts, packages/spec/src/data/index.ts, packages/spec/src/data/object.form.ts + packages/plugins/plugin-audit/src/audit-writers.ts, ui/packages/app-shell/src/views/metadata-admin/widgets.tsx

Read for this record: card #36482 (body, 3 comments), PR #36580 (body, 3 comments, net diff against merge-base 06c3e5ac), the check-runs on the head, and the cited code in the tree at the head (masked-field-types.ts, objectql/src/secret-fields.ts, SchemaForm.tsx, field.zod.ts, object.zod.ts). The rest of the diff (four test files, the two generated spec baselines, eleven translation bundles, two i18n namespaces) is the lane seat's ACCEPT.

① Derived judgments

  • Public surface, @objectstack/spec/data: four additions, zero removals (fieldChangeValuesShown, NO_LINE_VALUE_FIELD_TYPES, FieldChangeValuesField, FieldChangeValuesObject), all from the new field-history-default.ts through one export * line in index.ts. api-surface/data.json and export-origins/data.json carry exactly those four. A widening: right. The NAMES are not right on this head, see M1.
  • Frontend-safety of the subpath: the new module imports one erased type from field.zod and the runtime predicate from masked-field-types.ts, which itself imports types only. No schema walker, no node builtin. Right.
  • Accept-set of authored metadata: unchanged. fieldHistory on a field and on enable are still z.boolean().optional(); the diff touches no .zod.ts. Metadata-protocol: none is right.
  • Form surface: three rows (field.form.ts field row, object.form.ts fields record row, object.form.ts enable composite row) name widget: 'field-history'; the two object.form.ts rows drop type: 'boolean'. An explicit fieldSpec.widget wins in resolveFieldWidget, so the widget renders on all three faces. Right. A third-party renderer of these published forms that does not register field-history loses the boolean hint on the two object-form rows; the schema node is still boolean, so it degrades to its type inference. Acceptable.
  • Writer behaviour (changeValuesShownFor): unchanged, verified arm by arm in ④. Right.
  • Generated text: the en bundle's three help texts are byte-equal to the source rows in field.form.ts and object.form.ts; de and zh-CN were read and say the same three things. No disagreement found.
  • Check-runs on the head at read time (2026-11-23, two polls): concluded and green are Check Changeset, Governed Surface Queue Guard, Spec property liveness, PR-body guards, Check PR Size, Lint and Repo Gates and every Lint shard, Type Check source gates and debt ledger, Dogfood Regression Gate, Build UI Deps. Still in progress with no conclusion: Test Core 1 to 10, Test UI 1 to 16, Build Core, Build and E2E UI, Live E2E UI, Type Check UI, Lint UI, Type Check workspace, Type Check consumer gates. No run concluded red. The test and type-check verdicts are therefore NOT in hand for this record; the delta round reads them on the new head.

② Semver level

Clause-②: yes (widening)

.changeset/36482-field-history-three-way.md takes patch on @objectstack/spec, @objectstack/plugin-audit, @objectstack/platform-objects, @object-ui/app-shell, @object-ui/i18n: the five packages the diff moves, no more and no fewer. Under AGENTS.md (changeset rule: the level follows the Metadata-protocol kind alone, none takes patch, a non-protocol widening ships patch) that is the right level, and Check Changeset concluded success on the head. Both declarations are line-initial in the PR body and the changeset body and agree. The changeset body names the two exports M1 renames, so it moves with that fix.

③ Boundary flags

  • open_questions 1 (new public names, seat's call): ANSWERED by the seat ruling on the PR, comment 7088708778 (posted 00:53Z, after this head): widget field-history accepted; fieldChangeValuesShown renamed to resolveFieldHistory; NO_LINE_VALUE_FIELD_TYPES renamed to FIELD_HISTORY_DEFAULT_OFF_TYPES; baselines, changeset and PR body in the same push. The head carries the old names: M1.
  • Escalated to the seat: the ruling is silent on the two interfaces FieldChangeValuesField and FieldChangeValuesObject. They are public too and named after the function being renamed; the dev should not guess. Name them in the same ruling before the rename push.
  • open_questions 2 (contract review owed): this record.
  • Dev deviation 1 (changeset minor to patch): correct, see ②.
  • Dev deviation 2 (shared predicate in spec instead of a UI copy of the type list): the claim comment allowed it ("only if the dev's route shares the no-line type list"), the precedent cited (isMaskedOnReadFieldType, same directory, same two-consumer reason) is real, and it removes the drift the card's Notes describe. Accepted.
  • out_of_scope_findings (Studio FieldDesigner, ObjectFieldInspector, ObjectSettingsPanel have no fieldHistory control; carrier 字段修改历史:动态里的修改显示「旧值 → 新值」;字段和格子上可以看这一个字段的历次修改(数据后端已有) #36290): confirmed by grep at the head, none of the three writes or renders fieldHistory. Stays with 字段修改历史:动态里的修改显示「旧值 → 新值」;字段和格子上可以看这一个字段的历次修改(数据后端已有) #36290.
  • SQL push-down: no query, no id materialisation, no in-app join in the diff. The writer drops a per-write new Set(collectMaskedReadFields(objectDef)) for a per-field table lookup. Nothing to flag.

④ Design judgment

M1 (must-fix) — The head publishes fieldChangeValuesShown and NO_LINE_VALUE_FIELD_TYPES on @objectstack/spec/data; seat ruling 7088708778 renames them to resolveFieldHistory and FIELD_HISTORY_DEFAULT_OFF_TYPES. A public spec export cannot be renamed after release without a breaking changeset, so the rename lands before merge: field-history-default.ts (and its internal set name and jsdoc links), the audit-writers.ts import, call and docblock, the widgets.tsx import, call and docblock, the comment in field.form.ts that names the function, the index.ts comment if it names either, both generated baselines, both test files, the changeset body and the PR body. Rename the two interfaces as the seat rules (see ③). No semantic change is asked for.

N1 (nit) — field-history-default.ts module header: "Two classes never show them, whatever the flags say on the field's default: a credential field ... never, and a type in the list only when the field opts in" contradicts itself (the second class does show, with a flag). Say it as the function does: a credential field never; a listed type only with fieldHistory: true or trackHistory: true. The head moves for M1 anyway, so this can ride.

N2 (nit) — Field-row help text (field.form.ts, object.form.ts fields row): "On also shows a media or JSON field's values" is true, and correctly leaves credentials out, but nowhere says that On does nothing on a credential field. The control offers On on a secret or password row and the writer then keeps values off (isMaskedOnReadFieldType is tested before the true arm). field.zod.ts says it ("a credential field never shows values"); the help text should carry the same clause. Related: "media, JSON" stands for fourteen types that include signature, code, address, location, vector, composite, repeater, record. The wording matches the schema's own describe on main and the option label itself is exact per type, so the summary is tolerable.

N3 (nit) — The widget always passes undefined for the object. Two cases then differ from the writer. (i) Object writes enable.fieldHistory: false: label says Default (On), writer says off; disclosed by "The object's own Field History off wins". (ii) A password field on a managedBy: 'better-auth' object: label says Default (Off), writer says on (the read-mask exemption); not disclosed. No better-auth object declares a password-typed field today (secret-fields.ts says so), so no author can meet it now. On the object form the object is in the same document, but RecordField hands each row only the row as formData, so the widget cannot see it without new plumbing; not owed by this card. Accepted deviation, or a follow-up if (ii) ever becomes reachable.

Checked and holding (the seat's a to f):

(a) Writer equivalence. Old arms in order: object enable.fieldHistory === false; no field; field fieldHistory === false; credentials.has(key); fieldHistory === true or trackHistory === true; type in the set. New arms: the same six in the same order. The only rewritten arm is the credential one. Old: key in collectMaskedReadFields(objectDef), which is def && isMaskedOnReadFieldType(def.type, objectDef.managedBy) over the own entries of objectDef.fields. New: isMaskedOnReadFieldType(field.type, object?.managedBy) on the field the caller passes. Both callers (planTrackedLookupReads, renderTrackedChangeSummary) pass fields[key] from getFieldDefs(ctx.object), which is getObjectDef(ctx.object).fields; the object handed to changeValuesShownFor is getObjectDef(ctx.object) again. Same definition, same managedBy, same predicate. No field's verdict moves: maskingRule, requiredPermissions, internal and ackPlaintextMasking were read by neither version (per-reader redaction is elsewhere, as the docblock says); a def without type is unmasked and on in both; a non-object def is on in both; a key that resolves only through the prototype has no type and is unmasked in both; an extension-added field is in fields for both. One difference in principle only: the old credential test read the schema fetched at line 2695 and the new one the map fetched at line 2657, with awaits between; the flag arms already read the earlier map in the old code, so this is not a behaviour change worth a finding. The type list is the same fourteen strings in the same order. The old typeof field.type === 'string' guard is subsumed by Set.has.

(b) Default label. Field rows: fieldChangeValuesShown({ type, trackHistory }, undefined) with fieldHistory left out, which is what the function's own doc prescribes for "what does unset resolve to"; trackHistory: true on a listed type gives Default (On), as the writer. A row with no type yet gives On; the spec test pins {} to true. The enable row: its formData is the enable object (CompositeField passes obj), which has no type, so it resolves to On; the writer turns values off only on a literal false there, so "Default is on" is right. Object-level On and Default behave the same at the writer; the text does not claim otherwise.

(c) Default removes the key. Field form: setField deletes the key on undefined. fields record row and enable composite: the patch spreads fieldHistory: undefined into the row or block, the form's documented clear convention (SchemaForm.tsx, the comment above offerUnset: "a repeater row keeps an undefined that serialisation drops"), already relied on by the optional enum selects. On and Off write literal true and false. A stored non-boolean draws as Default, matching the writer's literal-only reads. No UI surface at the head writes fieldHistory on save (grep over ui/packages); the "written on every save" sentence in the writer docblock is about the field's trackHistory: false, and ObjectFieldInspector now writes trackHistory: v || undefined. Limit of this check: the wire serialisation past SchemaForm was not traced; the widget test pins onChange(undefined) only at the widget.

(d) Help text. No false sentence found; the gaps are N2 and N3. The trackHistory help text is untouched and still true against the predicate (false does not hide; true opts a listed type in).

(e) Exports. readonly FieldType[], frozen, satisfies checks membership at compile time and the test checks it against FieldType.options at run time. The function is total over stored metadata (literal-only reads, null object, null field), matching its doc. Names: M1.

(f) Performance: nothing added on the write path.

Implemented-by: claude/project-thread-91elwa
Reviewed-by: session_01ADHkmT4eA4YqtxfiPyLPih

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmT4eA4YqtxfiPyLPih

Contract-review-claim: session_01ADHkmT4eA4YqtxfiPyLPih · head cdad001 · 2026-11-23T00:58Z

…dential field never shows values

Contract review nits N1 and N2: the module header no longer calls the
default-off types a class that never shows values, and the field rows'
help text (with its 11 translations) says On does nothing on a
credential field.

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

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmT4eA4YqtxfiPyLPih

Contract-review-claim: session_01ADHkmT4eA4YqtxfiPyLPih · head 5df919c · 2026-11-23T01:00Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmT4eA4YqtxfiPyLPih

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 5df919cb573626c86f200b33648c130a0284c8d3
Local-runs: none
Scope: packages/spec/src/data/field-history-default.ts, packages/spec/src/data/field.form.ts, packages/spec/src/data/index.ts, packages/spec/src/data/object.form.ts + packages/plugins/plugin-audit/src/audit-writers.ts, ui/packages/app-shell/src/views/metadata-admin/widgets.tsx

Delta round 1 on the at-tier record 7088768550 (head a0607f1e, FAIL, M1 open). Read for this record: card #36482 (body, 3 comments), PR #36580 (body, 6 comments, 27-file list), the rework a0607f1e..5df919cb whole and per commit (cdad0018, 5df919cb), the four hits files and the two implementing files at the head, masked-field-types.ts and the fieldHistory describe in field.zod.ts at the head, and the check-runs on the head (two polls). The rest of the diff (four test files, two generated spec baselines, eleven translation bundles, two i18n namespaces, the changeset prose) is the lane seat's ACCEPT.

① Derived judgments

  • Public surface, @objectstack/spec/data: still four additions, zero removals against the merge-base 06c3e5ac, now named resolveFieldHistory (function), FIELD_HISTORY_DEFAULT_OFF_TYPES (const), FieldHistoryField and FieldHistoryObject (interfaces). api-surface/data.json and export-origins/data.json carry exactly those four and none of the old four. A widening: right. The names are the ruled ones (see ③).
  • The rework moves no behaviour. Commit cdad0018 (8 files, 50 lines each way) is identifier substitution only: in field-history-default.ts the five arms of the function, their order, the fourteen-type list and its order are untouched; audit-writers.ts changes the import, one docblock word and the callee name; widgets.tsx changes the import, one docblock word and the callee name, with the same arguments ({ type, trackHistory }, undefined) and the same typeof row.type === 'string' guard; the spec test file changes identifiers only, every expected value is as before. Commit 5df919cb (14 files) touches one comment paragraph in field-history-default.ts, the help-text string of two form rows, and two lines in each of eleven generated bundles. No arm, type list, widget prop, widget id, schema or test expectation moves in either commit.
  • Accept-set of authored metadata: unchanged, no .zod.ts in the rework. Metadata-protocol: none stays right.
  • Generated text: the en bundle holds the new field-row sentence byte-equal to the source at both places (lines 281 and 914) and the untouched enable text byte-equal at line 308. Each of the other ten bundles carries the new clause in both field-row entries; read in de, zh-CN, zh-Hant, ja-JP, ko, fr, es-ES, pt-BR, ru, ar, each says a credential field never shows values and keeps the object-off clause.
  • Main was not merged in this hop: both rework commits have one parent, the merge-base is still 06c3e5ac; origin/main has moved on to 934ac077.
  • Check-runs on the head (read twice, about 01:01Z to 01:02Z, minutes after the push). Concluded success: Governed Surface Queue Guard, Check PR Size, Spec property liveness, PR-body guards, Dogfood Regression Gate, Auto Label, filter. In progress, no conclusion: both Check Changeset runs, every Lint shard, Type Check source gates, debt ledger, workspace and consumer gates, Build Core, Build UI Deps, Live E2E UI, Plan Test Core shards, Plan Test UI shards, Flag docs affected. The Test Core and Test UI shards had not been created yet. One PR-body guards run is cancelled, superseded by the later run that concluded success. No run concluded red. The test and type-check verdicts are therefore still NOT in hand on this head either; this record judges the contract as read, and the merge stays behind those gates.

② Semver level

Clause-②: yes (widening)

.changeset/36482-field-history-three-way.md takes patch on the same five packages (@objectstack/spec, @objectstack/plugin-audit, @objectstack/platform-objects, @object-ui/app-shell, @object-ui/i18n); the rework touches no sixth package. Its frontmatter is unchanged since the head on which Check Changeset concluded success; on this head the run is still in progress. The body now names resolveFieldHistory and FIELD_HISTORY_DEFAULT_OFF_TYPES. The PR body and the changeset both carry Clause-②: yes (widening) and Metadata-protocol: none, line-initial, in agreement. patch for a non-protocol widening is the right level.

③ Boundary flags

  • open_questions 1 (new public names): answered in full. Seat ruling 7088708778 rules the widget id, the function and the const; its addendum (head cdad0018) accepts FieldHistoryField and FieldHistoryObject, "named after the key, like the function". The escalation of the previous record is thereby closed; no name on the head lacks a ruling.
  • open_questions 2 (contract review owed): this record, on this head.
  • Dev deviations 1 and 2 and the out_of_scope_findings entry (carrier 字段修改历史:动态里的修改显示「旧值 → 新值」;字段和格子上可以看这一个字段的历次修改(数据后端已有) #36290): judged in 7088768550, nothing in the rework reopens them.
  • New in the lane's account: N3 recorded as an accepted deviation in the PR body's Acceptance notes. Read there; the note states both differing cases and why the second is unreachable today. Accepted as written.
  • SQL push-down: the rework adds no query, no id materialisation, no in-app join.

④ Design judgment

No must-fix, no should-fix.

M1: closed — git grep over the whole tree at the head finds none of fieldChangeValuesShown, NO_LINE_VALUE_FIELD_TYPES, NO_LINE_VALUE_FIELD_TYPE_SET, FieldChangeValuesField, FieldChangeValuesObject, nor the old private NO_LINE_VALUE_TYPES. The rename covers the module (export, internal set, jsdoc links), the writer's import, call and docblock, the widget's import, call and docblock, the field.form.ts comment, both baselines, the spec test file, the changeset body and the PR body (which names the old private set once, correctly, as the thing removed). index.ts named neither. The interfaces carry the ruled names.

N1: closed — the module header now reads as the function does: a credential field never shows values whatever its flags say; a type in the list shows them only with fieldHistory: true or trackHistory: true. Checked against the arms: the mask test precedes the two true tests, and the list is consulted last.

N2: closed — both field rows (field.form.ts, the fields row of object.form.ts) now end "A credential field never shows values, and the object's own Field History off wins." True against the code: isMaskedOnReadFieldType returns before the true arm, so On does nothing on a secret or a generic password. It is the same sentence as the fieldHistory describe in field.zod.ts. Its one inexact case is a password on a managedBy: 'better-auth' object, which the mask exempts and which therefore does show; that is N3 case (ii), unreachable today. The second half of the previous note (media, JSON standing for fourteen types) is unchanged and was already judged tolerable.

N3: accepted — the widget still passes undefined for the object; the PR body's Acceptance notes record both differing cases as an accepted deviation, with the plumbing reason. No code change, as asked.

N4 (nit) — widgets.tsx, FieldHistoryWidget docblock: "off for a media, JSON or credential type unless trackHistory: true" reads as if trackHistory: true also opts a credential in. It does not: resolveFieldHistory({ type: 'secret', trackHistory: true }, undefined) is false, and the widget draws Default (Off), which is right. The comment is loose, the code is correct. The changeset body carries the same phrasing ("a media, JSON or credential field unless the field opts in with Track History"). Present on the previous head and not raised then. A fix in widgets.tsx would move the head, so leave it as an accepted deviation or fold it into a later touch of the file; the changeset sentence can be tightened on the prose face.

Tried against the rework and holding: no stale mention of the old names in comments that the grep would miss by spelling (the writer docblock and the index.ts comment say "no-line type list", a description, not an identifier); the enable row's help text is untouched and still true; trackHistory's help text is untouched and still true; the new help sentence does not contradict "On also shows a media or JSON field's values", which leaves credentials out.

Implemented-by: claude/project-thread-91elwa
Reviewed-by: session_01ADHkmT4eA4YqtxfiPyLPih

VERDICT: PASS

…d is always off

The widget docblock and the changeset read as if Track History could turn a
credential field's values on. It cannot: the predicate answers off for a
masked type whatever the field's flags say.

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

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmT4eA4YqtxfiPyLPih

Contract-review-claim: session_01ADHkmT4eA4YqtxfiPyLPih · head e285ca0 · 2026-11-23T01:40Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

l2-review#4 · os-steve · session_01ADHkmT4eA4YqtxfiPyLPih

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: e285ca09502985b49cddd2bb50a0387a5c4549f1
Local-runs: probe — one awk length count over a single line of git show output (the docblock line N5 names), to state its width; nothing built, run or tested
Scope: packages/spec/src/data/field-history-default.ts, packages/spec/src/data/field.form.ts, packages/spec/src/data/index.ts, packages/spec/src/data/object.form.ts + packages/plugins/plugin-audit/src/audit-writers.ts, ui/packages/app-shell/src/views/metadata-admin/widgets.tsx

Delta round 2 on the at-tier record 7088846404 (head 5df919cb, PASS, N4 open as a nit). Read for this record: card #36482 (body, 3 comments), PR #36580 (body, 8 comments, 27-file net diff stat against merge-base 06c3e5ac), the rework 5df919cb..e285ca09 whole, field-history-default.ts, masked-field-types.ts, the FieldHistoryWidget block of widgets.tsx, changeValuesShownFor in audit-writers.ts and the changeset at the head, and the check-runs on the head (two polls). The rest of the diff (four test files, two generated spec baselines, eleven translation bundles, two i18n namespaces, the changeset prose) is the lane seat's ACCEPT.

① Derived judgments

  • The rework is one commit, e285ca09, single parent 5df919cb: 2 files, 4 lines added, 4 removed. .changeset/36482-field-history-three-way.md: one body sentence, frontmatter untouched. widgets.tsx: three lines, all inside the FieldHistoryWidget docblock (each begins *). No code token moved: the import, the typeof row.type === 'string' guard, the call resolveFieldHistory({ type: row.type, trackHistory: row.trackHistory }, undefined), the three options and the WIDGETS entry are as on 5df919cb. Right: comments and changeset prose only.
  • None of the four hits files and not audit-writers.ts is in the rework. Public surface (resolveFieldHistory, FIELD_HISTORY_DEFAULT_OFF_TYPES, FieldHistoryField, FieldHistoryObject: four added, zero removed), accept-set (no .zod.ts), form rows, writer behaviour and generated text all stand as judged in 7088846404.
  • Main was not merged in this hop: the merge-base of the head with origin/main is still 06c3e5ac, the same as for 5df919cb; origin/main is at 79d9c143.
  • Check-runs on the head (40 runs, read twice a few minutes after the 01:39Z push, same state both times). Concluded success: Governed Surface Queue Guard, Spec property liveness, Check PR Size, PR-body guards (both runs), Check Changeset (run 45095760233), Flag docs affected by code changes, Dogfood Regression Gate, Auto Label, filter. In progress, no conclusion: the second Check Changeset run (45095820134), every Lint shard including ESLint, Type Check workspace, source gates, consumer gates and debt ledger, Build Core, Build UI Deps, Live E2E UI, Plan Test Core shards, Plan Test UI shards. The Test Core and Test UI shards are not created yet. The remaining runs are skipped (opt-in or matrix placeholders). No run concluded red. The test, lint and type-check verdicts are therefore NOT in hand on this head; the merge stays behind those gates. The PR is a draft.

② Semver level

Clause-②: yes (widening)

Stands. The changeset frontmatter (patch on @objectstack/spec, @objectstack/plugin-audit, @objectstack/platform-objects, @object-ui/app-shell, @object-ui/i18n) is unchanged; only one body sentence moved. Clause-②: yes (widening) and Metadata-protocol: none are line-initial in both the PR body and the changeset and agree. One Check Changeset run concluded success on this head; the other is pending.

③ Boundary flags

④ Design judgment

No must-fix, no should-fix.

N4: closed — both sentences are rewritten and both are true at the head.

  • widgets.tsx docblock now reads "off for a media or JSON type unless trackHistory: true, and off for a credential type whatever its flags say". Against resolveFieldHistory as the widget calls it (fieldHistory left out, object undefined): a listed type reaches the last arm and is off, unless trackHistory === true returns on one arm earlier; a secret or password returns off at the isMaskedOnReadFieldType(field.type, undefined) arm, which sits before the true arm, so no flag reaches it. isMaskedOnReadFieldType with managedBy undefined masks both types (exemptions fail closed; only 'better-auth' exempts password). The sentence describes the label, and for the label it holds without exception because the widget never passes an object.
  • Changeset: '"Default (Off)" for a media or JSON field unless the field opts in with Track History, and for a credential field always.' Same reading, same result: true of what the form shows.
  • The better-auth exemption: on a managedBy: 'better-auth' object the writer keeps a password field's values on while the label says Default (Off). That is N3 case (ii), accepted and recorded in the PR body, unreachable today; the new wording neither widens nor hides it, since both sentences speak of the Default label. "media or JSON" still stands for the fourteen listed types, judged tolerable in 7088768550.

N3: accepted — unchanged; the PR body's Acceptance notes still carry it.

N5 (nit) — widgets.tsx, the same docblock: the rewrap left one comment line 121 characters long ("say. The object's enable block resolves to on. The row cannot see the object's own enable.fieldHistory (a field"), where its neighbours wrap near 80. Formatting of a comment only, no effect on correctness or the contract; Lint · ESLint is still pending on this head and is the gate that would say otherwise. A fix moves the head, so leave it as an accepted deviation or fold it into a later touch of the file.

Per face, the rest of 7088846404:

  • packages/spec/src/data/field-history-default.ts: stands, not in the rework; the header and the five arms read again at the head and agree with each other.
  • packages/spec/src/data/field.form.ts: stands, not in the rework.
  • packages/spec/src/data/index.ts: stands, not in the rework.
  • packages/spec/src/data/object.form.ts: stands, not in the rework.
  • packages/plugins/plugin-audit/src/audit-writers.ts: stands, not in the rework; changeValuesShownFor is still (_key, field) => resolveFieldHistory(field, objectDef).
  • ui/packages/app-shell/src/views/metadata-admin/widgets.tsx: stands for the code; the docblock is the N4 fix, plus N5.

Implemented-by: claude/project-thread-91elwa
Reviewed-by: session_01ADHkmT4eA4YqtxfiPyLPih

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmPedgY4mKE12ad7oAo
Thread session: session_01ADHkmPedgY4mKE12ad7oAo

席位核对

ACCEPT — PR #36580 at head e285ca09502985b49cddd2bb50a0387a5c4549f1, read 2026-11-23T02:17Z. L2: delta-2 record 7089359334 PASS on this same head (at-tier 7088768550 → 7088846404 → 7089359334).

Checklist conclusions

  • Shape (l1-face.mjs --pr 36580, all ok): open draft on main; first line Fixes #36482; no closing keyword binds another card; no content/docs/releases/ path; one non-empty changeset; no +0/-0 file; Clause-②: yes (widening) and Metadata-protocol: none line-initial in body and changeset; Skills-docs: not owed (kind none); dogfood not owed.
  • Fixes is right: the card asks for Default (showing what it resolves to), On, Off, and Default removing the key. All three published rows (field form, the object form's fields repeater, the enable composite) render the three-way widget; nothing of the card is left for a follow-up.
  • Scope: 27 files, +416 / −64 (480 lines, generated included). Not governed (check-governed-merges.mjs --pr 36580: 0 of 27 paths hit the register). Every file sits in the claim's file surface: the spec predicate and forms, the audit writer, the widget and its tests, i18n keys, the 11 generated translation bundles, the two spec baselines, the changeset.
  • Changeset: every published package touched carries an entry (spec, plugin-audit, platform-objects, @object-ui/i18n); @object-ui/app-shell is private: true and is listed too. All entries patch, consistent with Metadata-protocol: none.
  • Gates on this head (check-runs, not the report): 61 success · 12 expected skip · 0 unexpected skip · 0 failed · 0 pending. Lint & Repo Gates success, TypeScript Type Check success. Local derived set (dispatch-gates --commands): 102 derived, 101 run green, 1 NOT MEASURED locally (check:dual-build-cjs-loads, needs a full build) — covered by CI on this head.

Changeset sentences checked against the diff

  • "The Field History setting on the field form, on each row of the object form's field list, and in the object's capabilities is now a three-way choice instead of a switch." — true: field.form.ts row and both object.form.ts rows name widget: 'field-history'; the two object.form.ts rows drop type: 'boolean'.
  • "Default leaves the setting unset … 'Default (On)' for most field types, 'Default (Off)' for a media or JSON field unless the field opts in with Track History, and for a credential field always." — true of the label: the widget calls resolveFieldHistory({ type, trackHistory }, undefined); listed types fall to the last arm unless trackHistory === true; secret/password return off at the masked arm before the opt-in arm.
  • "On and Off write true and false as before. A setting turned off can now be returned to Default, which removes the key." — true: onChange(next === 'on' ? true : next === 'off' ? false : undefined); the top-level setField deletes a key set to undefined; the repeater (update spreads the patch, SchemaForm.tsx:2858) and composite ({ ...obj, [spec.field]: v }, :2761) rows keep it as an undefined property, which the JSON body written on save omits. The widget test pins onChange(undefined); no test reads the saved nested row.
  • "@objectstack/spec/data exports resolveFieldHistory(field, object) and FIELD_HISTORY_DEFAULT_OFF_TYPES" — true: export * from field-history-default in data/index.ts; api-surface/data.json and export-origins/data.json add exactly the four names (two functions/consts, two interfaces).
  • "The activity writer … now asks this predicate instead of its own copy of the type list … Behaviour of the writer is unchanged." — true: changeValuesShownFor returns (_key, field) => resolveFieldHistory(field, objectDef), local NO_LINE_VALUE_TYPES deleted; the 14 types moved verbatim; full plugin-audit suite (1815) green unchanged.

Spot-check readings

  • Ablation (both red, then restored): resolver replaced by true ⇒ "names Default (Off) for a media, JSON or credential type" fails; Default writing false ⇒ "a stored false goes back to unset" fails. The predicate tests pin every listed type off, the credential arm over fieldHistory: true, the better-auth exemption and literal-boolean reads.
  • Build order: plugin-audit and UI suites ran after turbo build --filter=@objectstack/plugin-audit^... and an @objectstack/client build, so neither read a stale dist.
  • No API read in the evidence that git could have answered.

Accepted deviations

  • N3 (contract review 7088768550): the widget passes no object to the predicate, so the label cannot see the object's enable.fieldHistory: false (stated in the help text) nor the better-auth password exemption (unreachable today: no better-auth object declares a password-typed field). Recorded in the PR body.
  • N5 (7089359334): one rewrapped comment line in the FieldHistoryWidget docblock is 121 characters. Comment formatting only; ESLint is success on this head. Left for a later touch of the file rather than moving the head.
  • N4 is fixed at this head (e285ca09), not a deviation.

Out of scope: none filed; no adjacent fix in the diff. The writer's carrier card #36290 is untouched by this PR.

Landing: this PR carries a spec contract face (L2 hit), so it goes to the seat to land or hand off; this thread does not land it. pm:dispatched comes off with the Fixes close.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmRY38EZf38Yy3zthbY

维护者速读

  • 改了什么:Studio 字段「修改历史」开关改成三态(默认 / 开 / 关),「默认」写明它实际是开还是关。
  • 风险:非受管面,480 行;spec 只加导出(widening),不收窄。
  • 要你做什么:无,席位落地。

ACCEPT → PR #36580 comment 7089819969 · Contract review PASS → comment 7089359334 · Head-sha e285ca09502985b49cddd2bb50a0387a5c4549f1 · check-runs 61 success, 12 skipped, 0 failed. Accepted deviations N3, N5 are in the PR body.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 23, 2026 02:19
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 7501d0c Nov 23, 2026
78 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-91elwa branch November 23, 2026 02:49
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
…ar, live at once (objectstack-ai#36597)

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

This is the first of three PRs for the card. It covers the object page.
Still to come:

- PR 2: flows, the enable switch, permissions, and the object page's
hooks and an installed app's own actions.
- PR 3: field layout, the AI-draft notice with its 「放弃 AI 的改动」 button,
and the card's closing line.

## 维护者速读

- 用户能看到什么变化:在 Studio
的对象页(字段、校验规则、动作、设置)改完后,顶栏右侧原来「发布」的位置出现「取消」「保存」。点保存后改动立刻生效,不再每隔一秒半自动存草稿。「变更」「发布」只在有待发布草稿时出现。
- 为什么做:维护者裁定,人类改一项就确认一项、点保存直接生效。本单是「保存即生效」这一系列的第一步,先做对象页。
-
出错会怎样:保存被服务器拒绝时,改动留在页面上,并写明原因;同一次保存里成功的项会被列出来。删掉或改类型已生效的字段前会先问一句。出问题可以直接撤回本单,回到原来的自动存草稿。
- 要你做什么:无。两人同时改同一对象时后保存的人可能覆盖先生效的改动,这件事已交席位按决策卡流程处理。

## What changes

**Mechanism.** A new top-bar coordinator in `studioSaveBar.tsx` does the
following:

- Editors register their buffers with `useStudioSaveEntry`.
- The surface draws Cancel and Save at the right of the top bar, where
Publish was, and only while a registered buffer is dirty. They are the
column's last actions; only the right-slot icon follows them, as it
followed Publish.
- One Save sends every dirty buffer in order. A refused buffer does not
stop the others.
- When something is refused, the toast names each refused item with its
reason, then lists the items that were saved.
- If any buffer holds an edit it cannot send yet, Save refuses before
anything is written.
- Save first waits out the editors' expression check of the last
keystroke. That is `LINT_DEBOUNCE_MS`, now in its own module
`celLintDebounce.ts` (which `CelPredicateField` imports), plus 50 ms.
Without the wait, a formula or rule guard typed and saved at once could
be sent before its check had judged it (the objectui#4306 rule).

**Save = draft + that item's publish.** `publishSavedItem` calls
`MetadataClient.publish(type, name, { packageId })`, which is `POST
/api/v1/meta/:type/:name/publish?package=` at the package the draft was
written to. It is never the package batch.

If the publish is refused:
- The draft the Save wrote is discarded, unless a draft was already
pending before the Save (a copilot's). A pending draft is kept: it now
carries the page's edits too.
- The edits stay on the page, unsaved, and the reason is shown in the
refusal strip.

**Editors moved to explicit save in this PR.** All of them are on the
object page, as one buffer with one Save:

- Fields:
  - Add, from the Records grid's plus column and from the Form toolbar.
  - Edit in the field inspector.
  - Remove.
  - Column reorder. This is now a buffer edit, not a save of its own.
- Validation rules.
- The object's own actions.
- Settings.
- Field groups.
- An installed app's object: base-field patches and added `__c` fields.
These are saved into its `.custom` pair as an `object_extension` and
published there, so they take effect at once.

**Editors not changed here** (they keep their draft autosave):

- Hooks. The hooks buffer lives in `ObjectHooksPanel` and unmounts on a
tab switch, so it has to be lifted into the pillar first.
- An installed app's own actions in the pair (`pairObjectActions`).
- List and form views, navigation, flows and permissions.

**Top bar.**
- Changes and Publish are drawn only while drafts are pending. The "No
drafts pending publish" disabled state is gone, because nothing is drawn
in its place.
- Publish refuses, with a toast, while the page holds edits Save has not
sent: its re-read would drop them.
- The surface's comment saying there is no per-item publish is
corrected.

**Confirmations.** Save asks before it sends a change that removes or
retypes a published field (`objectSaveConfirm.ts`). The field-remove
dialog at edit time stays, and its body now says the field leaves once
the change is saved and live. Studio has no delete-object affordance
(measured: none in the Data pillar or its item tools), so no dialog was
added for that.

**Leaving.** Opening another object with unsaved edits asks through
`confirmDropUnsavedWork`. The switch sends nothing. The unsaved-edit
registry the console's leave prompt reads now includes the Save bar's
dirty state.

**i18n** (`namespaces/studio`, en + zh):
- New keys:
`engine.studio.save.{save,saving,cancel,title,cancelTitle,done,refused,refusedLine,savedLine,itemSeparator,held,publishFirst,confirmIrreversible,confirmRemoveField,confirmRetypeField}`
and `engine.studio.held.lineExplicit`.
- `designer.field.removeConfirmBody` is reworded.
- Alternatives considered: `engine.studio.saveBar.*` and
`engine.studio.commit.*`. The name `save` matches the button's word.

## Tests

New files, named for this card:
- `DataPillar.saveCancel-36511.test.tsx`. Covers:
- Nothing is sent before Save. Save sends a PUT of the draft with
`?package=`, then a POST to publish with `?package=`.
  - Cancel re-reads the object with no writes.
- A refused publish discards the draft. A refusal strip appears, the
edit is kept, and Save is still offered.
  - A held picklist blocks Save.
- Removing a published field asks at Save. Declined, nothing is sent;
accepted, PUT then publish.
- `studioSaveBar.partialSave-36511.test.tsx`. Covers ordering, a partial
refusal naming the item and its reason, the saved list, a held buffer,
and Cancel.
- `StudioDesignSurface.saveBar-36511.test.tsx`. Covers:
- With no draft, the top bar has no Changes or Publish, and Cancel then
Save are the last actions.
- With a draft, the order is Changes, Publish, Cancel, Save, and Publish
waits for Save.
- `__tests__/studioSaveHarness.tsx`. A harness so a pillar mounted alone
gets the same coordinator and buttons.

**Retired, with the reason:**
- `DataPillar.savedAtDisplayLocale-10232.test.tsx` (3 tests). The "Saved
HH:MM" hint they pinned is gone: there is no autosave left to time.
- `StudioDesignSurface.draftVersionConflict-11773`, the case where two
editors each load and save once with no draft pending. A Save now
publishes, so no draft is left for the second editor's `If-None-Match:
*` to collide with. See Acceptance notes.
- `StudioDesignSurface.publishReadOnlyReason-12303`, the
objectstack#31495 "nothing pending" block (3 tests). Replaced by one
case: no Publish and no reason are drawn.
- `StudioDesignSurface.interfacePolish`, "no draft: disabled Publish
with visible reason". Replaced by: no Publish at all.

**Rewritten to the new semantics.** Each flipped pin asserts nothing
sent before Save, then the draft write and the item's publish after
Save, or that Cancel or a declined question leaves the page as it was:

- DataPillar, Save-gate suites: `celGate`, `panelGate`,
`panelHold-27629`, `heldIncomplete-11786`, `choiceWithoutOptions-11253`,
`summaryHeld-27461`, `authorRefusal-11785`, `actionRefusal-26736`,
`showMeFocus-26730`, `picklistServedOptions-10202`.
- DataPillar, other suites:
- `hiddenSystemFields-11780`, `recordsTab-34794`,
`addFieldPopover-12516`, `copilotDraftMarks-12725`.
- `destructiveChange-34931`, `draftSavedNamed-28984` (the toast is now
"Saved, live now: Task" under one sonner id), `draftUnreadable-29148`.
- `authoredBuffer-29793`, `pairActions-30088` (only its writable
control), `baseObjectExtension-28575` (its double now publishes the
pair's extension).
- `validationVerdictHold-27644` (its double's publish refuses the guard
the door refuses), `railSwitchFlush-27511` (the switch asks and sends
nothing; a saved edit leaves nothing to ask about).
- StudioDesignSurface suites: `autosaveInFlight-11204` (Data block: an
edit taken during a Save is the next Save's), `autosaveSwitch-11232`
(Data cases), `draftVersionConflict-11773` (the race over a pending
draft is refused, with reload and overwrite), `customizePublish-28562`,
`narrowHeader-12509`, `packageListErrorPosture`, `publishPosture-12517`.
- `DataPillar.internalFormRetired-36425`, added on main by objectstack-ai#36543 while
this branch was open, now presses Save before its two Add group saves.
`DataPillar.formViewLayout-30057` was deleted on main by that PR, and
its one Data-page edit went with it.
- 17 edited suites gained a module-top `import '@objectstack/lint'`, as
`check:test-source-alias` asks of an edited file that reaches the
linter.

<details><summary>Studio-design suite after the last commit</summary>

Final head `1d6c0845`, same tree as the run except the registry method
rename, which the scripts run below covered.

```
cd ui && pnpm exec vitest run --maxWorkers=2 packages/app-shell/src/views/studio-design \
  (+ CelPredicateField, ObjectFieldInspector.celGate, ResourceEditPage.celGate,
     PermissionMatrixEditor.saveSurface-12725, i18n studio-namespace, studio-namespace-lazy)
 Test Files  359 passed (359)
      Tests  2774 passed (2774)

cd ui && pnpm exec vitest run --maxWorkers=2 scripts/ (+ the three new 36511 suites)
 Test Files  175 passed | 2 skipped (177)
      Tests  5138 passed | 2 skipped (5140)
os-verify-lock: VERDICT command-exit 0
```

Before the pins were rewritten, the same studio-design run read: 33
failed files and 89 failed tests out of 2733. Those are the pins this PR
flips.

</details>

<details><summary>Type-check (both configs) and dependency
build</summary>

```
pnpm --filter @object-ui/app-shell type-check   (tsc --noEmit && tsc -p tsconfig.test.json)
os-verify-lock: VERDICT command-exit 0 · held the lock 119s
pnpm --workspace-concurrency=2 --filter '@object-ui/app-shell^...' build (after merging origin/main)
os-verify-lock: VERDICT command-exit 0 · held the lock 433s
```

</details>

<details><summary>Gates (dispatch-gates --ran)</summary>

Head `1d6c0845`. `node scripts/pm/dispatch-gates.mjs --repo
objectstack-ai/objectstack --ran FILE`:

```
Run reconciliation — 39 derived, 39 run, 0 NOT-MEASURED, 0 UNRUN.
✓ dispatch-gates --ran: 39 derived famil(ies) accounted for — 39 run, 0 NOT-MEASURED
```

```
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
node scripts/check-sdui-manifest.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/pm/check-governed-queue-guard.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm --filter @objectstack/spec run check:error-code-provenance :: exit 0
pnpm check:adr-anchors :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0
```

`node scripts/check-nul-bytes.mjs`: OK. `node
scripts/pm/overlap-check.mjs`: VERDICT clean exit 0 (against objectstack-ai#36580 and
objectstack-ai#36579, which share the studio namespace files).

</details>

## Acceptance notes

- **Concurrent editors over a published object** (seat ruling 7089589821
on objectstack-ai#36511: accepted as a transitional window; the server guard is
tracked on objectstack-ai#36601, not awaited here). The draft-version guard pins
drafts only. After a Save publishes, no draft is left, so the second
editor's next Save asserts no draft and succeeds over the first editor's
live change. The server serves no published-layer version a save could
pin. When a draft was pending at open, the race is still refused with
the conflict dialog; that case is pinned in
`draftVersionConflict-11773`. Until objectstack-ai#36601 lands, the second editor's
Save overwrites the first editor's live change.
- **AI and a human on one item.** While the page holds unsaved edits,
the refresh pulse is held, so a copilot draft written meanwhile is not
shown over them. Save is pinned to the draft read: if the copilot wrote
a draft in between, the conflict dialog offers reload or overwrite, so
neither side is lost silently. If the publish is refused, a pending
copilot draft is kept and carries the page's edits.
- **A rule guard refused by the publish.** The object publish locator
does not place a `validations.N.condition` path, so the strip reads "Not
published: the server refused this draft. Details say why." and the
rule's reason is under Details. This is the locator's existing reach,
not new here.
- **The served-verdict hold** (objectstack#27644) still holds a rule
whose stored draft the door refused, when that draft was pending at
open. A Save the publish refuses now shows the reason at once instead of
leaving a draft whose re-read holds the next edit.
- **Removing a published field** asks twice: once in the remove dialog
at edit time, and once at Save. The card names a confirmation for both
removal and type changes. Folding them into one is a product call left
to the card.
- **ADR sentences the new behaviour contradicts**, for
objectstack#36086:
  - ADR-0027 M2, "explicit, batched publish".
  - ADR-0037, "Publish remains the single commit gate".
- The surface comment "There is no per-item publish". This one is
corrected in code.
- **Not measured.**
- The single-item publish was not run against a live server in this run.
The route `POST /api/v1/meta/:type/:name/publish` (`publishMetaItem`)
and the existing caller `saveAndPublishRuntimeMetadata` are cited.
  - The full-farm CI families were not run locally (local scope rule).

## Verification

Read first:
1. `ui/packages/app-shell/src/views/studio-design/studioSaveBar.tsx`.
The coordinator's held and settle check, and `publishSavedItem`'s
discard rule.
2. `StudioDesignSurface.tsx`, the DataPillar `doSave` and `doSaveExt`
hunk. Riskiest: the refused-publish restore of `objStoredRef` and
`hasDraft`.
3. `DataPillar.saveCancel-36511.test.tsx`.

Two-minute check: `cd ui && pnpm exec vitest run
packages/app-shell/src/views/studio-design/DataPillar.saveCancel-36511.test.tsx`.
Expected: 5 passed, including the case where nothing is sent before
Save, then a PUT with `mode=draft&package=` followed by a POST to
`/publish?package=`.

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

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

<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmPsv99YG2tCHoSe8Nb -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
…ty entry, old → new (objectstack-ai#36613)

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

Part of objectstack-ai#36290

Clause-②: yes (widening) — four new `detail.*` language-pack keys in
every locale `@object-ui/i18n` ships, and new optional props on the
exported `FieldChangeItem`; nothing removed or renamed
Metadata-protocol: none

PR 2 of 4 on the card (part ②: card items 1 and 2, and the activity half
of item 5). PR 1 (objectstack-ai#36399, merged as `70194ffc`) made the activity stream
serve each changed field's old and new values, narrowed per reader. This
PR draws them on the record page. Part ① (the designer producers of
`fieldHistory`) waits for objectstack-ai#36580; part ③ (the per-field history card and
the field and grid-cell entry points) closes the card. Ruling-ref:
7076513167.

## 维护者速读

- 记录页「动态」里,每次保存现在先写改了哪些字段,下面每个字段一行「字段名:旧值 →
新值」;旧值为空写「空」,长文字截成一行,点「展开」看全文;单选显示选项名,关联记录和人员显示名字。
- 属于「记录详情页重做」专题下的字段修改历史:以前动态里只写「更新了
客户备注」,看不到改前改后的值;服务器上周已经按读取权限发送这些值,这次是把它们画出来。
-
出错时,用户会看到动态里的修改行排版不对或展开按钮失灵;不会多看到任何字段,因为没有读取权限的字段服务器本来就不发送;可以整体撤回,数据不受影响。
- 无

## What changes

**The served values reach the timeline**
(`ui/packages/plugin-detail/src/renderers/recordActivityFeed.ts`)
- New `activityFieldChangesOf(row)`: reads the field-change code
plugin-audit serves in `sys_activity.metadata` (`summary_message`, key
`fieldChanges`) and turns it into one `FieldChangeEntry` per field.
`activityRowToFeedItem` puts it on the item as `fieldChanges`. An option
side keeps the option it matched; a yes/no side keeps the boolean; the
writer's empty mark (`∅`, or an empty text) becomes an empty side. A
code it cannot read whole gives nothing, and the row draws its summary
as before.
- Nothing is filtered in the browser. The server already drops a change
of a field the reader may not read, and a reference change whose record
title the reader is not served (PR 1, `activity-field-redaction.ts`).
The timeline draws exactly the changes it is handed.

**One line per changed field** (`RecordActivityTimeline.tsx`,
`FieldChangeItem.tsx`)
- An entry with changes (an activity row's served code, an audit-log
entry, or the audit entry paired onto an activity row) draws its usual
one-line row, then one line per changed field under it: `Label: old →
new`.
- The row's own text: for an entry whose changes are its own, `Updated
Phone, Email` (its stored summary would repeat the lines). An activity
row carrying its paired audit entry keeps its own summary. The record's
creation is unchanged (one row, values beside the summary).
- Each side: an option reads as the field's option label in the reader's
language (`fieldOptionLabel`, falling back to the schema label, then the
served text); a lookup or user reads as the record name the server
served; a yes/no reads as `common.yes` / `common.no`; an empty side as
`detail.fieldChangeEmpty`.
- Each side is cut to its line (`truncate`). A side that overflows
(measured), holds a line break, or is longer than 48 characters offers
`Show all`, which wraps both sides in full, and `Show less`.
- The row's markers (`data-stream-row`, `data-stream-system-row`) sit on
the whole entry (the line plus its field lines), so a reader of the row
reads both; the 30 px line is `data-stream-line`.
- The compact one-line change text (the activity panel's peek rows, the
creation row's diff) now uses the same label, words and empty word:
`Status: New → Contacted`, where it read `Status New → Contacted` with
`—` for empty.
- `FieldChangeItem` (exported, previously unused) is the line: new
optional `label`, `oldText` / `newText`, `emptyLabel`, `expandLabel` /
`collapseLabel`; with none of them it draws as before except the arrow
is text and the empty word defaults to `(empty)`.

**Language packs** (`ui/packages/i18n/src/locales/*.ts`, 11 locales;
`useDetailTranslation.ts` defaults mirror `en`)
- `detail.fieldChangeLabel` (`{{field}}:`; fullwidth colon in zh-Hans,
zh-Hant, ja; `{{field}} :` in fr), `detail.fieldChangeEmpty` (`Empty`,
`空`), `detail.fieldChangeExpand` (`Show all`, `展开`),
`detail.fieldChangeCollapse` (`Show less`, `收起`).

## Tests

New pins, as top-level describes in the existing harness files:
- `renderers/__tests__/record-activity.test.tsx` — `record:activity —
one line per changed field, old → new (objectstack#36290)`: one field
(`Customer notes: Old words → New words`); phone and email in one save
is ONE row with two lines; empty side reads `Empty`, never `∅`; select,
lookup, user and yes/no read as option label, record names and words;
only the served changes draw (a field left out of the code has no line);
a long value truncates and toggles; the stream fold opens to each save's
own lines; CONTROL: a short value has no toggle, and a row with no code
draws its summary.
- `renderers/__tests__/recordActivityFeed.test.ts` —
`activityFieldChangesOf`: mapping of text, option, boolean and the empty
mark; the item carries the changes beside its summary; no code, another
code, an empty or unreadable code give nothing.

Forced test changes (each because the line format moved from `Label old
→ new` on one element to `Label: old → new` drawn over several
elements):
- `__tests__/recordTimelineStream-27055.test.tsx`: a `changeLines()`
reader over `[data-field-change]`; the six `getByText(/… → …/)` matches
read it instead (a text matcher cannot see a line split over spans). The
negative `queryByText(/New → Contacted/)` was moved too, since it would
have become vacuous. The two creation-diff strings gain the colon.
- `__tests__/RecordTimelinePanel-27524.test.tsx`: the peek line reads
`Status: New → Contacted`.
- `ui/packages/app-shell/src/views/RecordDetailView.harness.test.tsx`:
the audit-date and currency diff readers read `[data-field-change]`
lines, and their expected strings gain the colon (`Close date: 3.3.2020
→ 4.3.2020`, `Amount: €1,500.00 → €2,500.00`). The values themselves are
unchanged.
- `ui/packages/i18n/src/__tests__/untranslated-identity-4376.test.ts`:
`detail.fieldChangeLabel` joins `LEGITIMATE_IDENTITIES` as a format
string (ko/ru/ar keep `:`), like `grid.summary.pattern`.

The permission half is the server's, pinned by PR 1 in
`packages/plugins/plugin-audit/src/activity-field-redaction.test.ts`
(`[objectstack-ai#36290] masked: …`, `[objectstack-ai#36290] not served: the code and the summary
are served without the change of the field not served`, `[objectstack-ai#36290]
control: a reader served every field is served the whole code`). This PR
adds the UI side: the timeline draws only what is served.

## Acceptance notes

- Card lines, as this PR covers them: 「改一条客户的「客户备注」并保存:动态里出现「客户备注:旧文字 →
新文字」。」 — yes (zh-Hans label template `{{field}}:`).
「一次保存同时改电话和邮箱:一条动态,下面两行。」 — yes. 「单选、关联记录、人员字段:前后值显示的是选项名和记录名,不是内部编号。」 —
yes for single select, lookup and user (option label read per reader;
record names as served). 「用一个没有某字段读取权限的账号:动态里没有那个字段的修改行」 — the server
leaves the change out (PR 1); the UI draws what is served. The 「修改历史」
half of that line is part ③.
- Screenshots of the activity: NOT MEASURED in this PR (no local backend
and console build in this run). To reproduce: `OS_PORT=3000 pnpm dev`,
open a showcase record, edit a long text field and, in one save, two
short fields; the record's 动态 tab shows one entry per save with one line
per field; a long value shows `Show all`.
- The empty side is recognised by the writer's text `∅` (or an empty
text), the notation plugin-audit's `summaryValueOf` writes and its tests
pin; the served code carries no separate empty mark. A structural mark
would be a server change, outside this PR.
- Multi-select and `tree` sides still read as the stored text the writer
wrote (PR 1 nits, not taken there either).
- Docs: `ui/AGENTS.md` objectstack-ai#2 asks for the package README and the
`content/docs/frontend/` page; both are outside this dispatch's file
surface, so neither is edited here.
- No change to which entries the activity shows, how consecutive edits
fold, the activity filters, or audit storage.

## Verification

Read first:
1. `ui/packages/plugin-detail/src/renderers/recordActivityFeed.ts` —
`activityFieldChangesOf` (the only new read of server data; the empty
mark).
2. `ui/packages/plugin-detail/src/RecordActivityTimeline.tsx` —
`fieldChangeLinesOf`, `changeSideText`, and `renderSystemLine` (which
entries get lines, and the row-marker move in `streamRow`).
3. `ui/packages/plugin-detail/src/FieldChangeItem.tsx` — truncation, the
measured overflow and the toggle.

Two-minute check: `pnpm --dir ui exec vitest run
packages/plugin-detail/src/renderers/__tests__/record-activity.test.tsx`
— expect 35 passed, among them the eight `one line per changed field`
tests.

Readings below are at head `f281417b` (after merging `origin/main`
once).

<details><summary>Tests (local, under the verify lock)</summary>

- `pnpm --dir ui exec vitest run packages/plugin-detail/ packages/i18n/
packages/app-shell/src/__tests__/defaults-maps-mirror-en-pack.test.tsx`
plus the 22 app-shell `RecordDetailView.*` / record-page activity test
files, at `f281417b`: `Test Files 543 passed | 1 skipped (544)`, `Tests
6159 passed | 31 skipped (6190)`, lock `VERDICT command-exit 0`.
- `pnpm --filter @object-ui/plugin-detail run type-check` and `pnpm
--filter @object-ui/i18n run type-check` (each `tsc --noEmit && tsc -p
tsconfig.test.json`; the test project lists the four edited test files):
exit 0, before the merge.
- `ui`: `check:i18n-keys` 0, `check:i18n-drift` 0,
`check:i18n-dead-keys` 0, `check:new-line-citations` 0 (`0 new
citation(s)`), before the merge.

</details>

<details><summary>Ablation</summary>

Committed head first, then `node scripts/ablation-replace.mjs` replaced
`const lines = fieldChangeLinesOf(item);` in `renderSystemLine` with
`const lines = null …` (anchor 1 → 0, blob `5cc789c3a1d9` →
`0061c6cdd8de`) and ran `record-activity.test.tsx` under the lock:
`Tests 8 failed | 27 passed (35)` — all eight `one line per changed
field` tests red, every older test green. Restored: blob after restore
`5cc789c3a1d9` == HEAD, `git diff HEAD` empty. No `dist` is involved:
the ui vitest config aliases `@object-ui/plugin-detail` to its source.

</details>

<details><summary>Gates</summary>

`node scripts/pm/dispatch-gates.mjs --commands` at `f281417b`: 41
commands, each run with its exit code recorded before any pipe; all 41
exit 0. `--ran`: `Run reconciliation — 41 derived, 41 run, 0
NOT-MEASURED, 0 UNRUN.` CI owns the rest (Lint UI, Type Check UI, Test
UI, the repo-wide lint); not re-run here.

</details>

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

https://claude.ai/code/session_01ADHkmPq6z7KER4Sr6Uu7Ht

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
… write Field change values (objectstack-ai#36290 part 1) (objectstack-ai#36641)

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

Part of objectstack-ai#36290

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

## 维护者速读

- 管理员在 Studio 的字段设置和字段设计器里,原来的「记录历史」开关换成「字段修改值」三选一(默认 / 开 /
关),对象设置的「功能开关」里新增「字段修改值」;普通用户无感。
- 属于记录页「字段修改前后值」专题,落实「默认显示、对象或单个字段可关」的裁决:以前 Studio
写的是不再起作用的旧开关,管理员在界面上关不掉前后值。
- 若出错,管理员可能看到「默认」标成开而动态里实际不显示前后值(或相反),或关掉后回不到默认;改动只在设置界面,可直接撤回。
- 要你做的:无。

## What changes

Card objectstack-ai#36290 part ① (PR 3 of 4; ruling 7076513167 point 1: "Old → new is
shown by default on every object's record page; an object, or a single
field, can turn it off."). PR 1 (objectstack-ai#36399) gave the runtime `fieldHistory`
(field) and `enable.fieldHistory` (object); objectstack-ai#36580 gave the metadata
form a three-way `field-history` widget. The Studio's own producers
still wrote the old key. This PR moves all three named in the release
comment.

**Field inspector** (`ObjectFieldInspector.tsx`, Advanced section)
- The "Track history" box (`value={!!def.trackHistory}`, `patchDef({
trackHistory: v || undefined })`) is gone. Measured reason: since PR 1 a
field's `trackHistory: false` reads like absent and `true` does only
what `fieldHistory: true` does for a media or JSON type (spec describe
of `FieldSchema.trackHistory`), so a second box beside Field change
values could only mislead. A stored `trackHistory` is never written or
removed here; it is still read, because `resolveFieldHistory` reads it.
- New row "Field change values": Default / On / Off over the field's
`fieldHistory`. Default removes the key (`unsetDefKey`, not a patch to
`undefined`); On / Off write `true` / `false`.
- Default names what it resolves to through `resolveFieldHistory` from
`@objectstack/spec/data`, the predicate the activity writer uses. Unlike
the form widget, this rail holds the object document, so it passes the
object: an object with `enable.fieldHistory: false` makes every field's
Default read "Default (Off)", and a note under the row says the object's
off wins.
- The row sits inside the existing `DisplayPatchLock`, so on a read-only
base field it is locked with the same reason as its neighbours
(`fieldHistory` is not on `BASE_FIELD_DISPLAY_WHITELIST`).

**Object settings** (`ObjectSettingsPanel.tsx`, Features card)
- New row "Field change values" (`enable.fieldHistory`), next to "Field
change history" (`enable.trackHistory`). Ticked unless the stored value
is a literal `false`. Unticking writes `false`; ticking again REMOVES
the key (unset already means on, so no `true` the author did not need).
Sibling `enable` keys are kept, as for every other row.
- The Field change history description no longer says "pair with
per-field history tracking to pick which field diffs are summarized" (no
longer true); it points to Field change values.

**Field designer** (`plugin-designer` `FieldDesigner.tsx`, the drawer
behind `MetadataFieldsPage` and the `field-designer` SDUI type)
- The Advanced section's Track History switch wrote `trackHistory:
data.trackHistory === true` on every save, create and edit. It is
replaced by Field Change Values with the same three choices. The update
path no longer names `trackHistory`: a stored value rides the
`...editingField` spread, and a created field carries neither key at
Default.
- Default's label depends on the type, which the author can change in
the same drawer, and a drawer select's options are static. So the choice
is drawn as two rows under form-local names, one per resolved default,
each shown by a `visibleWhen` built from `resolveFieldHistory` over
`DESIGNER_FIELD_TYPES` (with the field's stored `trackHistory`). The
save reads the row shown for the saved type, which is the one on screen
at the click. Neither form-local name reaches the model.
- `DesignerFieldDefinition` (`@object-ui/types`) and its zod mirror gain
an optional `fieldHistory`. Both save paths carry it:
`MetadataFieldsPage` (`toDesignerField` / `fromDesignerField`) and
`MetadataService.toFieldPayload`. Default writes `fieldHistory:
undefined`, which overrides the carried value and is dropped on the
wire, so a stored key is removed. That is the converters' existing
clear-by-absence rule.
- It cannot import `fieldHistoryChoice.ts`, because app-shell depends on
plugin-designer. What it shares is the rule (`resolveFieldHistory` from
`@objectstack/spec/data`). Its own copy of the choice-to-value mapping
is two lines. Its strings are the language-pack keys
`appDesigner.fieldDesigner.fieldHistory`, `fieldHistoryDefault`,
`fieldHistoryOn` and `fieldHistoryOff`, in all 11 locales and the
designer's defaults table. They replace
`appDesigner.fieldDesigner.trackHistory`.

**Shared logic** (`metadata-admin/fieldHistoryChoice.ts`, new): the
three choices, the value each writes and their wording, used by both the
inspector row and the objectstack-ai#36580 `field-history` widget (refactored onto it;
its behaviour and its 10 pins unchanged). The controls stay separate on
purpose: the widget is a `WidgetProps` renderer that sees one form row
and no object; the inspector row is an `InspectorSelectField` with the
inspector's label and lock semantics and the whole object in hand.

**Strings** (studio namespace, en + zh; the other locales fall back to
en by that namespace's design): `designer.field.fieldHistory`,
`designer.field.fieldHistoryObjectOff`,
`engine.studio.settings.capFieldHistory`,
`engine.studio.settings.capFieldHistoryDesc`;
`engine.studio.settings.capTrackHistoryDesc` reworded;
`designer.field.trackHistory` removed with its box.

Not in this PR: record-page rows (part ②, landed as objectstack-ai#36613), the
per-field history card (part ③).

## Tests

- New `ObjectFieldInspector.fieldHistory-36290.test.tsx` (7): Default
(On) for a one-line type; Default (Off) for image / json / password and
Default (On) once `trackHistory: true`; Off writes `false`, On writes
`true`; Default after Off removes the key; no Track history box, no
`trackHistory` written, a stored one kept; the object's off makes
Default (Off) and shows the note; control: no note otherwise.
- New describe in `ObjectSettingsPanel.test.tsx` (4): checked for unset
and `true`, unchecked only for `false`; untick writes `false` with
siblings kept; re-tick removes the key with siblings kept; labelled by
its own title.
- New `FieldDesigner.fieldHistory-36290.test.tsx` (9), on the real
`FieldDesigner` with a drawer double that captures its schema and calls
its own `onSuccess`. The cases: two rows and no Track History row, with
the labels; for every designer type exactly one row's `visibleWhen`
evaluates true (through `evalFieldPredicate`, the form's own evaluator),
and it is the one `resolveFieldHistory` names; a stored `trackHistory:
true` moves a media type to the Default (On) row; an untouched edit
writes neither key; Off writes `false`, On on a media type writes
`true`; a stored `false` opens as Off and Default removes it; a stored
`trackHistory` is kept; a type changed in the drawer saves what is on
screen; a created field at Default carries neither key.
- New `MetadataFieldsPage.fieldHistory-36290.test.tsx` (4), on PUT bytes
through the real page and a real `MetadataClient`. A stored
`fieldHistory: false` survives and no `trackHistory` is written; a
stored `trackHistory: true` survives and gains no `fieldHistory`; a
field with neither key gains neither; every PUT field parses through
`FieldSchema`.
- Extended: `MetadataService.fieldKeyCarryOver.test.ts` adds
`fieldHistory` to its populated entry and its clearable keys;
`designer-zod-arms-10859.test.ts` adds `fieldHistory` to the fully
populated `field-designer` document.
- Forced test changes:
`ObjectFieldInspector.displayPatchReason-28986.test.tsx` names the Field
change values combobox instead of the removed Track history checkbox
among the locked controls;
`ObjectSettingsPanel.businessWording-36512.test.tsx` lists
`enable.fieldHistory` among the keys the tab writes.
`ObjectFieldInspector.externalIdNotOffered-26674.test.tsx` and
`ObjectFieldInspector.retiredIndexed.test.tsx` listed Track history
among the Advanced siblings that still render; they name Field change
values, and (being edited) now pay the formula and lint loads at module
top, as `check:test-source-alias` requires.
`FieldDesigner.externalIdNotOffered-26674.test.tsx` and
`MetadataFieldsPage.externalIdRoundTrip-26674.test.tsx` used the Track
History row as their positive control; they now use the Field Change
Values row.


## Acceptance notes

- The field designer's Default label follows the drawer's type and the
object is not in hand, so an object with `enable.fieldHistory: false` is
not reflected there, the same accepted bound as objectstack-ai#36580's widget. Neither
`FieldDesigner` nor `MetadataFieldsPage` is mounted by the Console
today; both are published exports, and `field-designer` is a registered
SDUI type.
- A stored field `trackHistory: true` on a media or JSON type makes
Default read "Default (On)"; such a field can still be turned off with
Off, but not returned to the type's off-by-default without editing the
key in the form. That is the resolver's answer, not a UI choice.
- `ui/AGENTS.md` objectstack-ai#2 (package README and `content/docs/frontend/` page)
not edited: outside this part's file surface.
- Screenshots NOT MEASURED (no Console build or backend run here).

## Verification

Read first, by risk:
1. `ui/packages/plugin-designer/src/FieldDesigner.tsx`: the
`fieldHistoryRows` memo (two rows, `visibleWhen` built from
`resolveFieldHistory`) and `fieldHistoryFromForm`, which picks the row
for the SAVED type on both save paths.
2.
`ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.tsx`:
`patchEnable` with `unsetWhenOn` (re-ticking removes
`enable.fieldHistory`, keeps siblings).
3.
`ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.tsx`:
the Field change values row and the object-off note inside
`DisplayPatchLock`.

Two-minute check: open Studio, an object, Settings, Features: "Field
change values" is ticked. Untick, save, and reopen the object JSON: it
shows `enable.fieldHistory: false`. Tick again: the key is gone. Then
open a field's Advanced section: "Field change values" reads "Default
(Off)" with the note under it.

<details><summary>Runs (local, head 3b5b130 after merging origin/main
9e2a4ac)</summary>

- Builds under the verify lock: the
`@objectstack/{spec,formula,lint,client,sdui-parser}` closure, and
`@object-ui/app-shell^...` again after the merge (VERDICT command-exit 0
each).
- `type-check` (tsc plus `tsconfig.test.json`) of
`@object-ui/app-shell`, `@object-ui/i18n`, `@object-ui/types` and
`@object-ui/plugin-designer`: all four Done, exit 0 (after the merge;
plugin-designer again at 3b5b130).
- Post-merge union at ffa608d: `vitest run
packages/app-shell/src/views/metadata-admin/inspectors/
packages/app-shell/src/views/studio-design/ObjectSettingsPanel
packages/app-shell/src/views/metadata-admin/FieldHistoryWidget-36482.test.tsx
packages/app-shell/src/views/metadata-admin/SchemaForm
packages/plugin-designer/ packages/types/
packages/app-shell/src/services/ packages/i18n/
packages/app-shell/src/__tests__/defaults-maps-mirror-en-pack.test.tsx`
gave Test Files 851 passed (851) and Tests 16838 passed, 14 skipped.
3b5b130 changes only the designer pin's types; that file re-run: 9/9.
- Pre-merge union at 3fa510b (`metadata-admin/`, `studio-design/`,
`i18n/`) gave Test Files 1232 passed and 2 failed (1234). The 2 were
sibling pins still naming Track history, fixed in 58cef60.
- Ablations, each through `scripts/ablation-replace.mjs` (anchor 1 to
0), restored with blob equal to HEAD and `git diff HEAD` empty:
- The inspector writes `trackHistory` again: 2 of 7 new inspector pins
red.
- The settings switch writes `true` instead of removing the key: 1 of 14
red.
- The designer's update path writes `trackHistory: data.trackHistory ===
true` in place of `fieldHistory`: 7 of 13 red across the two new
designer files.
- `dispatch-gates --commands` at 3b5b130 derived 42 families; all 42
ran locally with exit 0; `--ran` reconciliation gives "42 derived, 42
run, 0 NOT-MEASURED, 0 UNRUN".
- `overlap-check` at 3b5b130: VERDICT clean exit 0 against origin/main
d7411fa (three commits past the merged 9e2a4ac; `git merge-tree` is
also clean) and objectstack-ai#36634, objectstack-ai#36629, objectstack-ai#36606, objectstack-ai#36587, objectstack-ai#36525.
- ui extras: `check:new-line-citations` 0, `check:i18n-keys` 0,
`check:i18n-drift` 0, `check:i18n-dead-keys` 0. eslint on the changed
source and test files: 0 errors, and no warnings on added lines.

</details>

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

https://claude.ai/code/session_01ADHkmPq6z7KER4Sr6Uu7Ht

---------

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/m 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.

Field history switch cannot show or return to unset (follow the default)

2 participants