Repository navigation
fix(lint)!: refuse a field rule that compares a choice field with an option label - #39788
Conversation
… (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
…edicate-option-label
📓 Docs Drift CheckThis PR changes 2 package(s): 44 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 19 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 185 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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
|
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibvqcHrQpENbRP7eLfU 2026-12-05T03:31Z · zone Generated by Claude Code |
…edicate-option-label
…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
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibvPFnj3TkGq8ps2Jgv Contract-review-claim: session_01L9qibvPFnj3TkGq8ps2Jgv · head 9e09ecb · 2026-12-05T04:14Z |
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibvqcHrQpENbRP7eLfU 2026-12-05T04:15Z · zone |
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibvPFnj3TkGq8ps2Jgv Contract reviewServed-tier: Read for this record: card #39722 (body and all 7 comments), PR #39788 (body, 11-file list, net diff against Check-runs on the head: 64 success, 19 skipped, 0 failed. Three are still ① Derived judgments
② Semver level
Clause-②: yes (narrowing). The line is on the PR body and on the changeset, and it is correct: the diff both adds public surface ( ③ Boundary flags
④ Design judgment
No must-fix, no should-fix. Nits (no effect on correctness or the contract; none is to be fixed in code on this head):
Implemented-by: VERDICT: PASS |
|
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 @
|
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibvPFnj3TkGq8ps2Jgv L1-a · ACCEPT · #39788 @
For the seat: the |
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibxjHbaJSwcu6suJxbB 维护者速读
Seat opinion: ACCEPT. It is design B as amended (7429702003): a new exported finding 席位核对ACCEPT · head
|
|
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. |
Requested by Tesla · project thread
Fixes #39722
Ruling-ref: 7403149741
Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #39790
维护者速读
What changes
A field rule whose predicate compares a
select/radio/multiselect/checkboxesfield with one of its option labels, where the record holds the option's value, is refused asfield-rule-option-label(error), naming the field, the label written and the value to write. It is the field-rule sibling ofvalidation-condition-option-label(#39441, PR #39688), under the same ruling (7403149741, option A: the label comparand only, the value named).requiredWhen,readonlyWhenandvisibleWhen, and each option'svisibleWhen, on an object's own fields and on the fields anobjectExtensionsentry adds. The server evaluates all four against the stored row merged with the write (rule-validator.ts:requiredWhenandreadonlyWhenon every write, an option'svisibleWhenon a write that picks it, a field'svisibleWhenon arequiredfield), and the form evaluates them against option values too. So with==/inthe field is never required, never locked, never shown, the option never offered (a write picking it refused); with!=/ a negatedinthe opposite holds on every row. The message names that consequence per slot.validate-validation-rule-option-labels.ts), reusing its private helpers (celSourceOf,writableOptionFields, therecord.F/previous.Freads) and the shared reading inflow-select-options.ts(indexSelectOptions,optionLabelComparisons). It is emitted by the sameAUTHORING_RULESentry (validateValidationRuleOptionLabels), so its doors are that entry's:os validate,os build,os lint, and the metadata publish door forobjectandobject_extensionwrites (saveMetaItemactive /publishMetaItem, 422INVALID_METADATA). The author-time rule count is unchanged; no code inmetadata-protocolmoves.FIELD_RULE_OPTION_LABELfrom@objectstack/lint(required byrule-explanations.test.tsfor any explained id), henceClause-②: yes.os explain field-rule-option-labelhas its entry.parent.FIELDread (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; areadonlychoice 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'suiReadonlyWhen).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.field-rule-option-label-refused(packages/spec/src/migrations/entries/semantic/19.field-rule-option-label-refused.ts) with its rows insemantic-relevance.test.tsand the FIELD site ofsemantic-relevance-coverage-38929.test.ts. Changeset@objectstack/lintand@objectstack/specminor, BREAKING banner and a FROM → TO table. Upgrade: 0 label comparands in these slots inexamples/**andpackages/apps/**, so the entry stays a TODO with no conversion.Read first, by risk:
packages/lint/src/validate-validation-rule-option-labels.ts:walkFieldSites/judgeFieldRules(which fields are walked, extension entries located at the entry, stored entries skipped).packages/metadata-protocol/src/protocol.runtime-authoring-gate.test.ts, its#39722block: the real-door envelope on both write types..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.tsshould print 30 passed, among them the#39722block's four slot pathsobjects.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 readnull: expected { code: undefined, status: undefined } to deeply equal { code: 'INVALID_METADATA', … }, meaning the save was accepted; the 3 controls passed. At9e09ecb01bthe door pins moved, unchanged in their cases, into the#39722block ofprotocol.runtime-authoring-gate.test.ts, reusing itsmakeProtocol/makeStubEngineharness. The separate file and its own copy of thesys_metadatadouble 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
describein 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 test file, and the door pins are a top-leveldescribeinprotocol.runtime-authoring-gate.test.ts(claim amendment 2). No engine-double ledger changes.fieldGroups[].visibleWhen, an object'suiReadonlyWhen, and the grid-columnreadonlyWhen/requiredWhen(display-only), andparent.Fcomparands.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 on9e09ecb01b, after mergingorigin/main(881809cf53).Results on 9e09ecb
pnpm check:engine-double-contract: exit 0, no ledger write. This was the redEngine test-double contract gateonb679d3f5aa.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/speccheck:*set, and the cli migrate-guidance test.pnpm check:dual-build-cjs-loads: exit 3, NOT MEASURED. This worktree had not run a fullpnpm build, and the gate says so itself ("This is NOT a pass: nothing was measured"). It exited 0 onb679d3f5aa, 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.mjswas measured on0156426389only (25151 files, 0 disagree).🤖 Generated with Claude Code
https://claude.ai/code/session_01L9qibvqcHrQpENbRP7eLfU