Skip to content

feat(studio): a customer adds validation rules to an installed object, saved in its .custom extension - #39581

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-39471-custom-picklist-validation
Dec 4, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-39471-custom-picklist-validation

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #39471

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:在工作室打开已安装软件包里的对象,进入「验证」页,可以新建自己的验证规则。软件包自带的规则仍然可见,但只读。
  • 为什么做:新公司试用时发现,客户装好 CRM 软件包后,无法给软件包里的对象加校验,比如「设备台数不能小于 0」。这是客户最常做的第一批定制之一。
  • 出错会怎样:受影响的是给已安装对象加规则的管理员。最坏的情况是规则没保存上,或保存时被拒;软件包自带的规则不会被改动,自定义规则在定制包里删掉即可撤回。
  • 要你做什么:无。

What changes

Studio → an installed object → Validations now offers New validation rule. Before, the tab showed the package's rules read-only and offered nothing.

  • The package's own rules are listed first, marked "From the package", and open read-only, with a reason on hover and focus.
  • A rule the customer creates or edits goes into the Data pillar's existing extension buffer: the object's object_extension in the App's paired .custom package. The top bar's Save writes it through the ensure door and publishes it, which is the same path that already carries __c fields, field patches and the field layout. No server change.
  • A customer rule never takes a package rule's name. A new rule's derived name skips it, and typing it is refused with a message. This matters because the registry merges extension rules by name: a same-named rule would replace the package's rule whole, and active: false would turn it off. The claim rules out override and disable.
  • Files: a new module, studio-design/pairValidations.ts, splits the served rules into the package's and the pair's and routes edits into the buffer. ObjectValidationsPanel.tsx gets one prop (packageRules). DataPillar.tsx adds call sites only: the published rule names on the buffer, one hook call, and the panel mount. The served-verdict context is not handed down in pair mode, because its paths index the served rules, not the extension's. Copy is in the studio namespace, en and zh.

Scope: item 2 of the card only. Item 1 (adding a picklist value) is split out to its own card for a maintainer route decision, because no door stores a picklistExtensions entry in a pair today.

Read first (by risk):

  1. ui/packages/app-shell/src/views/studio-design/pairValidations.ts: packageRulesOf decides which served rules are the package's (by the names the buffer and the published extension declare).
  2. ui/packages/app-shell/src/views/studio-design/DataPillar.tsx: the Validations mount, which switches draft / onPatch / disabled and drops the verdict context when pairRules is set.
  3. ui/packages/app-shell/src/views/studio-design/ObjectValidationsPanel.tsx: editorDisabled and the name-input refusal.

Tests

  • DataPillar.baseObjectExtension-28575.test.tsx gets a new top-level describe (the shared base-object harness). The package rule is read-only. The "not negative" preset over the customer's units__c saves { extend, fields, validations } into the pair, sends no object save and publishes object_extension at the pair; the body parses against ObjectExtensionSchema. A published customer rule shows once, and its edit replaces it in the extension. CONTROL: walled, nothing is offered or written.
  • ObjectValidationsPanel.test.tsx gets a new top-level describe. Package rules are listed first and read-only. A new rule is named past a package rule's name. Typing a package rule's name is refused and nothing is written. CONTROL: with no package rules the panel is unchanged.
  • packages/runtime/src/domains/meta-object-extension-item.test.ts gets a new top-level describe over the real SQL store and protocol. A rule in the pair's extension refuses a matching insert (VALIDATION_FAILED) and lets another through. It keeps refusing after the base registers again (a reinstall) and after a restart reads the stored row back. This pins behaviour the platform already had; no runtime source changed.
Readings (head cfb48d3 unless marked)
  • pnpm --dir ui exec vitest run on the two studio-design files: Test Files 2 passed (2) · Tests 35 passed (35).
  • pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/domains/meta-object-extension-item.test.ts: Test Files 1 passed (1) · Tests 53 passed (53) (at ea28e05; the file is unchanged since).
  • pnpm --filter @object-ui/app-shell run type-check (both tsc programs, tests included): exit 0 (at ea28e05; the last commit only adds two side-effect imports to one test file and the changeset).
  • pnpm --filter @object-ui/i18n run type-check && pnpm --dir ui exec vitest run packages/i18n/: exit 0, Tests 1874 passed | 13 skipped.
  • pnpm --dir ui exec vitest run scripts/: Test Files 172 passed | 2 skipped.
  • Derived gate families (dispatch-gates.mjs --commands at cfb48d3, 68): 65 ran with exit 0. 3 are NOT MEASURED locally: check-comment-mask-corpus and check:query-options-erasure were killed at 300s on the shared box, and check:dual-build-cjs-loads answered PREREQUISITE NOT MET (dist absent for packages this diff does not read). These three are left to CI. dispatch-gates --ran: 68 derived famil(ies) accounted for — 65 run, 3 NOT-MEASURED.
  • Ablations, each reverted (git status clean after):
    • name refusal off: typing a package rule's name … is refused went red (1 failed | 12 passed);
    • the pillar routing panel edits to the object buffer instead of the extension: both write cases went red (2 failed | 20 passed).

Acceptance notes

  • The card's third acceptance line ("survives reinstalling the package") is pinned at the runtime layer: the base's manifest is registered again, and a restart re-reads the stored row. The pair is a separate package, so a base reinstall never touches it.
  • Measured, not changed: at the HTTP door, a pair extension rule that bears a package rule's name replaces that rule (merge by name, ADR-0029 D9.2a), and active: false turns it off. Only this UI refuses the name. A platform-side refusal would be a new gate, and none is proposed.
  • The field inspector's picklist notice is held by another card and is not touched here.

Verification

Two minutes: OS_PORT=3000 pnpm dev:crm, open Studio → an installed object → Validations. Expected: the package's rules show "From the package" and are greyed out. New validation rule → "Value must not be negative" (on an object with a number field) → Save. The rule appears as the customer's, and a record save with a negative value is refused with its message.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L9qibvqcHrQpENbRP7eLfU

…tom extension

The Validations tab of an installed object lists the package's rules
read-only and edits the customer's rules in the object's extension in the
paired .custom package, saved and published by the extension's Save. A new
or renamed customer rule never takes a package rule's name.

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

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs.

What this run could not see

Coarse fallback — 0 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 01edf99468f4487b28375ab10bcc29753bdd8aa0 → packageMentionDocs.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-tesla · os-tesla · session_01L9qibvPFnj3TkGq8ps2Jgv

L1-a · ACCEPT · #39581 @ cfb48d3786 · Area: ot-build · read 2026-12-04T09:27Z

  • Face: no packages/spec/src/**, no governed path, Clause-②: no and Metadata-protocol: none, so no L2 is owed. This is the seat's TIER_DEFAULT read.
  • Card fit: item 2 of Studio: a customer cannot add a picklist value or a validation rule to an installed package, though object and picklist extensions support both #39471 and its acceptance lines 2 and 3 for rules. Item 1 (the picklist value) is carried by Studio: a customer cannot add a value to an installed package's picklist: no door stores a picklistExtensions entry in the .custom pair (item 1 of #39471) #39536, which is open, pm:dispatched and titled as item 1 of Studio: a customer cannot add a picklist value or a validation rule to an installed package, though object and picklist extensions support both #39471, so Fixes #39471 closes nothing that is left unowned.
  • Write path: a customer rule goes into the pillar's existing extension buffer (object_extension in the App's .custom pair), saved through the ensure door and published, which is the path that already carries __c fields and field patches. No server change. Package rules are listed first, read-only, with a reason. The name refusal (derived name skips a package rule's name, typed name refused) is pinned and ablated red.
  • Acceptance "fires on save" and "survives reinstalling": pinned at the runtime layer over the real SQL store (meta-object-extension-item.test.ts). A pair rule refuses a matching insert with VALIDATION_FAILED and passes another, and keeps refusing after the base registers again and after a restart. The page test parses the saved body against ObjectExtensionSchema.
  • l1-face flag changeset for @objectstack/runtime: the only runtime file is a test, and runtime's files[] is dist, README.md and CHANGELOG.md, so no changeset is owed.
  • Changeset, read sentence by sentence: the package rules listed first and read-only, New validation rule, saved by the top bar's Save into the .custom extension and published, the name refusal, and "on an object your own package owns, the tab is unchanged" all match the diff. "It stays in place when the package is reinstalled or upgraded" is pinned for re-registration and restart only; an upgrade is the same separate-pair argument and is not pinned. Accepted as stated.
  • Evidence pinning: the runtime and type-check readings are at ea28e05371. The last commit adds two side-effect imports to one test file plus the changeset, so CI at this head governs.
  • Gates at cfb48d3786 (l1-face.mjs --pr 39581): Lint & Repo Gates success, TypeScript Type Check success, 60 success · 12 expected-skip names · 0 failed · 0 pending. The 3 locally NOT MEASURED families are covered by these check-runs.

For the seat (out of scope, no change here): the body measured that at the HTTP door a pair extension rule bearing a package rule's name replaces it, and active: false turns it off. Only this UI refuses the name. The card defers override and disable to ADR-0146's whitelist. Whether the door should refuse is the seat's filing-gate call, as a declared-vs-enforced reading; this PR does not propose a new gate. A vendor upgrade that later adds a rule with a customer rule's name meets the same merge.

Not Tier H. Landing order: #39548 lands first, then this PR merges main (both touch DataPillar.tsx). The L1 delta is owed only if that merge moves more than the conflict resolution.

…stom-picklist-validation

# Conflicts:
#	ui/packages/app-shell/src/views/studio-design/DataPillar.baseObjectExtension-28575.test.tsx
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-tesla · os-tesla · session_01L9qibxjHbaJSwcu6suJxbB

2026-12-04T11:27Z · Seat record · land PR #39581 (#39471) at head 4a3c358fb9.

  • Readings: NOT governed, 423 lines; CI 60 success / 12 skipped / 0 failed; K = 1 (landing-k after the run).
  • Main merge since the ACCEPT: one test-file conflict (DataPillar.baseObjectExtension-28575.test.tsx, both describes kept); DataPillar.tsx call sites byte-identical ⇒ no delta owed.
  • L1-a ACCEPT 7407356061 (on cfb48d3786). Its seat note (HTTP-door same-name override) is routed by the seat separately.
  • Landing authority: the maintainer, project chat 2026-12-04T06:37Z, verbatim 「复审通过的 PR 座位自己落地」.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/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.

Studio: a customer cannot add a picklist value or a validation rule to an installed package, though object and picklist extensions support both

2 participants