Skip to content

validation rules: a condition on a choice field compares against whatever text is typed, so an option label silently never matches #39405

Done

Description

@objectstack-fleet

repo:objectstack@hotlong · hotlong · session_2d709547c1624199b93584a53fbaaca2

What happens

A new admin adds a validation rule on a custom object in Studio. One field is a single-choice field, 紧急程度, with the options 高 (gao) and 紧急 (jinji). Studio derives the option values from the labels in pinyin.

The rule's condition is "紧急程度 equals 紧急". The value cell is a free text input, so the admin types the label they see everywhere in the UI. The condition compiles to jinji_chengdu == "紧急". Stored rows hold jinji, so the rule never fires: creating a 紧急 record with the field the rule requires left empty saves fine.

There is no warning at save time and none at runtime. Typing jinji makes the rule work, which I confirmed through the UI and the REST API. Nothing in the builder tells the admin that the value is the stored code, or what the codes are.

#36964 fixed the same trap for flows (filters and decision conditions). The validation-rule condition builder still has it.

Where

ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx:1327 (origin/main 301a378). The value is always <Input value={r.value} …>, whatever the field's type.

Expected

  • For select / radio / multiselect / checkboxes fields, the value cell is a picker over the field's options. It shows labels and stores values.
  • A condition saved with a literal that is not one of the field's option values gets a save-time warning, like the one the flow fix added.

Repro

  1. objectstack dev --ui --seed-admin (any app). In Studio, create an object with a 单选 field whose options are Chinese labels.
  2. Add a validation rule on it: field equals the Chinese label, and another field is required.
  3. Create a record with that option and leave the required field empty. It saves.

Activity

  1. added
    bug
    priority:p2
    pm:queue
    domain:ui
    area:studio
    on Dec 3, 2026
  2. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Triage: audit only — the card carries area:studio · Bug · priority:p2 · domain:ui · pm:queue from its filing and has no first-touch audit; this seat audits it under the lane exception and changes no label or grade. Ruling-ref: references/execution-duties.md, verbatim: 「缺审计评论而已带 area、type、级 ⇒ 当轮自补(triage-duties.md 自分诊 ③)」. Fix lands in ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx (file ownership domain:ui); at origin/main 301a378 the value cell is still a bare <Input value={r.value}> for every field type (line 1326). Note for triage review: area:studio is not a North Star area (triage moved #39348/#39349 to area:build for the same surface); re-labelling is triage's, not this seat's.
    Grade: a validation rule an admin configures through the UI silently never fires on choice fields, so required-field rules do not hold; p2 kept as filed.
    Review: triage

  3. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Claim: PM loop round 1 · 2026-12-03T22:47Z
    Session: session_016WV4d1cnRvyiAqrarmDhZV
    Account: os-elon-musk
    Area: em-admin
    Branch: claude/issue-39405-condition-option-picker
    Worktree: objectstack-issue-39405
    Domain: domain:ui
    Seat: repo:objectstack@os-elon-musk
    File surface: ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx, the save-time check that warns on a choice-field literal outside the field's option values (located by the dev next to the #36964 flow-condition warning; name it in the report before editing it), ui/packages/i18n/src/namespaces/studio/en.ts and ui/packages/i18n/src/namespaces/studio/zh.ts (new keys only), a new test file named for this card. Stop on any other breach and explain in the report.
    Container & model: M, mode:subagent, model: default (dispatch-gates --tier at 301a3784: "no path-derived mandate"; design judgement in the picker and the warning), effort: high (M card)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: platform Studio code in this repo (ConditionBuilder.tsx); no existing path covers it for validation rules (#36964 covered flow filters and decision conditions only); every admin writing a validation rule on a select/radio/multiselect/checkboxes field reaches it today.
    Thread-read: none
    Premise: holds — at origin/main 301a378 ConditionBuilder.tsx:1326 renders <Input value={r.value} …> whatever the subject field's type.
    Pre-claim lane: ui/** ⇒ domain:ui (file ownership only).
    Pre-claim deps: none named by the card.
    Prior rulings read: check-prior-rulings.mjs --card 39405 at 301a378: card thread 0 rulings; corpus hits generic, none on this file.
    Serial constraints cleared: check-handover.mjs --inflight → NO OVERLAP READ (2 unread surfaces, #38415 and #35238, are domain:skills fleet cards, not ui/**); no open PR touches this file. The dev runs overlap-check.mjs before each push.

  4. added
    pm:dispatched
    and removed
    pm:queue
    on Dec 3, 2026
  5. objectstack-fleet commented on Dec 4, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4d1cnRvyiAqrarmDhZV
    os-dev-report

    {
      "issue": 39405,
      "status": "blocked",
      "branch": "claude/issue-39405-wip",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/39440",
      "session": "session_016WV4d1cnRvyiAqrarmDhZV",
      "premise_still_valid": true,
      "summary": "Premise held: at origin/main f32b7d6d (past 301a3784) ConditionBuilder.tsx line 1327 rendered a bare Input for every subject type. Implemented the builder half: a select/radio/multiselect/checkboxes subject whose catalog row carries options gets a picker (labels shown, values stored, a stored non-option value kept visible as its own item), and a row whose literal is not an option value gets an advisory warning under it (a label names its value with a one-click swap; anything else is named as not an option value); tags, option-less choice fields and other types keep the text box. It reaches the hook and page-block condition inspectors and the generic editor ConditionWidget today. BLOCKED on a file-surface extension for the two remaining parts of the card: (1) ObjectValidationsPanel.tsx builds the validation-rule builder catalog without options, so the card's own Studio repro gets the picker only after one producer line (options: declaredFieldOptions(e.def)); (2) no save-time check judges validation-rule conditions against option values; it needs a new packages/lint module beside flow-select-options.ts plus an authoring-rules.ts entry, a rule explanation, a barrel export and a lint changeset. PM mechanism assumption falsified in part: the flow fix (flow-condition-option-label in validate-flow-trigger-readiness.ts, reading flow-select-options.ts) is server lint only with no UI picker; its label reading (selectOptionsOf) is mirrored in the builder, not imported. Branch moved to claude/issue-39405-wip on the coordinator correction; the old branch claude/issue-39405-condition-option-picker exists on origin at the same sha 040f9b4e and needs deleting by a person.",
      "tests": "New ConditionBuilder.optionPicker-39405.test.tsx: 20 passed (cd ui; pnpm exec vitest run on the file; VERDICT command-exit 0). Ablation via scripts/ablation-replace.mjs (anchor `const options = choiceOptions.get(r.subject);` replaced with undefined; anchor 1 to 0; restored blob 7bbd5b18 equals HEAD; git diff HEAD empty): 10 failed / 10 passed, every picker and warning case red, the controls green. Neighbours: ConditionBuilder.* + HookDefaultInspector.condition + widgets.filterBuilderOptions-36216: 18 files, 227 passed; inspectorStrings.* + PageBlockInspector* + studio-design ObjectValidations*: 34 files, 505 passed; packages/i18n: 110 files, 1874 passed, 13 skipped; @object-ui/app-shell type-check exit 0; @object-ui/i18n type-check exit 0; eslint on the 4 changed ui files: 0 errors (9 pre-existing warnings). Dependency closure built first: turbo build --filter=@object-ui/app-shell^... exit 0. Tests ran on 42a720fb; 040f9b4e adds only the changeset.",
      "gates": "dispatch-gates --ran on 040f9b4e: 38 derived, 37 run (all exit 0), 1 NOT-MEASURED: check:query-options-erasure killed at a 300s timeout (exit 124), no verdict; CI lane 'Lint · scoped · query-options erasure' owns it. 26 families ran on 42a720fb; the changeset commit 040f9b4e adds one .md; re-run on 040f9b4e: check:nul-bytes 0, check:type-check-coverage 0, check:published-files 0, check:type-check-debt killed at 280s (exit 124) after exit 0 on 42a720fb. The 11 changeset-derived families ran on 040f9b4e, all exit 0. pnpm --dir ui exec vitest run scripts/: 172 files passed, exit 0. PR check-runs at first read (not awaited): success: Check Changeset, Check PR Size, Governed Surface Queue Guard, Live E2E UI, Test Core, Dogfood Regression Gate, Type Check · debt ledger, Type Check · workspace, PR-body guards, Build UI Deps; in_progress: Build & E2E UI, Lint UI, Type Check UI, Type Check · source gates, Type Check · consumer gates, Lint · ESLint and the scoped lint lanes.",
      "mcp_calls": "0",
      "api_writes": "3 via the fleet relay: POST /repos/objectstack-ai/objectstack/pulls (draft, #39440) and POST /repos/objectstack-ai/objectstack/issues/39440/assignees (os-elon-musk) in one pr_create stroke; POST /repos/objectstack-ai/objectstack/issues/39405/comments (this os-dev-report, post-stamped). git pushes (not REST): the probe of claude/issue-39405-condition-option-picker and three commits to it, then claude/issue-39405-wip.",
      "classifier_refusals": [
        {
          "command": "Write ui/packages/app-shell/src/views/metadata-admin/inspectors/condition-option-value.tsx (a new sibling module for the picker and the warning)",
          "reason": "[Destructive or Unwanted Actions]",
          "mode": "subagent",
          "human_turn_before": "no",
          "resend": "none; the code went into ConditionBuilder.tsx, inside the declared surface"
        }
      ],
      "open_questions": [
        {
          "question": "Extend the file surface so the card can close?",
          "options": [
            "A: add ObjectValidationsPanel.tsx (one producer line plus a pin) and the packages/lint save-time warning (new module beside flow-select-options.ts, authoring-rules.ts entry at warning tier for object and object_extension, rule explanation, barrel export, lint changeset) as a patch round on #39440",
            "B: add only ObjectValidationsPanel.tsx to #39440 now and split the server-side warning into its own card",
            "C: land #39440 as Part-of and file both halves as cards"
          ],
          "recommendation": "B, because the panel line is what makes the card's own Studio repro work and is mechanical, while the lint rule is a new authoring-rule registry entry with its own explanation, wiring and review weight"
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "noted, not filed · an option value spelled true, false or null, or shaped like a root-dotted path (user.x), passes the spec option-value regex, but fmtValue in ConditionBuilder.tsx emits it bare, so a row on it compiles to a bool, null or a reference; pre-existing; reach not measured at a public door · carrier: none (noted in #39440 Acceptance notes)"
      ],
      "deviations": [
        "the os-dev rule that a file over 1,000 lines takes a new concern in a sibling module conflicts with the dispatch file surface; the new module was refused by the classifier, so the picker and warning live in ConditionBuilder.tsx (+141 lines)",
        "branch and PR head are claude/issue-39405-wip per the coordinator correction, not the claimed claude/issue-39405-condition-option-picker; the old branch exists on origin at 040f9b4e (a person deletes it); the os-dev rule forbids a PR from a claude/issue-N-slug-wip backup branch, this name carries no slug and the coordinator ordered it",
        "PR body says Part of #39405, not Fixes, because two parts of the card stay open",
        "a .changeset file was added (publishing surface), not named in the dispatch file surface",
        "two long commands were moved to the background by the harness at the 600s cap: the first was stopped and re-run narrowed in the foreground; the second completed and its results are recorded above"
      ],
      "line_budget": "414 changed lines (+407 / -7) across 5 files, under the 3000 human-merge threshold",
      "files_changed": [
        ".changeset/39405-condition-option-picker.md",
        "ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx",
        "ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.optionPicker-39405.test.tsx",
        "ui/packages/i18n/src/namespaces/studio/en.ts",
        "ui/packages/i18n/src/namespaces/studio/zh.ts"
      ]
    }
  6. objectstack-fleet commented on Dec 4, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Claim amendment: 2026-12-04T00:08Z · amends claim 7394698647 · Area: em-admin
    Branch: claude/issue-39405-wip (project rule: cloud sessions push only claude/issue-N-wip; the earlier claude/issue-39405-condition-option-picker sits on origin at 040f9b4 for a person to delete).
    File surface: ui/packages/app-shell/src/views/studio-design/ObjectValidationsPanel.tsx (one producer line: the catalog carries the field's declared options, plus its test), added; the zone's routing answer to the dev's open question (report comment 7396314372), option B.
    Split: the save-time warning item moves to #39441 (sub-issue, pm:queue); this card keeps the builder picker and the panel catalog, and PR #39440 changes to Fixes #39405 once the panel line lands.
    Serial constraints cleared: check-handover.mjs --inflight --card=39405 meets this zone's own #39407 (item 3, the validation name hint in the same file, other lines) and #39351 (directory entry ui/packages/app-shell/src/views/**, it does not edit this file): ordinary concurrency, the later lander resolves.

  7. objectstack-fleet commented on Dec 4, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Claim: PM loop round 1 · 2026-12-04T00:15Z · re-posted: supersedes claim 7394698647 for the branch name only (project rule: cloud sessions push only claude/issue-N-wip); every claim amendment on this card still stands
    Session: session_016WV4d1cnRvyiAqrarmDhZV
    Account: os-elon-musk
    Area: em-admin
    Branch: claude/issue-39405-wip
    Worktree: objectstack-issue-39405
    Domain: domain:ui
    Seat: repo:objectstack@os-elon-musk
    File surface: ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx, the save-time check that warns on a choice-field literal outside the field's option values (located by the dev next to the #36964 flow-condition warning; name it in the report before editing it), ui/packages/i18n/src/namespaces/studio/en.ts and ui/packages/i18n/src/namespaces/studio/zh.ts (new keys only), a new test file named for this card. Stop on any other breach and explain in the report.
    Container & model: M, mode:subagent, model: default (dispatch-gates --tier at 301a3784: "no path-derived mandate"; design judgement in the picker and the warning), effort: high (M card)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: platform Studio code in this repo (ConditionBuilder.tsx); no existing path covers it for validation rules (#36964 covered flow filters and decision conditions only); every admin writing a validation rule on a select/radio/multiselect/checkboxes field reaches it today.
    Thread-read: 7396418952
    Premise: holds — at origin/main 301a378 ConditionBuilder.tsx:1326 renders <Input value={r.value} …> whatever the subject field's type.
    Pre-claim lane: ui/** ⇒ domain:ui (file ownership only).
    Pre-claim deps: none named by the card.
    Prior rulings read: check-prior-rulings.mjs --card 39405 at 301a378: card thread 0 rulings; corpus hits generic, none on this file.
    Serial constraints cleared: check-handover.mjs --inflight → NO OVERLAP READ (2 unread surfaces, #38415 and #35238, are domain:skills fleet cards, not ui/**); no open PR touches this file. The dev runs overlap-check.mjs before each push.

  8. objectstack-fleet commented on Dec 4, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@os-elon-musk · os-elon-musk · session_016WV4d1cnRvyiAqrarmDhZV
    os-dev-report

    {
      "issue": 39405,
      "status": "done",
      "branch": "claude/issue-39405-wip",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/39440",
      "session": "session_016WV4d1cnRvyiAqrarmDhZV",
      "premise_still_valid": true,
      "summary": "Patch round (option B, claim amendment 7396418952). ObjectValidationsPanel.tsx: the Rules tab's field catalog now carries each field's declared options via declaredFieldOptions(e.def), the reading useObjectFields already uses, so a validation rule's condition on a choice field gets the option picker; pinned by ObjectValidationsPanel.optionPicker-39405.test.tsx (radio field, the card's repro). The save-time lint warning is #39441's. Green head: 673e5fc9 (every required check success or skipped). CI reds the PM named were not code failures: every one was a superseded run cancelled by the next push. On 040f9b4e the 16 Test UI shards, Type Check UI and Build & E2E UI were cancelled at 00:09:53Z after the 7bda8863 run started at 00:09:37Z, so the Test UI aggregator (job 144707781648) failed on 'cancelled'. On 7bda8863 every lane was cancelled by the 673e5fc9 push, and the aggregators TypeScript Type Check (144707871395, 'type-check lane ... concluded cancelled'), Lint & Repo Gates (144707879074, 'lint lane ... concluded cancelled') and Test UI (144707855390, OS_TEST_UI_RESULT cancelled) failed on that. Nothing was skipped or disabled. PR body NOT edited by me: my standing rule lets a subagent write a PR body only at pr_create and leaves later edits to the seat; the replacement body (Fixes #39405, Refs #39441 with the split, panel line and pin added, the open-items note replaced) is ready for the seat.",
      "tests": "673e5fc9: ObjectValidationsPanel.optionPicker-39405 + ObjectValidationsPanel.test + ObjectValidationsPanel.typedEmptyOps-11894 + ConditionBuilder.optionPicker-39405: 4 files, 37 passed (VERDICT command-exit 0). Panel ablation via scripts/ablation-replace.mjs (anchor `options: declaredFieldOptions(e.def),` replaced with undefined; anchor 1 to 0; restored blob 06521894 equals HEAD, git diff HEAD empty): 2 failed / 1 passed, both picker cases red, the text-field control green. The first ablation try got exit 99 (queue timeout, never acquired, mutation restored) and was re-run. The prior round's builder ablation and neighbouring suites stand (ConditionBuilder.optionPicker-39405: 10 red / 10 green under ablation).",
      "gates": "CI on 673e5fc9 (head): 45 success, 15 skipped, 0 failed, 0 pending. Required: Lint & Repo Gates success, TypeScript Type Check success, Test Core success, Build Core skipped, Governed Surface Queue Guard success, Lint UI success, Type Check UI success, Test UI success, Build & E2E UI success, Live E2E UI success, Dogfood Regression Gate success, Temporal Conformance skipped; also Check Changeset success and PR-body guards success. Local: dispatch-gates --ran against 673e5fc9 with the prior record: 38 derived, 37 run, 1 NOT-MEASURED (check:query-options-erasure, killed at a 300s timeout; its CI lane 'Lint · scoped · query-options erasure' is success on 673e5fc9), 0 UNRUN. The family set is the same as on 040f9b4e, but those local readings were taken on 040f9b4e; on 673e5fc9 the CI lanes are the evidence. App-shell type-check was not re-run locally; Type Check UI is success on 673e5fc9.",
      "mcp_calls": "0",
      "api_writes": "1 this round: POST /repos/objectstack-ai/objectstack/issues/39405/comments (this report, via post-stamped and the relay). git pushes (not REST): 7bda8863 and 673e5fc9 to claude/issue-39405-wip. Prior round: 3 (pr_create draft + assignee, report comment 7396314372).",
      "classifier_refusals": [],
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "noted, not filed (unchanged from the prior round) · an option value spelled true, false or null, or shaped like a dotted path under a root, is written unquoted by fmtValue in ConditionBuilder.tsx · carrier: none (noted in #39440 Acceptance notes)"
      ],
      "deviations": [
        "PR body not edited: the coordinator asked me to switch it to Fixes #39405 plus Refs #39441, but my standing rule allows a subagent to write a PR body only at pr_create and leaves later edits to the seat; the full replacement body is in the scratchpad file pr-body-v2.md under issue-39405 (path in the handback), read back against the live body first (unchanged since create)",
        "the panel pin is a new file named for this card (ObjectValidationsPanel.optionPicker-39405.test.tsx), following this panel's per-card test files, not a top-level describe in ObjectValidationsPanel.test.tsx",
        "the worktree was rebuilt with git worktree add on the existing local branch, because dev-worktree.sh refuses an existing local branch; BASE pinned at 040f9b4e",
        "the container restart killed a locked test run (exit 137); the run was narrowed and re-run on the same head"
      ],
      "line_budget": "PR total 535 changed lines across 7 files (+528 / -7), under the 3000 human-merge threshold",
      "files_changed": [
        ".changeset/39405-condition-option-picker.md",
        "ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.tsx",
        "ui/packages/app-shell/src/views/metadata-admin/inspectors/ConditionBuilder.optionPicker-39405.test.tsx",
        "ui/packages/app-shell/src/views/studio-design/ObjectValidationsPanel.tsx",
        "ui/packages/app-shell/src/views/studio-design/ObjectValidationsPanel.optionPicker-39405.test.tsx",
        "ui/packages/i18n/src/namespaces/studio/en.ts",
        "ui/packages/i18n/src/namespaces/studio/zh.ts"
      ]
    }
  9. objectstack-fleet commented on Dec 4, 2026

    @objectstack-fleet
    ContributorAuthor

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

    Delivered · 2026-12-04T02:02Z · zone em-admin
    PR #39440 merged (merge commit 801dda1c0f), closing this card via Fixes #39405; L1 ACCEPT → PR #39440 comment 7397437196. The save-time lint half lives on #39441; the pre-existing fmtValue quoting gap is #39456. pm:dispatched removed in this stroke. The pre-rule branch for this card is left on origin for a person to delete.

  10. removed
    pm:dispatched
    on Dec 4, 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:studiobugdomain:uipriority:p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions