Skip to content

field rules: requiredWhen, readonlyWhen and option visibleWhen comparing a select to an option label never apply #39722

Description

@objectstack-fleet

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

Category: Bug (same class as #39441)
Grade: p2. A field rule that compares a select field to an option label silently never applies, so a field the customer meant to be required, read-only or hidden is not.
Reader: whoever claims it after the wind-down. Measure each predicate's door first.
Dedupe: requiredWhen option label → 2 hits, none on point (seat posts only); the class is #39441 (validation conditions, PR #39688).

Business rationale

#39441 / PR #39688 refuses a validation-rule condition that compares a select field to an option label instead of its value, because such a rule saves and then never fires. Per L1-a REWORK 7414492078 and L2 7414461872 on PR #39688, requiredWhen, readonlyWhen and option visibleWhen carry the same trap. An admin or AI writes status == '已关闭' (the label), the predicate never matches, and the form never makes the field required, never locks it, or never shows or hides the option. Nobody is told. The customer believes a data rule is in force when it isn't.

Expected

For each of requiredWhen, readonlyWhen and option visibleWhen: a condition comparing a select field to an option label (not its value) is reported where the author saves or publishes, in the same finding family as validation-condition-option-label, with the value it should be. Measure first whether each door already judges the condition. Where refusing a stored predicate is a narrowing, declare it and owe the maintainer's word as #39688 does.

Blocked-by: #39441

Request: triage (first-touch audit).

Activity

  1. added
    bug
    priority:p2
    on Dec 4, 2026
  2. objectstack-fleet commented on Dec 4, 2026

    @objectstack-fleet
    ContributorAuthor

    triage@hotlong · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:build · domain:server · Bug · p2 · pm:queue · size S, touched 2026-12-04T15:16Z. Rationale: requiredWhen, readonlyWhen and option visibleWhen comparing a select field to an option label silently never apply, so a field meant to be required, read-only or hidden is not. Impeded on the build path, so p2 as filed; same class as #39441 (validation conditions, PR #39688). The claimant measures each predicate's door first. Issue type set to Bug.
    Grade: p2 · size S · claimable.

  3. added
    domain:server
    pm:queue
    on Dec 4, 2026
  4. objectstack-fleet commented on Dec 5, 2026

    @objectstack-fleet
    ContributorAuthor

    triage@hotlong · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Grade: p2 → p1, on the maintainer's word in the triage report (2026-12-05T00:49Z). Ruling-ref: the maintainer's word above.

    Grade: p1 · reach: builders and the end users their rules protect, often · evidence: L1 7414492078 and L2 7414461872 on PR #39688 · original: priority:p2.

  5. added
    priority:p1
    and removed
    priority:p2
    on Dec 5, 2026
  6. objectstack-fleet commented on Dec 5, 2026

    @objectstack-fleet
    ContributorAuthor

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

    2026-12-05T01:41Z · seat intake on the maintainer's word 2026-12-05T00:26Z 「继续处理所有区的 p1」 (regraded p1 by triage 00:50Z). Built by zone ot-build; the seat posts the claim.

    Claim: PM loop round 20
    Session: session_01L9qibvqcHrQpENbRP7eLfU (zone ot-build; the dev is an os-dev subagent of that session)
    Account: os-tesla
    Branch: claude/issue-39722-predicate-option-label
    Worktree: objectstack-issue-39722
    Domain: domain:server
    Seat: repo:objectstack@os-tesla
    Area: ot-build
    File surface: step 0 is a measurement, with no code: for each of requiredWhen, readonlyWhen and option visibleWhen, which save/publish door already judges the condition, and where #39688's validation-condition-option-label finding lives. The zone restates the file surface in a Claim: amendment from that reading, before any edit. Stop on any breach.
    Container & model: M, mode:subagent, model: default, effort: high
    Clause-②: no (narrowing) — expected: refusing a stored predicate narrows an accept set; restated after step 0. Owes one CONTRACT_REVIEW_TIER review, the maintainer's approval as #39688 did, and needs:dogfood-battery.
    Metadata-protocol: narrowed (expected; restated after step 0)
    Ruling-ref: #39441 ruling 7403149741 and its precedent reading 7413097187 (refuse at the door, same finding family); triage regrade 00:50Z
    Responsibility: objectstack: the metadata doors that judge field predicates | #39688 refuses option labels in validation conditions only | every builder (human or AI) writing a field rule against a select
    Premise: holds at 56bed06 (#39688 merged 3c0e8b4; the three predicate kinds are not judged by it)
    Serial constraints cleared: #39688 merged. #39756's PR #39763 touches scripts/ci only.

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

    @objectstack-fleet
    ContributorAuthor

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

    2026-12-05T01:51Z · Claim amendment 1 to 7429539262, drafted by zone ot-build from the step-0 reading; the seat posts it. The forks Q1–Q3 are settled by precedent (#39688 / ruling 7403149741): a new exported finding id; field-level visibleWhen joins because the server reads it on required fields; parent.F is not judged.

    Claim: amendment 1 (step 0 measured at origin/main 56bed06; no edits yet)
    Session: session_01L9qibvqcHrQpENbRP7eLfU
    Branch: claude/issue-39722-predicate-option-label
    File surface: packages/lint/src/validate-validation-rule-option-labels.ts (reason: add the field-slot walk beside the #39688 rule, reusing its private helpers and the shared optionLabelComparisons matcher; no second matcher), packages/lint/src/index.ts (reason: export the new finding id, required by rule-explanations.test.ts for any explained id), packages/lint/src/rule-explanations/publish-time-inert-refusals.ts + packages/lint/src/rule-explanations.ts (reason: the os explain entry), packages/lint/src/authoring-rules.ts (reason: comment on the existing entry only; no new entry, rule count stays 91), packages/metadata-protocol/src/protocol.field-rule-option-label-gate.test.ts (reason: NEW real-door pin, 422 on object and object_extension; test only, no metadata-protocol src), packages/spec/src/migrations/entries/semantic/19.field-rule-option-label-refused.ts + packages/spec/src/migrations/semantic-relevance.test.ts + packages/spec/src/migrations/semantic-relevance-coverage-38929.test.ts (reason: ADR-0087 semantic ledger entry and its rows, as #39688 did); ⛔ not packages/metadata-protocol/src/protocol-save.ts; stop on breach
    Design: a new finding id field-rule-option-label emitted by the same module and the same AUTHORING_RULES entry as validation-condition-option-label (precedent: #39688 added its own exported id). Slots judged: field requiredWhen, readonlyWhen, options[].visibleWhen, plus field-level visibleWhen (the server reads it on required fields, rule-validator.ts:3710, so a label comparand waives the requirement; same defect, same walk). parent.F is not judged (as #39688). Display-only positions (fieldGroups visibleWhen, object uiReadonlyWhen, grid-column predicates) stay out of scope.
    Doors: lint authoring rules reach the metadata-protocol save/publish door (runtimeAuthoringRulesFor, runtime-gate.ts:827-831) and os validate/os build/os lint (author-time-rules.ts:139) with no door code change.
    Clause-②: yes (narrowing) (new exported rule-id constant from @objectstack/lint)
    Metadata-protocol: narrowed
    Changesets: minor @objectstack/lint, @objectstack/spec
    Upgrade: 0 label comparands in examples/** and packages/apps/** for these slots; ledger entry only, no rewrite.
    Owed: CONTRACT_REVIEW_TIER review, needs:dogfood-battery, maintainer approval. Serial: semantic-relevance-coverage-38929.test.ts row is shared with PR #39729 (#39661): whichever merges second merges main.

  9. objectstack-fleet commented on Dec 5, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@os-tesla · os-tesla · session_01L9qibvqcHrQpENbRP7eLfU
    os-dev-report

    {
      "issue": 39722,
      "status": "done",
      "branch": "claude/issue-39722-predicate-option-label",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/39788",
      "session": "session_01L9qibvqcHrQpENbRP7eLfU",
      "premise_still_valid": true,
      "summary": "Draft PR #39788 at head b679d3f5aa (pins b865e8f7d0 red, fix 0156426389, merge of origin/main 8fdb82ab17 with both coverage rows kept; the new entry file 19.field-rule-option-label-refused.ts does not collide with 19.pair-validation-rule-suffix.ts). Design B per amendment 7429702003: the #39441 module validate-validation-rule-option-labels.ts gains a field walk (objects[].fields and the non-stored objectExtensions entries' fields) over requiredWhen, readonlyWhen, field visibleWhen and options[].visibleWhen, reusing its private celSourceOf / writableOptionFields / record+previous reads and the shared optionLabelComparisons, emitting the new exported id field-rule-option-label from the same AUTHORING_RULES entry (rule count unchanged), with a per-slot consequence in the message, an os explain entry, the ADR-0087 semantic entry field-rule-option-label-refused with its two test rows, and a lint+spec minor changeset (BREAKING banner, FROM to TO table). parent.F is not judged and is named in the explanation's not-reported list. One known red: check:engine-double-contract wants scripts/engine-double-contract.pinned.json rewritten (--write) to record the 3 guarded doubles of the claimed new door file; that ledger is outside the binding surface, so it was not touched (stop on breach) and the seat owes a one-file surface amendment, or a decision to fold the door pins into protocol.runtime-authoring-gate.test.ts instead. Deviation from the claim's lint test layout: the lint pins went into the existing validate-validation-rule-option-labels.test.ts as a top-level describe (a test beside a claimed file, implicit), per AGENTS.md's shared-harness rule (ruling record 6583487846), instead of a new test file.",
      "tests": "Red at b865e8f7d0 before the rule: lint file 9 failed | 21 passed (30); door file 5 failed | 3 passed, each door failure 'null: expected { code: undefined, status: undefined } to deeply equal { code: INVALID_METADATA, status: 422 }' (save accepted), controls green. Green at b679d3f5aa: pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 -> Test Files 264 passed (264), Tests 10445 passed (10445); metadata-protocol vitest protocol.field-rule-option-label-gate.test.ts + protocol.runtime-authoring-gate.test.ts -> Tests 283 passed (283); spec vitest semantic-relevance.test.ts + semantic-relevance-coverage-38929.test.ts -> Tests 64 passed | 4 todo (68); cli vitest test/migrate-meta-engine-guidance.test.ts -> Tests 3 passed (3); lint typecheck and metadata-protocol typecheck exit 0 (VERDICT command-exit 0). Ablation: not separately run beyond the red/green pair (the pins were committed and run red against the unfixed tree, then green after the rebuild).",
      "gates": "dispatch-gates --commands (repo objectstack-ai/objectstack) derived 95 commands; all run on 0156426389, then re-derived (same 95) and re-run on b679d3f5aa, exit captured per command via redirect-then-capture. At b679d3f5aa: 91 of 92 in one sequential pass exit 0 (incl. check-adr-0087-registration --base origin/main, check-empty-changeset, check-changeset-no-major, check:docs-transcript-drift, check:dual-build-cjs-loads, check:lean-entry-closure, check:nul-bytes, check:issue-citations, check:doc-authoring, the spec check:* set, snapshot-next --self-test); check:query-options-erasure exit 0 ('ratchet holds ... none new'); check:type-check-debt exit 0 ('0 raw tsc error(s) total'); check:engine-double-contract EXIT 1 (3 RETAINED: the new door file's delete/findOne/update doubles not in scripts/engine-double-contract.pinned.json; fix is --write, outside the surface). check-comment-mask-corpus measured at 0156426389 only (25151 files, 0 disagree; 272s), not re-run after the merge: NOT MEASURED on b679d3f5aa. Pre-merge readings, superseded: snapshot-next --self-test exit 1 on 0156426389 (passed on b679d3f5aa; it touches none of these paths), the cli test and dual-build/lean-entry exit 1/3 for missing builds until the cli closure was built. --ran reconciliation not run as a separate command; every derived command is in the two run logs. PR check-runs: not yet read (report at local verification, per os-dev).",
      "mcp_calls": "0",
      "api_writes": "2 relay strokes: pr_create (objectstack-ai/objectstack, PR #39788, draft, assignee os-tesla; read-back 9712 bytes identical) and this os-dev-report comment on #39722 via post-stamped.mjs. Plus 3 git pushes (not REST). Reads: REST GETs of issue 39722, comments 7429539262, 7429702003, 7403149741, 7413097187, 7414461872, 7414492078, 7428364519, 7428337400, PR 39788.",
      "classifier_refusals": [],
      "open_questions": [
        {
          "question": "The new door file trips check:engine-double-contract until scripts/engine-double-contract.pinned.json records its 3 guarded doubles. That file is outside the binding surface. Which way should this go?",
          "options": [
            "A: amend the surface by one file (scripts/engine-double-contract.pinned.json, written only by node scripts/check-engine-double-contract.mjs --write) and push that one commit",
            "B: fold the door pins into protocol.runtime-authoring-gate.test.ts as a top-level describe, reusing its makeProtocol harness, which AGENTS.md's shared-harness rule (6583487846) prefers; this adds no double, needs no ledger write, and replaces the claimed new file"
          ],
          "recommendation": "B. It obeys the AGENTS.md shared-harness rule (which outranks os-dev's 1,000-line rule), removes a second copy of the sys_metadata double, and leaves the ledger untouched. It is one surface swap (the new file out, the harness file in) and about 100 moved lines."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · same-family display-only positions not judged: fieldGroups[].visibleWhen, object uiReadonlyWhen, grid-column readonlyWhen/requiredWhen (field.zod.ts:1450-1451), and parent.F comparands · noted in PR Acceptance notes, not filed · dedupe: 'fieldGroups visibleWhen label', 'uiReadonlyWhen option label', 'parent option label requiredWhen'",
        "carrier: seat · Skills-docs follow-up owed: skills/objectstack-data/SKILL.md (field rules section, line 78 onward) and skills/objectstack-formula/SKILL.md (server-evaluated predicates, line 75 onward) do not teach comparing with option values"
      ]
    }
  10. objectstack-fleet commented on Dec 5, 2026

    @objectstack-fleet
    ContributorAuthor

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

    2026-12-05T03:29Z · Claim amendment 2 to 7429539262 (after 7429702003), drafted by zone ot-build. The seat posts it.

    Claim: amendment 2 (surface swap, test files only; dev report 7431089465 on PR #39788 open question)
    Session: session_01L9qibvqcHrQpENbRP7eLfU
    Branch: claude/issue-39722-predicate-option-label (draft PR #39788)
    File surface: drops packages/metadata-protocol/src/protocol.field-rule-option-label-gate.test.ts; adds packages/metadata-protocol/src/protocol.runtime-authoring-gate.test.ts (reason: the real-door pins become a top-level describe reusing its makeProtocol harness, as AGENTS.md's shared-harness rule (ruling record 6583487846) asks; this removes a second copy of the sys_metadata engine double, so check:engine-double-contract stays green without a ledger write). The lint pins sit in the existing packages/lint/src/validate-validation-rule-option-labels.test.ts beside the claimed module (same rule). Overlap: check-handover --inflight on the added path: clear.

  11. objectstack-fleet commented on Dec 5, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack@os-tesla · os-tesla · session_01L9qibvqcHrQpENbRP7eLfU
    os-dev-report

    {
      "issue": 39722,
      "status": "done",
      "branch": "claude/issue-39722-predicate-option-label",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/39788",
      "session": "session_01L9qibvqcHrQpENbRP7eLfU",
      "premise_still_valid": true,
      "summary": "Delta round on claim amendment 2 (option B). New head 9e09ecb01b on draft PR #39788, after merging origin/main 881809cf53 as dd3613a2f1. The door pins now sit as a top-level describe in protocol.runtime-authoring-gate.test.ts and reuse its makeProtocol / makeStubEngine harness, with the same 8 cases. protocol.field-rule-option-label-gate.test.ts is deleted. The pinned ledger is untouched, and check:engine-double-contract exits 0. The PR body was patched through the relay: it now says Skills-docs: follow-up #39790, names the new door-pin location, and carries refreshed tests and gates. The attribution lines stay first and the signed trailer is last. The PR stays a draft.",
      "tests": "At 9e09ecb01b: lint vitest validate-validation-rule-option-labels.test.ts + rule-explanations.test.ts -> Tests 39 passed (39); metadata-protocol vitest protocol.runtime-authoring-gate.test.ts -> Tests 283 passed (283); metadata-protocol typecheck exit 0 (VERDICT command-exit 0). The full lint suite (10445 passed) and the spec ledger tests (64 passed, 4 todo) are readings from b679d3f5aa; no lint or spec source changed since.",
      "gates": "At 9e09ecb01b, dispatch-gates --commands re-derived the same 95 commands. check:engine-double-contract exit 0. 91 of the 92 commands in one pass exit 0; the three long sweeps were run separately. check:dual-build-cjs-loads exit 3 NOT MEASURED, because the fresh worktree had no full build; it exited 0 on b679d3f5aa and CI runs it. check:query-options-erasure exit 0 ('ratchet holds ... none new'). check:type-check-debt exit 0 ('0 raw tsc error(s)'). check-comment-mask-corpus was measured at 0156426389 only.",
      "mcp_calls": "0",
      "api_writes": "2 relay strokes this round: issue_patch of the PR #39788 body (read-back 9491 bytes, identical) and this delta comment through post-stamped.mjs. 1 git push (9e09ecb01b), which is not a REST write.",
      "classifier_refusals": [],
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": []
    }
  12. objectstack-fleet commented on Dec 5, 2026

    @objectstack-fleet
    ContributorAuthor

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

    2026-12-05T05:12Z · zone ot-build · Tidy: PR #39788 merged as ef4e8c5b5ab2246475185915aa9d5604d5824f04; the card closed completed. Reviews at 9e09ecb01b: L2 PASS 7431768650, L1-a ACCEPT 7432047597, dogfood battery green, maintainer approval via os-zhuang. Follow-ups filed by the seat: Skills-docs #39790, display-only predicate positions #39792. pm:dispatched removed in this stroke.

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

Metadata

Metadata

Assignees

Labels

area:buildbugdomain:serverpriority:p1

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions