Skip to content

fix(lint)!: refuse a field rule that compares a choice field with an option label - #39788

Merged
os-zhuang merged 5 commits into
mainfrom
claude/issue-39722-predicate-option-label
Dec 5, 2026
Merged

os-zhuang merged 5 commits into
mainfrom
claude/issue-39722-predicate-option-label

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Tesla · project thread

Fixes #39722
Ruling-ref: 7403149741

Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #39790

维护者速读

  • 用户能看到什么变化:管理员或替他搭应用的 AI 在字段上写「何时必填」「何时只读」「何时显示」或某个下拉选项「何时可选」的条件时,如果把下拉、单选、多选字段的显示名当成值写(例如写「Urgent」而记录里存的是「urgent」),以前照常保存、条件永远不生效(取反写法则对每条记录都生效),现在校验、构建和发布时当场报错,并告诉他该写哪个值。
  • 为什么做:属于「把选项显示名当值写」这一类问题的收口,流程条件和对象校验规则已经这样处理,这次补上字段自身的条件(替用接口、手写条件或旧表单配置字段规则的管理员解决)。
  • 出错会怎样:已经存着这类字段条件的对象,下一次发布会被挡下,哪怕这次改的是别的地方,直到把显示名改成值或删掉这个条件为止(字段条件没有「停用」开关);对象照常加载、条件照常按旧样子执行;草稿照常保存;已发布的示例应用与软件包里没有这样的条件,客户环境里存着的没有测过;撤回这一个改动即可恢复原样。
  • 要你做什么:确认这是一个破坏性收紧(包括上面这条「已有对象下次发布被挡」),并在合并前给出同意。

What changes

A field rule whose predicate compares a select / radio / multiselect / checkboxes field with one of its option labels, where the record holds the option's value, is refused as field-rule-option-label (error), naming the field, the label written and the value to write. It is the field-rule sibling of validation-condition-option-label (#39441, PR #39688), under the same ruling (7403149741, option A: the label comparand only, the value named).

  • Slots judged: a field's requiredWhen, readonlyWhen and visibleWhen, and each option's visibleWhen, on an object's own fields and on the fields an objectExtensions entry adds. The server evaluates all four against the stored row merged with the write (rule-validator.ts: requiredWhen and readonlyWhen on every write, an option's visibleWhen on a write that picks it, a field's visibleWhen on a required field), and the form evaluates them against option values too. So with == / in the field is never required, never locked, never shown, the option never offered (a write picking it refused); with != / a negated in the opposite holds on every row. The message names that consequence per slot.
  • No second matcher, no new registry entry: the judgement lives in the validation rules: saving a condition whose literal is not one of a choice field's option values is warned about (save-time half of #39405) #39441 module (validate-validation-rule-option-labels.ts), reusing its private helpers (celSourceOf, writableOptionFields, the record.F / previous.F reads) and the shared reading in flow-select-options.ts (indexSelectOptions, optionLabelComparisons). It is emitted by the same AUTHORING_RULES entry (validateValidationRuleOptionLabels), so its doors are that entry's: os validate, os build, os lint, and the metadata publish door for object and object_extension writes (saveMetaItem active / publishMetaItem, 422 INVALID_METADATA). The author-time rule count is unchanged; no code in metadata-protocol moves.
  • New export: FIELD_RULE_OPTION_LABEL from @objectstack/lint (required by rule-explanations.test.ts for any explained id), hence Clause-②: yes. os explain field-rule-option-label has its entry.
  • Not judged: a parent.FIELD read (the master record's field, another object's options); the membership spelling 'L' in record.F; a label that is also some option's value; a literal that is neither; a readonly choice field; a picklist-bound field; a field two extensions both declare; a label holding a quote or a backslash; a non-CEL dialect; display-only predicates outside a field (fieldGroups[].visibleWhen, an object's uiReadonlyWhen).
  • Stored rows: a stored object or extension carrying the shape still loads and its rule evaluates as before; its next publish is refused, even when the edit is unrelated, until the value is written or the predicate dropped. A field rule has no active: false, so unlike validation rules: saving a condition whose literal is not one of a choice field's option values is warned about (save-time half of #39405) #39441 there is no switch-off exit. A draft save is not refused at the save.
  • ADR-0087: semantic entry field-rule-option-label-refused (packages/spec/src/migrations/entries/semantic/19.field-rule-option-label-refused.ts) with its rows in semantic-relevance.test.ts and the FIELD site of semantic-relevance-coverage-38929.test.ts. Changeset @objectstack/lint and @objectstack/spec minor, BREAKING banner and a FROM → TO table. Upgrade: 0 label comparands in these slots in examples/** and packages/apps/**, so the entry stays a TODO with no conversion.

Read first, by risk:

  1. packages/lint/src/validate-validation-rule-option-labels.ts: walkFieldSites / judgeFieldRules (which fields are walked, extension entries located at the entry, stored entries skipped).
  2. packages/metadata-protocol/src/protocol.runtime-authoring-gate.test.ts, its #39722 block: the real-door envelope on both write types.
  3. .changeset/39722-field-rule-option-label.md: the narrowing as customers will read it.

Two-minute check: pnpm --filter @objectstack/lint exec vitest run src/validate-validation-rule-option-labels.test.ts should print 30 passed, among them the #39722 block's four slot paths objects.fx_ticket.fields.note.requiredWhen / .readonlyWhen / .visibleWhen / objects.fx_ticket.fields.channel.options[0].visibleWhen.

Tests

Red first (commit b865e8f7d0, pins only, before the rule): the lint block failed 9 of its pins and the door pins failed their 5 refusal cases. Each door failure read null: expected { code: undefined, status: undefined } to deeply equal { code: 'INVALID_METADATA', … }, meaning the save was accepted; the 3 controls passed. At 9e09ecb01b the door pins moved, unchanged in their cases, into the #39722 block of protocol.runtime-authoring-gate.test.ts, reusing its makeProtocol / makeStubEngine harness. The separate file and its own copy of the sys_metadata double are deleted.

Unit and door pins

On 9e09ecb01b:

  • pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/validate-validation-rule-option-labels.test.ts src/rule-explanations.test.ts: Tests 39 passed (39).
  • pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2 src/protocol.runtime-authoring-gate.test.ts: Tests 283 passed (283).
  • pnpm --filter @objectstack/metadata-protocol typecheck: exit 0.

On b679d3f5aa (no lint or spec source changed since):

  • pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2: Test Files 264 passed (264), Tests 10445 passed (10445).
  • pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/migrations/semantic-relevance.test.ts src/migrations/semantic-relevance-coverage-38929.test.ts: Tests 64 passed | 4 todo (68).
  • pnpm --filter @objectstack/lint typecheck: exit 0.

Acceptance notes

Verification

Gate families derived by node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --commands: the same 95 commands on every head. They were re-run on 9e09ecb01b, after merging origin/main (881809cf53).

Results on 9e09ecb
  • pnpm check:engine-double-contract: exit 0, no ledger write. This was the red Engine test-double contract gate on b679d3f5aa.
  • 91 of 92 commands in one sequential pass exit 0 (the three long sweeps are below), the engine-double gate among them, and also check-adr-0087-registration --base origin/main, check-empty-changeset, check-changeset-no-major, check:docs-transcript-drift, check:lean-entry-closure, check:nul-bytes, check:issue-citations, check:doc-authoring, the @objectstack/spec check:* set, and the cli migrate-guidance test.
  • pnpm check:dual-build-cjs-loads: exit 3, NOT MEASURED. This worktree had not run a full pnpm build, and the gate says so itself ("This is NOT a pass: nothing was measured"). It exited 0 on b679d3f5aa, and CI runs it.
  • pnpm check:query-options-erasure: ✓ … ratchet holds … none new. pnpm check:type-check-debt: exit 0, 0 raw tsc error(s) total.
  • node scripts/check-comment-mask-corpus.mjs was measured on 0156426389 only (25151 files, 0 disagree).

🤖 Generated with Claude Code

https://claude.ai/code/session_01L9qibvqcHrQpENbRP7eLfU

… (red)

A field's requiredWhen, readonlyWhen and visibleWhen, and an option's
visibleWhen, that compare a choice field with an option label save today
and never apply. Pins at the lint rule (each slot, negated comparands,
extensions, the build/door parity, what is not judged) and at the real
saveMetaItem door on object and object_extension writes. Red until the
rule lands.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvqcHrQpENbRP7eLfU
…option label

A field's requiredWhen, readonlyWhen and visibleWhen, and an option's
visibleWhen, are evaluated against the stored record, where a choice field
holds the option value; a label comparand never matches, so the rule never
applies (or, negated, applies to every record). The option-label rule now
judges these slots with the same reading and reports them as
field-rule-option-label at os validate, os build, os lint and the object /
object_extension publish door. parent.F reads are not judged. ADR-0087
semantic entry field-rule-option-label-refused with its relevance rows.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvqcHrQpENbRP7eLfU
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 5, 2026
@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/lint, @objectstack/spec, touching 23 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/lint/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

44 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json 881809cf53e394c59704cb9ba100386fba74804a.

⛔ 19 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 changed file(s) yielded no anchor (packages/lint/src/index.ts) — pages documenting those are invisible to this run
  • 1 cross-cutting symbol(s) contributed no route anchor: basePath (8 routes)
  • 1 anchor(s) matched too much of the corpus to be a work list: objectName (symbol, 62 pages)
  • 7 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 71 of 255 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 185 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 881809cf53e394c59704cb9ba100386fba74804a → packageMentionDocs.

Which tree this was computed on

This run read content/docs from d45d5cba8c6d194c9d8bc33beb71ffe76a07a280 — the merge of head 9e09ecb01bd32e73d8118747c47a0991c3eae8c9 into base 881809cf53e394c59704cb9ba100386fba74804a, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin d45d5cba8c6d194c9d8bc33beb71ffe76a07a280 && git checkout d45d5cba8c6d194c9d8bc33beb71ffe76a07a280
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 881809cf53e394c59704cb9ba100386fba74804a 9e09ecb01bd32e73d8118747c47a0991c3eae8c9 && git checkout -B drift-repro 881809cf53e394c59704cb9ba100386fba74804a && git merge --no-ff 9e09ecb01bd32e73d8118747c47a0991c3eae8c9

node scripts/docs-audit/affected-docs.mjs --json 881809cf53e394c59704cb9ba100386fba74804a

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 881809cf53e394c59704cb9ba100386fba74804a → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

2026-12-05T03:31Z · zone ot-build · Lint · ESLint is red at b679d3f5aa on one gate step only: "Engine test-double contract gate". The new door test file protocol.field-rule-option-label-gate.test.ts adds three guarded engine doubles the pinned ledger does not record (dev report 7431089465, open question). Fix on the way, test files only: the door pins move into the existing protocol.runtime-authoring-gate.test.ts as a top-level describe reusing its harness (AGENTS.md shared-harness rule, ruling record 6583487846), so no new double and no ledger write. Pending the claim amendment for that surface swap.


Generated by Claude Code

…nto the shared harness

The real-door pins for field-rule-option-label move into
protocol.runtime-authoring-gate.test.ts as a top-level describe that reuses
its makeProtocol / makeStubEngine harness, beside the validation-rule block,
and the separate file with its own copy of the sys_metadata double is
deleted. Same cases: the three field slots and an option's visibleWhen
refused 422 at the object door, the value control, the draft control, and
the object_extension refusal and control.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvqcHrQpENbRP7eLfU
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract-review-claim: session_01L9qibvPFnj3TkGq8ps2Jgv · head 9e09ecb · 2026-12-05T04:14Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

2026-12-05T04:15Z · zone ot-build · needs:dogfood-battery added: the PR declares Clause-②: yes (narrowing) (claim amendment 7429702003), so the battery must conclude success at the head before L1-a ACCEPT (L1-a note, contract-review claim 7431694882).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 9e09ecb01bd32e73d8118747c47a0991c3eae8c9
Local-runs: none
Scope: packages/spec/src/migrations/entries/semantic/19.field-rule-option-label-refused.ts + packages/lint/src/validate-validation-rule-option-labels.ts, packages/lint/src/authoring-rules.ts, packages/lint/src/index.ts, packages/lint/src/rule-explanations.ts, packages/lint/src/rule-explanations/publish-time-inert-refusals.ts

Read for this record: card #39722 (body and all 7 comments), PR #39788 (body, 11-file list, net diff against main at merge base 881809cf53, 5 ahead and 0 behind), and the check-runs on the head. Code outside the diff was read in the head tree, never reviewed: flow-select-options.ts, object-graph.ts, validate-rule-compilability.ts, runtime-gate.ts (lint), protocol-authoring-gate.ts, rule-validator.ts, field.zod.ts, object.zod.ts, field-customization.ts, and the two sibling ADR-0087 entries. The rest of the diff (the two lint/protocol test files, the two spec ledger test rows, the changeset) is the lane seat's ACCEPT at TIER_DEFAULT.

Check-runs on the head: 64 success, 19 skipped, 0 failed. Three are still in_progress: Dogfood battery shard (1/3, 2/3, 3/3, opt-in). Every derived gate family that has concluded is green (Lint and Repo Gates, Type Check, Test Core 12/12, Test UI 16/16, Check Changeset, v18 → v19 source upgrade, Spec property liveness, Governed Surface Queue Guard, Dogfood Regression Gate). The battery owed by needs:dogfood-battery has not concluded; this record does not stand in for it.

① Derived judgments

  • Accept-set narrowing, object and object_extension publish: right. A field's requiredWhen / readonlyWhen / visibleWhen and an option's visibleWhen that compares a judgeable choice field of the same object, read as record.F or previous.F, with one of its option labels is now error. Declared as Clause-②: yes (narrowing) and Metadata-protocol: narrowed on the PR body and the changeset, with the ADR-0087 marker and entry.
  • Reaches both doors with no metadata-protocol source change: right. The diff touches one file under packages/metadata-protocol, a test. The existing registry entry carries surfaces: CLI_AND_RUNTIME, runtimeTypes: ['object', 'object_extension'], commands: ALL, and runtimeAuthoringRulesFor filters AUTHORING_RULES on exactly those two keys, so the new findings ride it. The real-door pins (saveMetaItem active, 422 INVALID_METADATA, both write types, draft not judged) are in the diff and Test Core is green.
  • Stored objects, next publish refused even on an unrelated edit: right, and declared. The door's differential charges a finding located on the written item whatever its stored self held; a sibling object's finding and a target's own finding on an extension write cancel in the baseline. Both directions are pinned in the lint test block.
  • Public surface, @objectstack/lint: right. New export FIELD_RULE_OPTION_LABEL; the exported type ValidationRuleOptionLabelFinding.rule widens from one literal to a union of two (a consumer that narrowed on the single literal sees a type change; covered by the same minor and the BREAKING banner). New os explain field-rule-option-label entry, registered in RULE_EXPLANATIONS.
  • Author-time rule count stays 91: right. 91 name: entries in authoring-rules.ts at the head; the diff adds a comment only.
  • @objectstack/spec: one new ADR-0087 semantic entry, no schema key added or removed: right. No tombstone is owed; a TODO with no D2 conversion matches the sibling entry and the stated reason (rewriting the literal changes behaviour, the author's call).
  • Occurrence parity with the validation rules: saving a condition whose literal is not one of a choice field's option values is warned about (save-time half of #39405) #39441 sibling: right. Every place the head names validation-condition-option-label or its constant has the matching field-rule-option-label site (module, index export, explanation, door test, ledger rows, entry, changeset).

② Semver level

.changeset/39722-field-rule-option-label.md: @objectstack/lint minor and @objectstack/spec minor, title fix(lint)!:, a BREAKING banner, a FROM/TO table, the adr-0087: registered field-rule-option-label-refused marker. This matches what the diff publishes (a new export and explain entry in lint, a new migration entry in spec) and is the level the sibling .changeset/39441-validation-condition-option-label.md shipped the same kind of narrowing at; Check Changeset is green on the head.

Clause-②: yes (narrowing). The line is on the PR body and on the changeset, and it is correct: the diff both adds public surface (FIELD_RULE_OPTION_LABEL) and narrows an accept set. The maintainer's approval of the breaking narrowing is still owed, as the PR body says.

③ Boundary flags

  • Dev open question (report 7431089465): the engine-double ledger, option A or B. Answered by claim amendment 2 (7431120023), option B. Verified in the tree: protocol.field-rule-option-label-gate.test.ts is not in the file list, the door pins are a top-level describe in protocol.runtime-authoring-gate.test.ts, no file under scripts/ is in the diff, and the lint gate job that holds the engine-double contract is green on this head. Delta report 7431677814 carries no open question.
  • Out-of-scope finding, Skills-docs. Carried: follow-up skills: field-rule predicates compare a select to its option value, not its label (Skills-docs follow-up of #39722) #39790 is open and is named on the PR body.
  • Out-of-scope finding, the display-only family (fieldGroups[].visibleWhen, object uiReadonlyWhen, grid-column readonlyWhen / requiredWhen, parent.F), reported as "carrier: none, not filed". Escalated to the seat: it has no card. See N1, which adds the positions the report does not name.
  • Surface check. The diff stays inside the amended file surface (amendments 1 and 2); protocol-save.ts is untouched.
  • SQL push-down. Not applicable: the change is a pure function over metadata in @objectstack/lint; no query, no id materialisation, no in-app join.
  • Observation outside the diff, for the seat (not a finding on this head). The registry entry runs validateValidationRuleOptionLabels(stack) without the door's ctx.storedObjectExtensions, so at the object_extension door the "field two object extensions both declare" exclusion sees only the entries the stack itself carries; another package's stored extension is already folded into the served objects as plain fields. This is how validation rules: saving a condition whose literal is not one of a choice field's option values is warned about (save-time half of #39405) #39441 shipped and the new walk inherits it unchanged. It needs two packages declaring the same choice field on one target with different options to matter. Read from the code, not measured.

④ Design judgment

packages/spec/src/migrations/entries/semantic/19.field-rule-option-label-refused.ts (hits). Holds against the ruling it implements (7403149741, option A: the label comparand only, the value named) and against its first consumer, the lint rule in this diff.

  • surface: the four slots, both carriers (objects[].fields, objectExtensions[].fields), the two roots and the five comparand spellings are what judgeFieldRules and the shared optionLabelComparisons read. Each "Not the shape" item maps to code: parent.F (VALIDATION_RULE_READS roots are record and previous, bare: false), 'L' in FIELD (not a comparand form of comparandsOf), label that is also a value and tied fields and shared picklists (selectOptionsOf / indexSelectOptions), a readonly field (writableOptionFields), quote or backslash (QUOTED), non-CEL dialect (celSourceOf).
  • replacement and acceptanceCriteria: "write the value, or drop the predicate" is the whole exit, and it is said plainly; there is no active: false for a field rule and the entry does not promise one. "Still loads and evaluates as before; next publish refused" is what the door differential does.
  • reason: the per-slot consequences agree with rule-validator.ts and field.zod.ts as read (requiredWhen and readonlyWhen on the write path; an option's visibleWhen refusing a write that picks it; a field's visibleWhen making a required field required only when shown).
  • Stands apart from the two existing entries. Distinct id and file. 19.validation-condition-option-label-refused covers validations[] condition / when and exits through active: false; this one covers field slots and has no such exit, and says so. 19.pair-validation-rule-suffix is about the names of rules a .custom extension adds and shares no shape with it. A stack carrying both label mistakes gets two TODOs, one per finding id, which is correct. The relevance (stack-declares objects, objectExtensions) equals the sibling's and both ledger test rows are present.

packages/lint/src/validate-validation-rule-option-labels.ts (implementing). The code agrees with its jsdoc and with the entry, sentence by sentence, with the two nits below.

  • Slots: FIELD_SLOTS is exactly requiredWhen, readonlyWhen, visibleWhen; each record entry of field.options is read for visibleWhen. Bare-string options and non-record members are skipped.
  • Carriers: recordsOf(stack.objects) then objectExtensionsByTarget(stack), the same two sources and the same location convention (objects.NAME.fields.F.SLOT, ENTRYPATH.fields.F.SLOT) as walkObjectValidationRules, so the two halves cannot disagree about which objects and entries exist. Options are resolved for the field's own object (an extension's target), from the served fold, so an extension field's rule is judged against the target's choice fields and its own added ones.
  • parent.F is left unjudged by construction (roots), and pinned. fieldPatches cannot carry any of the four slots (BASE_FIELD_DISPLAY_WHITELIST is label, description, inlineHelpText, placeholder, and an option's label), so no slot hides there.
  • Attempts to break it that held: the validation half's early return moved but is equivalent (no rules means an empty walk); the two ids never cross (pinned); the negated consequence strings are right per slot; the envelope spelling and the array spelling of fields are read; no second matcher exists.
  • Id, explanation and switch-off stay distinct under one registry entry: findings carry their own rule, each id has its own os explain entry, and the registry has no per-entry switch that would silence both (gating tier, no suppression list). active: false silences only the validation half, keyed on the rule record; the field half never reads it. The author's way out for a field rule is to write the value or drop the predicate; a draft save is not refused, so work is not lost meanwhile.

authoring-rules.ts, index.ts, rule-explanations.ts, rule-explanations/publish-time-inert-refusals.ts (implementing). The entry comment, the export and the explanation say what the module does. The explanation's reported list and not-reported list match the code, and covers meets the test's shape (under 60 characters, no full stop).

No must-fix, no should-fix.

Nits (no effect on correctness or the contract; none is to be fixed in code on this head):

  • N1 (nit) — The module jsdoc calls the unjudged display-only predicates "outside a field (fieldGroups[].visibleWhen, an object's uiReadonlyWhen)". A FIELD also carries display-only predicates over the same record scope that this walk does not read and no list names: Field.uiReadonlyWhen, Field.settledWhen, Field.conditionalFormatting[].condition (field.zod.ts). The rule's stated list of judged slots is exact, so nothing is misreported; the same label trap stays open on those keys. Disposition: one follow-up card for the display-only family, naming these three beside the positions the dev report listed with no carrier.
  • N2 (nit) — walkFieldSites skips entries marked stored, but the rule calls objectExtensionsByTarget(stack) with no stored list, so no entry is ever marked and the guard cannot fire. Harmless; it would become live only if the entry were handed ctx.storedObjectExtensions (see the ③ observation). Disposition: accepted deviation, or folded into that follow-up.
  • N3 (nit) — The exit is given as "write the value, or drop the predicate". For the negated spelling the rule held on every record, so dropping the predicate changes behaviour too; the behaviour-keeping rewrite there is the constant (required: true / readonly: true). The changeset is a prose face and may say so; the entry is left as it is.

Implemented-by: claude/issue-39722-predicate-option-label
Reviewed-by: session_01L9qibvPFnj3TkGq8ps2Jgv (isolated sub-agent)

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

Filled brief handed to the isolated at-tier reviewer whose record is the comment above (adopted by this L1-a thread):

Contract review brief — PR #39788 @ 9e09ecb01bd32e73d8118747c47a0991c3eae8c9 (card #39722)

You review at CONTRACT_REVIEW_TIER. Render ONE ## Contract review record on this head — its shape is
node scripts/pm/record-recognisers.mjs --template --paths packages/spec/src/migrations/entries/semantic/19.field-rule-option-label-refused.ts — with a PASS or FAIL verdict, and post it as ONE comment
on the PR or its card.

Inputs — these and nothing else:
· card #39722: its body and EVERY comment (rulings and earlier records included)
· PR #39788: its body, its file list, and the net diff against main at 9e09ecb01bd32e73d8118747c47a0991c3eae8c9
· the check-runs on 9e09ecb01bd32e73d8118747c47a0991c3eae8c9: their conclusions ARE the gate verdicts
⛔ Not the dispatch order, ⛔ not the dispatching seat's own conclusions — this brief is adversarial by design.

Scope — the paths reviewFace returns as hits on this PR's file list: packages/spec/src/migrations/entries/semantic/19.field-rule-option-label-refused.ts;
plus every file IN THIS DIFF that directly implements or enforces them — the gate that enforces a rule, the code
a jsdoc or schema line describes, the validator a skill teaches — reviewed for agreement with the contract.
Widen it freely, ⛔ never below hits; the record's Scope: line names the implementing files apart from hits.
The rest of the diff (tests, unrelated modules, lockfiles, generated output, changesets) is the lane seat's
ACCEPT at TIER_DEFAULT, exactly as a standalone PR of those files.
④ judges the hits files and those implementing files ONLY:
lockfiles, generated output, changesets and prose elsewhere in the PR are not reviewed;
code outside the diff is READ to judge them, never reviewed.

⛔ READ-ONLY. No worktree, no checkout, no build, no test run, no gate re-run, no ablation: the check-runs
on the head already answered every derived gate family, and a local run costs more than it returns.
If ONE probe is unavoidable, the record's Local-runs: line says probe — REASON; otherwise none.
Scratch space is /tmp/claude-0/-home-user/f90b304d-2703-5b33-b155-97489671c85a/scratchpad/pr-39788/ alone; nothing there you did not write this round is read.

Judge, in the record's own sections:
① Derived judgments — every accept-set and public-surface change the diff implies, each named right or wrong.
② Semver level — the changeset (or skip-changeset) matches what the diff publishes, and the Clause-②: line.
③ Boundary flags — every dev flag and every open_questions entry answered, or escalated.
On every face, SQL push-down: a new id materialisation or in-app join where SQL could push down is a
finding unless a reason is given (AGENTS.md, Prime Directive 5: SQL first).
④ Design judgment — for EVERY hits file: does the change hold against the code it cites and the
scenario it is accepted against? A skill file against the card's eval prompt and the spec it teaches
on main; a schema file against the ruling or ADR it implements and its first consumer; an ADR
against its first consumer and its execution plan. For EVERY implementing file in the diff: does the
code agree with the contract, sentence by sentence? Read the cited code in the live tree, and try to
break the design.
Grade each finding must-fix, should-fix or nit — a nit has no effect on correctness or the contract.
A must-fix is a FAIL; a must-fix or should-fix earns a delta review of its fix; nits alone end the round.
Spell a must-fix or should-fix with its id and grade, S1 (should-fix) — …, and a clean round as
No must-fix, no should-fix.: the queue guard reads a graded finding as OPEN on this head and
refuses the record; the delta record names those it closes by id alone, S1: closed.
A nit is fixed only on the prose faces, or left as an accepted deviation or a follow-up card: a fix
anywhere else moves the head, and this record no longer covers it.
⛔ Judge the tree, never the PR body's account of it.
Sign Implemented-by: with the dev's branch and Reviewed-by: with your session id — the value is the FIRST
thing after each colon.

The PR declares Clause-②: yes (narrowing) and Metadata-protocol: narrowed; it adds the lint rule
field-rule-option-label in packages/lint/src/validate-validation-rule-option-labels.ts (wired through
authoring-rules.ts / index.ts) and reaches the save/publish door and os validate through the existing
runtimeAuthoringRulesFor path. Those are implementing files. Questions the owning zone asked to have judged:
· does the rule judge field requiredWhen / readonlyWhen / visibleWhen and options[].visibleWhen on objects and
non-stored object_extensions exactly, leaving parent.F unjudged, and does it really reach both doors with no
metadata-protocol source change?
· does reusing #39441's module and AUTHORING_RULES entry (count stays 91) keep each rule's id, explanation and
switch-off semantics distinct? (a field rule has no active: false; what is the author's way out?)
· does the new ADR-0087 entry stand apart from the existing 19.validation-condition-option-label-refused and
19.pair-validation-rule-suffix entries?

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

L1-a · ACCEPT · #39788 @ 9e09ecb01b · Area: ot-build · read 2026-12-05T04:42Z

  • L2: I adopt at-tier record 7431768650 (CONTRACT_REVIEW_TIER, PASS, no must-fix, no should-fix, nits N1–N3) and its filled brief 7431773289 (claim 7431694882). The independence pair holds.
  • Card fit: field rules: requiredWhen, readonlyWhen and option visibleWhen comparing a select to an option label never apply #39722 asks for the sibling trap of validation rules: saving a condition whose literal is not one of a choice field's option values is warned about (save-time half of #39405) #39441 on field predicates. The new rule field-rule-option-label judges exactly field requiredWhen / readonlyWhen / visibleWhen and each option's visibleWhen, on objects and object_extensions. parent.F is left unjudged by construction and pinned. Both doors are reached through the existing runtimeAuthoringRulesFor entry (object, object_extension, CLI and runtime) with no metadata-protocol source change. The door pins (422 INVALID_METADATA on both types, draft not judged) are green. Fixes #39722 is right.
  • Distinct from validation rules: saving a condition whose literal is not one of a choice field's option values is warned about (save-time half of #39405) #39441's rule: each finding carries its own id and os explain entry, and a test pins that the two never cross. active: false silences only the validation half. A field rule's way out is to write the value or drop the predicate. The rule count stays 91. ADR-0087 entry 19.field-rule-option-label-refused stands apart from 19.validation-condition-option-label-refused and 19.pair-validation-rule-suffix, and both ledger rows are present.
  • Declarations: Clause-②: yes (narrowing) and Metadata-protocol: narrowed, with @objectstack/lint and @objectstack/spec minor carrying a BREAKING banner and FROM→TO. ValidationRuleOptionLabelFinding.rule widens to a two-literal union. Skills-docs: follow-up #39790. 0 label comparands in examples, apps and hotcrm.
  • Nits (accepted deviations):
    • N1: uiReadonlyWhen, settledWhen and conditionalFormatting[].condition are not read and not named. The display-only family needs one follow-up card, which the seat files.
    • N2: the if (stored) continue guard cannot fire.
    • N3: for a negated predicate the behaviour-keeping rewrite is required: true / readonly: true. Only the changeset may say so.
  • Not a finding: the entry does not pass ctx.storedObjectExtensions, so the "field declared by two extensions" exclusion sees only the stack's own entries at the object_extension door. validation rules: saving a condition whose literal is not one of a choice field's option values is warned about (save-time half of #39405) #39441 shipped the same way.
  • Gates at 9e09ecb01b (l1-face.mjs --pr 39788): 68 success · 14 expected skip · 0 failed · 0 pending. Dogfood battery (opt-in) is success (run 145548283932). The @objectstack/metadata-protocol changeset flag is benign, since only a test is touched. The "unexpected skip" is the queue-only Dogfood Regression Gate (…/4).

For the seat: the ! narrowing's per-PR maintainer approval is owed. The seat hands it to the maintainer through os-zhuang.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

维护者速读

Seat opinion: ACCEPT. It is design B as amended (7429702003): a new exported finding field-rule-option-label from the same module and the same AUTHORING_RULES entry as #39688, so the rule count stays at 91. It reaches the save/publish door and os validate with no door code change. Field-level visibleWhen is included because the server reads it on required fields. parent.F is not judged, matching #39688.

席位核对

ACCEPT · head 9e09ecb01bd32e73d8118747c47a0991c3eae8c9 · 2026-12-05T04:43Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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

2026-12-05T04:44Z · Hand-off: PR #39788 declares a narrowing and awaits the maintainer's approval; seat record above.

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Dec 5, 2026
@objectstack-fleet
objectstack-fleet Bot requested a review from os-zhuang December 5, 2026 04:44
@os-zhuang
os-zhuang marked this pull request as ready for review December 5, 2026 04:45
@os-zhuang
os-zhuang added this pull request to the merge queue Dec 5, 2026
Merged via the queue into main with commit ef4e8c5 Dec 5, 2026
95 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-39722-predicate-option-label branch December 5, 2026 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation needs:dogfood-battery pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants