Skip to content

Studio form editor: re-home or retire the "required field in a gated section" author-time check #39852

Backlog

Description

@objectstack-fleet

repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4cwiNRyb9B38wT2fjYj

维护者速读

  • 问题:表单里把对象必填的字段放进“按人或按条件才显示”的分区,看不到该分区的登录用户提交时会被拒绝,报错点名一个他看不到的字段。原来拦这种表单的设计时检查自协议 19 起已触发不到;目前仓内示例里没有一张表单是这样做的,属于防未来(尤其是 AI 生成的表单)的检查。
  • 选项:A 把检查放进 Studio 表单设计器——但设计器本身没有“分区显示条件”这个控件,这种表单只能从源码、接口或 AI 写出来,设计器里拦不到源头,约 1 个 PR;B 正式放弃,作者无任何提醒,最终用户提交时才报错,约 1 个小的文档 PR;C(卡上没有)把检查做成平台统一的元数据校验规则,命令行校验和发布表单时都会拒绝并给出三种改法,Studio 发布时显示同一条拒绝,约 1 个 PR。
  • 推荐:C。理由:这类表单只可能从设计器之外写出来,只有统一校验规则能在每个入口都拦住,而且不会再因为某个编辑器改版而悄悄失效(这次就是这样丢的)。
  • 不定会怎样:检查处于“写在决策记录里、实际不存在”的状态;作者和 AI 可以做出登录用户无法提交的表单,没有任何提示,问题只在最终用户提交时暴露。

速读已按 Fable 档分析补齐 · 2026-12-06T02:35Z(原推荐「待分析后补」→ 现推荐 C:做成平台统一的元数据校验规则,卡上原来只有 A、B);分析见本卡最新的 at-tier 评论。

Context

Follow-up of card #39003 item 2, second arm ("or moved to the form item designer if it still lacks those features"), carried out of PR #39783 so that PR stays decision-neutral. The maintainer chose, in the project thread on 2026-12-06T01:43Z, to record the gap and decide it on its own card.

Facts (from contract review 7431562202, M1):

  • The author-time fence was landed by maintainer ruling (5749269225 letter c and 5831744213 on objectui#6900). ADR-0113 named it as what covers the gated-section case the save-time validator leaves out.
  • It was mounted only in the view inspector; since protocol 19 it was unreachable for form items, and PR fix(console): remove Studio form-view leftovers, package-less scope references and nav resolver staleness #39783 removes its code (requiredInGatedSection.ts and its tests). ADR-0113 line 410 keeps its paragraph plus a dated note pointing here.
  • The hazard is live on form items: FormSchema takes the form body by reference, FormSectionSchema.visibleWhen can bind current_user, the server reads no form, and @objectstack/lint has no equivalent rule.
  • A form editor exists: ui/packages/app-shell/src/views/studio-design/publicForm/PublicFormsDesigner.tsx places object-required fields into named sections, and publicFormDesign.ts#sectionBody keeps a stored section's keys, visibleWhen included.

Options

Related: #39003, PR #39783, ADR-0113, objectui#6900.

Activity

  1. added
    needs-user-decision
    domain:ui
    on Dec 6, 2026
  2. objectstack-fleet commented on Dec 6, 2026

    @objectstack-fleet
    ContributorAuthor

    triage@hotlong · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage (first touch): decision card, stays in the inbox · area:build · domain:ui · Feature · p3 as filed, touched 2026-12-06T02:24Z. Rationale: area:ux → area:build: the question is whether wrong form metadata (a required field in a section that can hide) is refused at authoring time in Studio — North Star area:build ② "wrong metadata is loudly refused with a prescription". Issue type set to Feature.

    • The card's recommendation line reads "待分析后补". Triage is running the at-tier decision analysis now and posts it here before the card is presented to the maintainer.
  3. objectstack-fleet commented on Dec 6, 2026

    @objectstack-fleet
    ContributorAuthor

    triage@hotlong · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Decision analysis at tier, re-run before presenting · 2026-12-06T02:34Z

    维护者速读

    • 问题:表单里把对象必填的字段放进“按人或按条件才显示”的分区,看不到该分区的登录用户提交时会被拒绝,报错点名一个他看不到的字段。原来拦这种表单的设计时检查自协议 19 起已触发不到;目前仓内示例里没有一张表单是这样做的,属于防未来(尤其是 AI 生成的表单)的检查。
    • 选项:A 把检查放进 Studio 表单设计器——但设计器本身没有“分区显示条件”这个控件,这种表单只能从源码、接口或 AI 写出来,设计器里拦不到源头,约 1 个 PR;B 正式放弃,作者无任何提醒,最终用户提交时才报错,约 1 个小的文档 PR;C(卡上没有)把检查做成平台统一的元数据校验规则,命令行校验和发布表单时都会拒绝并给出三种改法,Studio 发布时显示同一条拒绝,约 1 个 PR。
    • 推荐:C。理由:这类表单只可能从设计器之外写出来,只有统一校验规则能在每个入口都拦住,而且不会再因为某个编辑器改版而悄悄失效(这次就是这样丢的)。
    • 不定会怎样:检查处于“写在决策记录里、实际不存在”的状态;作者和 AI 可以做出登录用户无法提交的表单,没有任何提示,问题只在最终用户提交时暴露。

    Analysis

    Served-tier: CONTRACT_REVIEW_TIER
    Analysed-by: subagent of session_01Q4EjjMnyLqJdzuktEmRPXH

    Read at: objectstack origin/main eecae948ad. hotcrm local checkout 235106f3 (inventory only). Cloud not read (the decision does not touch it).

    Background

    A form item's section can carry a visibleWhen predicate. The record save judges the object's field definitions and never reads a form. So a section that hides for some user, holding a field the object requires, gives that user a form they cannot submit: the client skips the hidden rows, the server refuses the save and names a field the user cannot see.

    The maintainer ruled on this twice. On #13252 (ruling comment 5468998814, 2026-08-30, verbatim 「同意」): option B, the authoring side refuses this arrangement at save/arrangement time; option C, a record validator that reads form metadata, is explicitly rejected. The execution card was objectstack-ai/objectui#6900, where rulings 5749269225 (letter c) and 5831744213 placed the refusal in Studio's view inspector as a Save-blocking issue.

    Protocol 19 (ADR-0159 D7) made view lists-only and forms their own form type. The inspector's form branch can no longer be reached. PR #39783 removes that branch and the check's module; contract review 7431562202 (finding M1) refused to let the PR record "the save-time refusal answers it" as a decision nobody ruled. This card carries that open question.

    Governing text

    • docs/adr/0113-required-write-contract-vs-column-constraint.md line 410 on origin/main: "the validator does not consume view metadata (ruled on [Decision] Should the server-side required check read a form section visibleWhen predicate? (objectui#6237 semantic 1, cross-repo half) #13252; Studio's gated-section fence covers the section case at authoring)." (git show origin/main:docs/adr/0113-required-write-contract-vs-column-constraint.md | sed -n 407,411p)
    • [Decision] Should the server-side required check read a form section visibleWhen predicate? (objectui#6237 semantic 1, cross-repo half) #13252 ruling 5468998814: 「采选项 B,⛔ 明确不采 C —— objectui 侧在保存/编排时拒绝「对象必填字段放进带 visibleWhen 谓词的分节」这一编排;服务端校验器保持现状…⛔ 永不消费 form view」, and its ground: 「生成表单的 agent 看得见分组、看不见对象 required 标志,需要的是编排时即时反馈」. It also says of the then-unmeasured inventory: 「为 0 不废 B——围栏为未来 AI 产出而设」.
    • ui/packages/app-shell/src/views/metadata-admin/inspectors/requiredInGatedSection.ts docblock (still on origin/main): the ruled fence covers only predicates reading current_user and its aliases, features, app, page; "A record / previous predicate, a bare field, a constant and the reverse-direction parent draw nothing".
    • docs/NORTH-STAR.md line 18, area:build ②: "wrong metadata is loudly refused with a prescription"; line 171: "what is wrong must be loudly refused with a prescription, never silently stored".
    • ADR-0159 D9: the designer is the form item's one Studio editor.
    • Form authoring: refuse an object-required field placed inside a predicate-gated section at save time (ruled option B of objectstack#13252) objectui#6900 and its two ruling comments: unreachable. gh api repos/objectstack-ai/objectui/issues/comments/5749269225 and .../5831744213 both answer HTTP 403 (GitHub API access to that repository is not enabled for this session; only anonymous git reads are, and issue comments are not in git). Their content is read here only through the in-tree citations above (the module docblock, ViewVariantInspector.tsx line 325 to 330, the app-shell CHANGELOG entry 402a266). The exact words of letter c were not read.

    Protocol statement

    • A: no protocol change; Studio only.
    • B: no protocol change; an ADR-0113 amendment (docs/adr/**, Tier H) that withdraws a ruled fence.
    • C: no schema or metadata-protocol change. It adds one rule id to @objectstack/lint's published rule set, and metadata that parses today would be refused at os validate and at the form publish door. The semver level for a new gating rule was not measured here; the dev takes it from the changeset gate.

    Premises, re-checked

    # Premise (card or review) Reading on origin/main eecae948ad Command
    1 "#39783 removed the dead code" Moved. PR #39783 is still an open draft (head 2418c09d, not merged). The module and its three tests are still on origin/main, unreachable. gh api repos/objectstack-ai/objectstack/pulls/39783 --jq '.state,.merged,.draft'; git ls-tree -r --name-only origin/main | grep requiredInGatedSection
    2 The fence is unreachable since 19 Holds. ViewKindSchema is enumWithRetiredValues(['list'], { form: … }); PROTOCOL_VERSION = '19.0.0'. git grep -n "export const ViewKindSchema" origin/main -- packages/spec/src/ui/view.zod.ts
    3 FormSchema takes the form body by reference; section visibleWhen binds current_user Holds. formItemBodyShape() spreads FormViewSchema.shape; the section docblock says current_user binds client-side under a host that publishes a scope. git grep -n "formItemBodyShape|DOES bind here" origin/main -- packages/spec/src/ui/view.zod.ts
    4 The server reads no form at record save Holds; ADR-0113 line 410 and ruling 5468998814. above
    5 @objectstack/lint has no equivalent rule Holds. No rule joins a form section predicate with the object's required. git grep -n -i "required.*section|section.*required" origin/main -- packages/lint/src ':!*.test.ts' → no rule
    6 A form editor exists and keeps a stored section's visibleWhen Holds, and incomplete: the editor has no control that writes a section predicate. visibleWhen occurs 0 times in both designer files; sectionBody only spreads the stored section. The editor already has a Save gate of this family (missingRequiredFields, Save disabled while an object-required field is off the form). git show origin/main:ui/packages/app-shell/src/views/studio-design/publicForm/PublicFormsDesigner.tsx | grep -c visibleWhen → 0; same for publicFormDesign.ts → 0
    7 The hazard is "live on form items" Holds on signed-in surfaces only. FormPage.tsx#findSubmitRefusals skips a section isSectionVisible hides, so the submit goes out and the server refuses. On the anonymous route no host publishes a scope, the predicate faults and visibility falls open (isSectionVisible passes true as the fallback; spec docblock limit 2), so the section is shown to every visitor and the hidden-required case does not arise there. git show origin/main:ui/apps/console/src/components/FormPage.tsx | sed -n 1056,1078p
    8 The fenced roots Narrower on a form item than in the removed module: features.* is refused at parse on every form-view predicate (section docblock, checkFormViewPredicateFeaturesRoot). Identity roots remain; whether app and page bind on the form routes was not measured. spec docblock above
    9 Inventory 4 authored form files in the tree (examples/app-crm, examples/app-showcase); 0 section-level visibleWhen (the one hit is a field-level predicate in task.form.ts). hotcrm checkout: 0 defineForm. Zero measured instances. git ls-tree -r --name-only origin/main | grep -E '\.form\.ts$' | grep -v metadata-form then grep visibleWhen
    10 Lint can host the check Holds. validate-visibility-predicates.ts already walks every forms[] item's section predicates (formItemSites). validatePublicFormFileFields is the same shape (a form × its object's fields, gating, CLI_AND_RUNTIME, runtimeTypes: ['form']; "a form write's snapshot carries objects as context"). git show origin/main:packages/lint/src/authoring-rules.ts | sed -n 2003,2023p

    The task note that a predicate can bind current_user, so author time cannot decide whether a section hides, is correct and already answered by the ruled design: the check never decides. It refuses the combination whenever the predicate reads a root the object's own field rule cannot restate, and offers three remedies (move the field, drop the predicate, un-require the field). The over-refusal is a section predicate that is true for everyone who can open the form, and a form that is only ever served anonymously.

    The concrete problem

    An author, in practice a package author writing defineForm or an agent writing through the metadata door, can publish a form that some signed-in users cannot submit. Nothing warns at authoring. The first person to learn of it is an end user, from an error naming a field that is not on their screen. ADR-0113 says a fence covers this; no reachable fence exists.

    Options

    What is done What the customer sees Effort
    A re-home in the Studio form designer Restore the pure check, wire it to the designer's Save gate, tests; ADR-0113 note names the new home A form that already carries a gated section and is opened in the designer cannot be saved until fixed. A form written in source, through the API or by an agent, and never opened in the designer, is not checked. The designer itself cannot create the hazard. domain:ui · 1 PR · precedent PR #39541 (form editor checks, +373/−33, 12 files); the module to restore is 283 lines + 143 of test on main
    B retire ADR-0113 amended: the fence is withdrawn, the record save's refusal is the answer No author-time signal anywhere. End users meet the refusal. docs · 1 PR, Tier H · precedent: PR #39783's own ADR-0113 hunk (+9 lines)
    C rule in @objectstack/lint One rule over forms[] × the bound object's required fields, the ruled root set, gating, wired to the CLI commands and the form publish door; rule explanation; ADR-0113 note names the rule; the Studio module goes with #39783 os validate and a form publish refuse the arrangement with the three remedies, whichever tool wrote the form. Studio's designer shows the door's refusal on Publish through its existing refusal text. domain:engine (lint) · 1 PR · no named landing PR recoverable (history is squashed at 2026-10-30); nearest shape on main: validate-public-form-file-fields.ts 161 lines + 191 of test

    Not offered: a record validator that reads the form. Ruled out on #13252.

    Business reading. A is a spell-checker installed in the one editor that cannot type the misspelling. B is deleting the rule and letting the customer's customers find the broken forms. C is putting the rule where every other "this form can never be completed" rule already sits, so every way of writing a form meets it.

    Four axes

    Long-term soundness (leads, weight ≥ 50%). End state in two years: one authoring-rule registry judges metadata at every door (CLI, publish, and what Studio shows), and a visual editor adds no verdict of its own. That is how this repository already treats the sibling case "a public form with a file field can never be filled", and it is the platform-layer model mainstream low-code platforms use for layout validity (checked when metadata is saved or deployed, not only inside one visual editor; stated from general knowledge, not verified here). This card is itself the evidence against an editor-local check: the fence lived in one inspector and stopped existing when the type moved, with no gate noticing. A repeats that shape. B removes a special case but leaves ADR-0113's "not in scope" paragraph without the cover it was ruled to have. C shrinks special cases: one rule, no Studio-only judgement, no drift between Studio and the door.

    Real business pull. Zero measured: no form in the tree or in the hotcrm checkout has the arrangement, and the designer cannot produce it. #13252 said the same in August and the maintainer ruled the fence in anyway, for agent-written forms. Pull does not separate A from C; it argues only for B, against a standing ruling.

    Preventing AI mistakes. The author most likely to make this mistake is an agent that sees sections and not the object's required flags. Under A the agent's path (source or the metadata door) is not checked at all: silent. Under B: silent, and the failure surfaces to an end user. Under C the agent's write is refused loudly at os validate and at publish, with a prescription. C is the only option that is loud on the path that produces the error.

    Startup focus. B is cheapest and declares nothing. A and C are one PR each. C adds one rule id, a permanent obligation; it removes 283 lines of Studio code and six locale keys that A would keep. No option is three times another's cost.

    os-decision-facets
    ① Long-term soundness: C shrinks special cases (one registry rule, no editor-local verdict); A repeats the shape that just lapsed unnoticed; B leaves ADR-0113's scope paragraph uncovered.
    ② Business pull: zero measured instances today; the standing ruling on #13252 put the fence in at zero pull, for agent output.
    ③ AI mistakes: C refuses loudly on the path agents use; A and B are silent there.
    ④ Startup focus: B declares nothing; C adds one rule id and deletes the Studio module; A keeps a Studio-only check.
    Prior rulings read: "gated section" required, requiredInGatedSection → 19 + 5 hits; ADR-0113 line 410, #13252 ruling 5468998814; thread: objectstack-ai/objectui#6900 unresolved (API 403, rulings 5749269225 and 5831744213 read only through in-tree citations)

    Recommendation

    C. It is the only option that checks the paths through which the hazard can be written, and it carries out the ruled intent (refuse at authoring, never in the record validator) in the place that cannot silently fall out of reach.

    C differs from the letter of the earlier rulings in one respect the maintainer should see: they placed the refusal on the Studio side and noted that the server accepts the draft. Under C the publish door refuses it. That is a move of the ruled fence, not of the record validator, so the rejection of a validator reading forms is untouched.

    Self-check: on axis ① alone the choice is C; do ②③④ flip it: no. ④ notes that C is a new gating rule at zero measured pull, which is the one ground on which the maintainer may prefer B; it does not make A better.

    Confidence gaps:

    1. The words of ruling 5749269225 letter c were not read. If it rules that this refusal must stay Studio-only, C needs that ruling amended; the pick on this card would be that amendment.
    2. Whether a designer Publish reaches the lint gate with the bound object in the snapshot was read from the registry comments, not run in a live app.
    3. Whether app and page bind on the form routes was not measured; the rule should fence only roots that do bind there, and identity roots are confirmed.
    4. Record-rooted section predicates (a section that hides on a value the user picked) produce the same end-user error and were ruled outside the fence, "served by the build-time lint teaching". No such teaching for sections was found in @objectstack/lint. Not widened here; worth one card if the maintainer wants it measured.
    5. The semver level of a new gating lint rule was not measured.

    After the ruling

    Effort precedent

    A: PR #39541, +373/−33, 12 files, merged. B: the ADR-0113 hunk in PR #39783, +9 lines. C: no named landing PR (squashed history); validate-public-form-file-fields.ts and its test, 352 lines together, same wiring.

    Related cards and PRs

    #39003 (parent, item 2 second arm), PR #39783 (open draft, removes the Studio module), contract review 7431562202 (M1), #13252 (the ruling), ADR-0113, ADR-0159 D7 and D9, PR #39541 (form editor precedent), objectstack-ai/objectui#6900 (execution card of the ruling, unreachable).

    Delta from the card's existing analysis: the card carried options and facts but no analysis and no recommendation ("待分析后补"). Option A: same option, cost changed: the designer cannot author a section predicate, so A does not cover the authoring paths that can create the hazard. Option B: same. Option C: new, not on the card. Recommendation: none existed; now C. Facts moved: PR #39783 is not merged, so the code is still on main; the hazard is limited to signed-in surfaces because the anonymous route fails open; features is already refused at parse; objectstack-ai/objectui#6900 could not be read.

  4. objectstack-fleet commented on Dec 6, 2026

    @objectstack-fleet
    ContributorAuthor

    triage@hotlong · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Ruling: letter C · maintainer 「39852 C,关于测量,你先用fable 分析」 · 2026-12-06T03:34Z

    Maintainer ruling recorded: the "required field in a gated section" check becomes a gating rule in @objectstack/lint over forms[] × the bound object's required fields, run at the CLI and at the form publish door; it is neither re-homed in the Studio designer nor retired.

    Provenance

    Next (carried from the analysis, not typed by him)

    needs-user-decision off, pm:queue on: this card is now the build card.

  5. added
    pm:queue
    and removed
    needs-user-decision
    on Dec 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:builddomain:uipm:queuepriority:p3

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions