Skip to content

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

Todo

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.

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

Metadata

Metadata

Assignees

Labels

area:buildbugdomain:serverpm:dispatchedpriority:p1

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions