Skip to content

formula: label() over a multi-select reads null at runtime, yet validate and lint --strict pass it — render the selected options' labels joined, or refuse it at author time #34339

Closed

Description

@os-bob

What

On 18.5.0, the formula field label(record.gaps) over a Field.select({ multiple: true }) evaluates to null at runtime for every non-empty selection. This holds for a one-element list too, in both zh-CN and en. The engine logs:

formula field 'cb_probe_note' on 'crm_quote_line_item' could not be evaluated, so it reads null ... label(record.cb_probe_gaps) renders ONE option value, and cb_probe_gaps holds a list of values on this record.

optionLabelOf in @objectstack/formula throws when the value is an object or array.

Neither author-time gate catches it: os validate and os lint --strict both exit 0 on this metadata. An author who follows the documented label() pattern ships a formula that passes both gates and reads null in every view.

Repro (app project, pinned 18.5.0, booted with @objectstack/verify)

  • Line object with these fields:
    • cb_probe_gaps: select, multiple: true, 3 options, zh-CN labels in the pack;
    • cb_probe_note: formula label(record.cb_probe_gaps);
    • control pair cb_probe_one: single select, with cb_probe_one_note = label(record.cb_probe_one).
  • Results from GET /data/OBJ/ID with Accept-Language zh-CN and en:
Selection cb_probe_note Control (cb_probe_one_note)
["no_sales_price","no_customer"] null in both languages 无客户 / No customer
["no_freight_region"] null in both languages —
empty or null "" —

Ask

  1. Capability. label() on a multi-select returns the selected options' labels in the reader's language, joined with , in option order. The mail-template option hole already does this (OPTION_ARGUMENT_RULE). Alternatively, provide a documented sibling such as labels(list): string.
  2. Author-time. Until (1) ships, os validate / os lint refuse label() over a multiple: true select with a rule naming the field. A formula that is known to read null should not stage clean.

Consumer

An app project stores a quote line's "margin cannot be estimated" gaps as structured data, and needs the sentence rendered in the reader's language (structured field + label() in a formula, no language in hooks). The natural shape is one multi-select of gap kinds. The app is holding that card on this platform answer rather than build a field-per-slot workaround.

Activity

  1. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    Contributor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Path: none

    Triage: first touch → domain:server · p2 · 2026-11-16T08:07Z

    ⛔ Not a claim.

    On 18.5.0, label(record.gaps) over a multi-select evaluates to null at runtime for every non-empty selection, while validate and lint --strict pass it. A formula an author can ship silently shows nothing (measured on a downstream CRM quote line). p2. Either render the selected labels joined, or refuse it at authoring.

  2. added
    bug
    domain:server
    pm:queue
    priority:p2
    on Nov 16, 2026
  3. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    Contributor

    coordinator#1 · os-project-manager · session_01FEkQ5p5codnUGsdGxBfaL9

    Ruling: claimable now · batch 1 · maintainer 「分两批点名放行,不改级别」 (the option he chose on the decision card) · recorded 2026-11-16T14:21Z

    Recorded by the project's decision thread. The maintainer's standing rule sends every decision through a dedicated thread that evaluates it and puts it to him there. He chose at 2026-11-16T14:19:33Z. Decision thread cmsg_01TenzsRopZj4jMbvjX8uz1X2H6qQ8ciHX7XMq2gtnGnNg, card cmsg_01TenzsRopZj4jMbvjX8uz1X3VzHFerEezFprpapKovrc1, choice record cmsg_01TenzsRopZj4jMbvjX8uz1X671t1eYHsegqWBBX4bNCyE.

    Thread-read: 6910922453 (the newest comment). Labels at the read: bug, priority:p2, pm:queue, domain:server; unassigned.

    The question he was asked

    He named 21 open p2 cards and asked whether they should be the next tasks. His intake rule of 2026-11-16 for the repo:objectstack#1 seat is 「除了前任的任务继续处理,后续只认领 p1 或者阻塞 p1 的任务」, so the seat cannot claim a p2 card. The thread sorted the 21 into a first batch of 6, a second batch of 8, and 7 that are not new tasks. Which of them become the seat's next work, and how?

    The four options on the card, as he read them:

    • 「分两批点名放行,不改级别」: 「第一批 6 张小而有实测的现在可认领,第二批 8 张等第一批合并后放开。级别保持 p2,p1 仍然优先。其余 7 张不作为新任务。」 (recommended)
    • 「两批都升 p1」: 「和前两次一样改标签,14 张都变成 p1。做法简单,但 p1 会从“数据错、安全、核心任务走不通”变成“你想先做的”,今天已升了 8 张。」
    • 「只放第一批 6 张」: 「只放开 6 张小卡,级别不改。要改协议或引擎的那 8 张,等手上的 p1 清完再问你。」
    • 「先不加」: 「本席手上已有 12 张 p1 在做、2 张待领。这 21 张都留在 p2,等你下次再排。」

    The batches, as listed in the file and the message he was given:

    The ruling

    This card is in batch 1 (position 2 of 6) and may be claimed by the repo:objectstack#1 seat now, at its p2 grade. The grade does not change. p1 work still comes first.

    This adds one sentence to his intake rule for this seat: after the p1 cards, the seat may claim the p2 cards he named here, batch 1 first and batch 2 after batch 1 has merged. It names these 14 cards and no other p2.

    Why this card, as told to him: label() over a multi-select passes validate and lint, then reads null on every record. Measured on 18.5.0 by a downstream app project.

    State


    Generated by Claude Code

  4. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#1 · os-project-manager · session_01FEkQ5kgF3mo9f7LXuv5hac

    Claim · #34339 · 2026-11-16T16:55Z

    Claim: repo:objectstack area-lease mode, area o1-C, lease lease:o1-C (named p2, batch 1, under the maintainer's 「分两批点名放行,不改级别」; grade stays p2) · built by an os-dev sub-agent (mode:subagent) · posted at 2026-11-16T16:55Z
    Session: session_01FEkQ5kgF3mo9f7LXuv5hac
    Account: os-project-manager
    Branch: claude/issue-34339-formula-label-multi-select
    Worktree: objectstack-issue-34339
    Domain: domain:server
    Seat: repo:objectstack#1
    File surface: packages/formula/src/stdlib.ts (the label() evaluation over a list value) and its tests; the objectql formula option-label seam only if the multi-select's labels do not already reach the evaluator; content/docs/** sentences that teach label(); new tests; a changeset (stop on breach; explain in the report)
    Container & model: M, mode:subagent, model: default, effort: default
    Clause-②: no (a formula that reads null today reads text; nothing that answered now refuses. The dev confirms against the diff.)
    Metadata-protocol: semantic (label() over a multi-select gains a value; the dev confirms against the diff)
    Responsibility: objectstack platform: @objectstack/formula optionLabelOf faults on a list value, so the formula field reads null | none: validate and lint --strict pass it | every app with label() over a multi-select; measured on a downstream CRM quote line at 18.5.0
    Thread-read: 6919059607
    Premise: holds (the card's measurement: optionLabelOf in packages/formula/src/stdlib.ts throws on an array value; ask 1 is the capability, ask 2 applies only "until (1) ships")
    Shape: ask 1. label() over a multi-select renders the selected options' labels in the reader's language, joined with , , by the same rule the mail-template option hole already uses (template-engine.ts, list → each label, joined , ); one rule, not a second spelling. No labels() sibling. Ask 2 is not built, because ask 1 removes the null.
    Ruling-ref: 6919059607 (maintainer 「分两批点名放行,不改级别」, batch 1, 2026-11-16T14:19Z)
    Pre-claim lane: repo:objectstack lane (seat's area o1-C).
    Pre-claim deps: none open; no open PR on label() over a list found.
    Prior rulings read: #28659 (label() option-target authoring check, label-field-no-options); no ⛔ conflict.

    State change: pm:queue → pm:dispatched, add lease:o1-C, assigned os-project-manager.


    Generated by Claude Code

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 16, 2026
  6. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#1 · os-project-manager · session_01FEkQ5kgF3mo9f7LXuv5hac
    os-dev-report

    {
     "issue": 34339,
     "status": "done",
     "branch": "claude/issue-34339-formula-label-multi-select",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/34443",
     "head_sha": "4a1ed6a82f02f6dbf0763d66c2a102ee4f8aa0be",
     "session": "session_01FEkQ5kgF3mo9f7LXuv5hac",
     "premise_still_valid": true,
     "summary": "label(record.FIELD) over a multiple: true select now reads the label of each selected value in the reader's locale, in STORED order (measured: ['no_freight_region','no_sales_price'] reads 'No freight region, No sales price' although the options declare no_sales_price first), joined with ', '. The join is one package-internal helper, labelEachOption in packages/formula/src/stdlib.ts, which the mail template option hole (template-engine.ts) now calls too, so there is one spelling. Measured: empty list and null read '' (unchanged; engine-level empty was already '' on main), a listed value no option declares reads as stored (same as the single-value path), an object inside the list still faults. The objectql option-label seam (formula-option-labels.ts) needed no change: it builds labels for every served field declaring options, multiple or not, and the real-engine pin reads translated multi-select labels through it. Docs: content/docs/data-modeling/formulas.mdx said 'A multi-value select is refused'; now teaches the join. No labels() sibling and no ask-2 author-time refusal, per ruling 6919059607. Card assignee not written by this dev.",
     "tests": "RED on main (tests c0547aa1b3, formula src = merge base 9e6fee19ea): `pnpm --filter @objectstack/formula exec vitest run --maxWorkers=2 src/option-label.test.ts` -> Tests 7 failed | 11 passed (18); `pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/engine-formula-option-label.test.ts` -> Tests 2 failed | 10 passed (12), 'AssertionError: expected null to be 无销售价, 无客户', engine logged the card's line 'label(record.gaps) renders ONE option value, and gaps holds a list of values'. GREEN (locked run, HEAD 6fa079a825): formula build exit 0; objectql file Tests 12 passed (12); formula typecheck exit 0. FINAL HEAD 4a1ed6a82f: `pnpm --filter @objectstack/formula test` -> Test Files 67 passed (67), Tests 1770 passed (1770); dogfood single file after `turbo run build --filter=@objectstack/dogfood^...` (70 tasks, exit 0): `pnpm --filter @objectstack/dogfood exec vitest run --maxWorkers=1 test/formula-option-label-locale.dogfood.test.ts` -> Test Files 1 passed (1), Tests 6 passed (6), lock VERDICT command-exit 0. NOT MEASURED: objectql full suite and objectql typecheck (only a test file added there; CI Test Core / Type Check workspace); dogfood red-on-main; test:repo (CI).",
     "ablation": "node scripts/ablation-replace.mjs --file packages/formula/src/stdlib.ts --anchor (the Array.isArray(value) -> labelEachOption line) --delete -- bash ablate-inner.sh: anchor x1 -> x0, blob af2083df5155 -> a999c7ce79c1; formula rebuilt (exit 0); `node scripts/ablation-dist-preflight.mjs @objectstack/formula 'oneOptionLabel(field, item, options, true)' --absent` -> marker absent from all 6 built files (exit 0); objectql file Tests 2 failed | 10 passed (12); formula file Tests 7 failed | 11 passed (18). Restore: 'restored: blob == HEAD (af2083df5155) and git diff HEAD is empty', git diff HEAD 0 lines; rebuild exit 0; preflight marker present in dist/index.js and dist/index.mjs; objectql file Tests 12 passed (12).",
     "gates": "Local, final head 4a1ed6a82f: `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 94 commands (list unchanged from 6fa079a825); all 94 run, exit captured before any pipe: 94 x exit 0 (an earlier sweep at 6fa079a825 had check:skill-examples and check:dual-build-cjs-loads exit 3 PREREQUISITE NOT MET, cleared once the dogfood closure was built). `node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran ran.txt` -> '94 derived famil(ies) accounted for — 94 run, 0 NOT-MEASURED (a DERIVED zero — all 94 recorded an exit code and none of them is 3)'. CI check-runs at report time on 4a1ed6a82f: Check Changeset, Check Documentation Links, Check PR Size, Governed Surface Queue Guard, Lint · (ESLint, CI release & engine gates, PM dispatch-gates, docs & code guards, repo & tooling gates, scoped x3), PR-body guards, Spec property liveness, Type Check · (consumer gates, debt ledger, source gates, workspace): in_progress; 18.x upgrade harness, Borrowed queue verdict, Packed-tarball smoke, Queue verdict, Schedule gate: skipped. Expected red that is main's, not this diff's: check:platform-checklist (approvals.approver-resolution-matrix VARIANTS STALE) under Lint & Repo Gates; stated in the PR body.",
     "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm (the one touched dogfood file was run alone, see tests)",
     "files_changed": [
      ".changeset/34339-formula-label-multi-select.md",
      "content/docs/data-modeling/formulas.mdx",
      "packages/formula/src/option-label.test.ts",
      "packages/formula/src/stdlib.ts",
      "packages/formula/src/template-engine.ts",
      "packages/objectql/src/engine-formula-option-label.test.ts",
      "packages/qa/dogfood/test/formula-option-label-locale.dogfood.test.ts"
     ],
     "declarations": "Clause-②: no and Metadata-protocol: semantic confirmed against the diff (a formula that read null now reads text; nothing that answered refuses; label()'s meaning over a multi-select changes). Changeset: @objectstack/formula minor. PR body adds Skills-docs: follow-up owed — skills/objectstack-formula/SKILL.md.",
     "deviations": [
      "Signed trailer written as a plain-text last line `signed: repo:objectstack#1 · os-project-manager · session_01FEkQ5kgF3mo9f7LXuv5hac`, not as the HTML comment the dispatch asked for: os-dev.md forbids dev-authored HTML comments and wins on conflict. Seat can rewrite it.",
      "PR footer uses AGENTS.md's session-URL footer form, not the harness reminder's '🤖 Generated with' form; commit trailers are model-free `Claude-Session:` + `Co-authored-by: Claude` (AGENTS spelling).",
      "Verify lock: three queue-timeouts (exit 99, ~27 min) behind a full dogfood run by another worktree, then acquired. One attempt was killed by my own `timeout 590` wrapper mid-run (red objectql reading retaken). One attempt to run the narrowed single-file checks without the lock was refused by the permission classifier and was not run.",
      "Green + ablation objectql readings were taken at 6fa079a825; the final head 4a1ed6a82f only removes one assertion (an absent-key case that CEL faults on before label() runs) from option-label.test.ts; the formula full suite was re-run green at the final head.",
      "Report carries extra fields head_sha, ablation, files_changed, declarations, deviations that the os-dev template lacks, because the PM named them."
     ],
     "mcp_calls": "0",
     "api_writes": "3 — via relay fleet-write run 43927071941: POST /repos/objectstack-ai/objectstack/pulls (pr_create, draft) + POST /repos/objectstack-ai/objectstack/issues/34443/assignees (os-project-manager); via post-stamped: POST /repos/objectstack-ai/objectstack/issues/34339/comments (this report). git push is not counted.",
     "open_questions": [],
     "security_findings": "none",
     "out_of_scope_findings": [
      "carrier: seat · Skills-docs follow-up owed: skills/objectstack-formula/SKILL.md's label(record.f) row teaches a single select only and does not mention the multi-select join; skills/** is outside this claim's file surface, noted, not filed"
     ]
    }
  7. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    Contributor

    repo:objectstack#1 · os-project-manager · session_01FEkQ5kgF3mo9f7LXuv5hac

    Delivered · #34339 · 2026-11-16T19:22Z

    PR #34443 merged through the queue as d4e4dfbf9e (2026-11-16T19:21Z); Fixes #34339 closed this card. L1 delta ACCEPT 6925238147 (L1-b, after body-only REWORK 6925198529); no L2 owed; landing record 6925728020.

    Delivered: label(record.f) over a multiple: true select reads the label of each selected value in the reader's locale, joined , in STORED order (not the declared option order the card's wording named; claim 6923097287 took the mail-template option hole's existing rule, and that hole now calls the same helper). An empty list or null reads ''; a value no option declares reads as stored. content/docs/data-modeling/formulas.mdx teaches it. No author-time refusal was added (the card asked for one only until this shipped).

    Left: #34444 (the skills row). A downstream reader who needs declared option order asks on a new card.

    State change: pm:dispatched and lease:o1-C removed in this stroke.


    Generated by Claude Code

  8. removed
    pm:dispatched
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugdomain:serverpriority:p2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions