Repository navigation
fix(lint)!: refuse a validation rule that compares a choice field with an option label - #39688
Conversation
…h an option label Claude-Session: https://claude.ai/code/session_01L9qibySjU2ZFX7gNxAE2wX Co-authored-by: Claude <noreply@anthropic.com>
…ion-label validation condition Claude-Session: https://claude.ai/code/session_01L9qibySjU2ZFX7gNxAE2wX Co-authored-by: Claude <noreply@anthropic.com>
…oor rosters Claude-Session: https://claude.ai/code/session_01L9qibySjU2ZFX7gNxAE2wX Co-authored-by: Claude <noreply@anthropic.com>
…n the ADR-0087 ledger; changeset Claude-Session: https://claude.ai/code/session_01L9qibySjU2ZFX7gNxAE2wX Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibySjU2ZFX7gNxAE2wX Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 13 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 7 release-owned page(s) also name something this change touched. These are read-only:
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 db3466faf2abeed3d7ed2266b4c12fe28b408b3e && git checkout db3466faf2abeed3d7ed2266b4c12fe28b408b3e
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 09a1d7b94d8cd2234098a5eca13e04a48a783b84 2eb5a24ad2968144a0c2a1dec7328c5a6acd94ca && git checkout -B drift-repro 09a1d7b94d8cd2234098a5eca13e04a48a783b84 && git merge --no-ff 2eb5a24ad2968144a0c2a1dec7328c5a6acd94ca
node scripts/docs-audit/affected-docs.mjs --json 09a1d7b94d8cd2234098a5eca13e04a48a783b84
|
…ation rule at the real door A stored object already carrying a validation rule that compares an option label: an unrelated publish (a relabel) is refused on the unchanged rule, the same publish with active:false on the rule lands, and a draft save is not judged. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibySjU2ZFX7gNxAE2wX
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibvPFnj3TkGq8ps2Jgv Contract-review-claim: session_01L9qibvPFnj3TkGq8ps2Jgv · head 502f60a · 2026-12-04T14:24Z |
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibvPFnj3TkGq8ps2Jgv Contract reviewServed-tier: Read for this record: card #39441 body and all 8 comments (claim 7411143900 / 7411270954, reports 7412825775 and 7414205246, amendment 7412845318, reading 7413097187), PR #39688 body and its 18-file diff at the head, ruling 7403149741 (the ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgment
S1 (should-fix) — the Nits (no effect on correctness or the contract):
Answers to the two questions the owning zone asked:
S1 is open on this head; its fix moves the head and earns a delta review. The maintainer's word on the BREAKING narrowing and the dogfood battery remain owed and are outside what this record grants. 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 #39688 @
|
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibvPFnj3TkGq8ps2Jgv L1-a · REWORK · #39688 @
|
A validation rule with active: false silenced every rule whose config
path equalled or extended its own, and that path is built from `name`.
So a live rule sharing a switched-off rule's name (validations is an
array; nothing refuses a repeated name) was never judged, though it
refuses every write. The exemption now follows the walked records: the
switched-off rule and exactly the branches the walk hands right after
it. Pinned for a repeated top-level name, a repeated conditional with
the same branch path, and a repeated name in one extension entry.
Review nits on the same face: the finding no longer claims no record
holds the label; the explanation, ledger entry and changeset name the
comparand spellings reached and the ones not read ('L' in F), and the
ledger's not-the-shape list names the tied-extension field, the quoted
label and the non-CEL dialect the code also skips.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibySjU2ZFX7gNxAE2wX
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibvPFnj3TkGq8ps2Jgv Contract-review-claim: session_01L9qibvPFnj3TkGq8ps2Jgv · head 2eb5a24 · 2026-12-04T15:16Z |
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibvPFnj3TkGq8ps2Jgv Contract reviewServed-tier: Delta review of record 7414461872 (head ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentS1: closed How it was checked.
Each is pinned in No must-fix, no should-fix. Nits (no effect on correctness or the contract):
The earlier nits are answered: the message no longer claims no record holds the label; the three prose faces name the spellings reached (with
Implemented-by: VERDICT: PASS |
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibvPFnj3TkGq8ps2Jgv L1-a · ACCEPT · #39688 @
|
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibxjHbaJSwcu6suJxbB 维护者速读
Seat opinion: ACCEPT. The republish-is-judged mode matches the door's governing text (reading 7413097187), and 席位核对ACCEPT · head
|
|
repo:objectstack@os-tesla · os-tesla · session_01L9qibxjHbaJSwcu6suJxbB 2026-12-04T15:21Z · Hand-off: PR #39688 awaits the maintainer's approval (Tier H); seat record above. |
Requested by Tesla · project thread
Fixes #39441
Ruling-ref: 7403149741
Clause-②: yes (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #39720
维护者速读
What changes
A validation 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 asvalidation-condition-option-label(error), naming the field, the label written and the value to write. Ruling (card #39434, comment 7403149741), applied to validation rules by meta-criterion ①: "option A … scoped to the option-LABEL comparand. The broader 'refuse every literal outside the options' … was offered and not chosen."evaluateValidationRules, origin/maina92f1ed9, optionsUrgent/urgent,Low/low):record.priority == 'Urgent'refused neither row (the rule never fires);record.priority != 'Urgent'and!(record.priority in ['Urgent'])refused both rows (the rule refuses every write); the value spellings refused only the row they name. So the negated comparand is covered, under the same id.packages/lint/src/validate-validation-rule-option-labels.ts. No second matcher: the label reading isflow-select-options.ts(indexSelectOptions,optionLabelComparisons, the readingflow-condition-option-labeluses), with the roots a validation predicate binds (record.F,previous.F); the rule walk is the compile rule's exportedwalkObjectValidationRules(object rules, extension rules,conditionalbranches). Judged slots:conditionandwhen.readonlyfield; a picklist-bound field; a field two object extensions both declare; a label holding a quote or a backslash; a predicate in a dialect other than CEL; the membership spelling'L' in record.Fon amultiselect/checkboxesfield (not a comparand form the shared reading knows); a rule withactive: falseand every branch under it (the evaluator skips it, and it keeps a one-key way out for a stored object). The exemption is keyed on the switched-off rule record and the branches the walk hands right after it, never on the rule's name: another, active rule sharing that name is judged (r2, S1 below).F == 'L',F != 'L','L' == F,'L' != F, and each member ofF in [...], negated or not, withFread asrecord.Forprevious.F.AUTHORING_RULESasgatingon all three CLI commands and on the metadata publish door forobjectandobject_extensionwrites (saveMetaItemactive /publishMetaItem, 422INVALID_METADATA). No code inmetadata-protocolmoves.active: false) — the door's standing mode, where every finding on the written item is judged on every publish ("re-saving a row is writing it",runtime-gate.ts), the same mode the flow siblingflow-condition-option-labellanded with (PR fix(lint)!: os validate refuses an option label in a flow filter, edge condition or decision branch #37491). A draft save is not refused at the save, but its publish verdict, computed on read through the same judge, names the finding. A history restore is anactivewrite and is judged like a publish: a stored history version carrying the shape is refused on restore. A sibling object's stored label rule is never charged to another write. Pinned at the lint gate function and, since this round, through the realsaveMetaItemdoor (below). The order pin "a condition unchanged on an existing row is not judged" (a sharing-rule-door term) is withdrawn by the claim per that reading.validation-condition-option-label-refused(packages/spec/src/migrations/entries/semantic/19.validation-condition-option-label-refused.ts) with its rows insemantic-relevance.test.tsand the validation site ofsemantic-relevance-coverage-38929.test.ts; required bycheck:adr-0087-registrationfor a declaredMetadata-protocol: narrowed. Changeset@objectstack/lintand@objectstack/specminor (a declared kind takes at leastminor), with a FROM → TO table. Accepted by claim amendment 7412845318.os explain validation-condition-option-labelhas its entry; the four CLI transcripts undercontent/docs/print one more author-time rule (90 → 91,check:docs-transcript-drift).Metadata-protocol: narrowedis the claim's line, confirmed by the contract review (7414461872): unlike the sharing-rule sibling (asys_sharing_rulerow is data, declarednone), an object's validation rules are package metadata an author writes, so the minor changeset and the ADR-0087 entry stay.r2 (head 2eb5a24): S1 and the review nits
active: falseexemption was keyed on the rule's config path, whichflattenRulesbuilds fromname; sovalidations: [{ name: 'x', active: false, ... }, { name: 'x', condition: "record.priority != 'Urgent'" }]left the second, live rule unjudged though it refuses every write (validationsis an array and nothing refuses a repeated name). It now follows the walked records: the switched-off rule, then exactly the branches the walk hands right after it (branchesOf, depth-first,thenbeforeotherwise, capped atMAX_RULE_NESTING_DEPTH); the first entry that is not the next expected branch ends the silencing. Pinned for a repeated top-level name, a repeatedconditionalwhose live copy's branch has the switched-off copy's branch path, and a repeated name in one extension entry.os explainentry, the ledger entry and the changeset now name the spellings reached (adding'L' != Fto the explanation) and the one not read ('L' in F), and the ledger's not-the-shape list names the tied-extension field, the quoted label and the non-CEL dialect the code also skips.Tests
Step 0, red on origin/main at the real door
packages/metadata-protocol/src/protocol.runtime-authoring-gate.test.ts, the #39441 block, run against@objectstack/lintbuilt froma92f1ed9(the door reaches lint throughdist/):And at the lint gate function on
a92f1ed9: anobjectwrite and anobject_extensionwrite carryingrecord.priority == 'Urgent' && record.name == nullanswered{"errors":[],"advisories":[]};runAuthoringRules('build')returned no error.Green at head 502f60a
pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2 src/protocol.runtime-authoring-gate.test.ts(lintdist/built from this branch's lint source): Test Files 1 passed (1), Tests 275 passed (275) — 272 before plus the 3 stored-object pins;VERDICT command-exit 0.pnpm --filter @objectstack/metadata-protocol typecheck(tsc --noEmit,--listFilesincludes the test file):VERDICT command-exit 0.317fe761(no source in those packages moved since):pnpm --filter @objectstack/lint testTest Files 263 passed (263), Tests 10410 passed (10410); specsemantic-relevance.test.ts+semantic-relevance-coverage-38929.test.ts64 passed, 3 todo (pre-existing); lint typecheck exit 0.Ablation (one, the matcher call)
node scripts/ablation-replace.mjsreplaced theoptionLabelComparisons(...)loop source with an empty list (anchor 1 → 0, blob19157df3→5ef3ddbe):validate-validation-rule-option-labels.test.tswent 6 failed / 8 passed (the 8 are the not-refused pins); restored, blob equals HEAD,git diff HEADempty. The r1 commit adds pins only and changes no behaviour, so no new ablation.Green at head 2eb5a24 (r2)
pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 src/validate-validation-rule-option-labels.test.ts: Test Files 1 passed (1), Tests 15 passed (15);VERDICT command-exit 0.pnpm --filter @objectstack/lint test: Test Files 263 passed (263), Tests 10411 passed (10411);VERDICT command-exit 0.pnpm --filter @objectstack/lint typecheck:VERDICT command-exit 0(check:test-typecheck: OK).pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/migrations: Test Files 6 passed (6), Tests 255 passed, 3 todo;VERDICT command-exit 0.pnpm --filter @objectstack/spec typecheck(runsgen:migration-registry; no tracked file changed):VERDICT command-exit 0.dist/, whose rule behaviour for the pinned shapes (single-named rules) is unchanged; CI's Test Core runs it on this head.Ablation (r2, S1)
Committed first, then
node scripts/ablation-replace.mjs --holdput the r1 path-keyed loop back in place of the identity-keyed one (markerABLATION-PATH-KEYEDcount 1,silenced[0] === rulecount 0). The suite imports the module by relative source path (nodist/in the path).validate-validation-rule-option-labels.test.ts:× ⭐ a live rule sharing a switched-off rule's name is still judged, and so are its branches—AssertionError: expected [] to deeply equal [ Array(1) ], Tests 1 failed / 14 passed,VERDICT command-exit 1. Restored withgit checkout HEAD --:git diff HEADempty, disk blobb56327a2equals the HEAD blob.Pins (
packages/lint/src/validate-validation-rule-option-labels.test.ts): label refused with the value named, at the object door, the extension door and the build (same finding); the value saves; a non-choice field untouched;!=/ negatedinrefused;previous.F,whenand a nested branch each at their own slot; label-that-is-a-value and neither-label-nor-value not refused; readonly, picklist and non-CEL not judged;active: falsenot judged; a live rule sharing a switched-off rule's name judged, with its branches (top level, nested, extension entry); a re-publish of a stored object with the label rule unchanged is judged, and switching the rule off republishes clean; a sibling's stored label rule is not charged.Real door (
packages/metadata-protocol/src/protocol.runtime-authoring-gate.test.ts, the #39441 block): an active save comparing the label is refused 422INVALID_METADATAnaming the value, and nothing lands; the value saves. New this round, a stored object the door already holds with the label rule: an unrelated publish (a relabel) is refused on the unchanged rule and nothing lands; the same publish withactive: falseon the rule landsactivewithout the value written; a draft save of it is not judged and landsdraft.Acceptance notes
condition/when, a grep overexamples/,packages/apps,packages/platform-objects,packages/pluginsat this head and HotCRM3377e24; re-grepped by reading 7413097187 at HotCRMbde4be7c): 0 hits; no shipped object is refused. "0 shipped" covers those shipped trees and HotCRM only. Customer-authored metadata stored in running deployments was not measured and is not reachable from here; such rules plausibly exist (the trap was hit in a walkthrough, validation rules: a condition on a choice field compares against whatever text is typed, so an option label silently never matches #39405, and the builder's value picker merged only on 2026-12-04, PR fix(studio): condition builder picks a choice field's value from its options #39440). Those customers meet the refusal at the object's next publish, with the value named andactive: falseas the exit; operators keepOS_ALLOW_UNLINTED_METADATA_WRITES=1.CONTRACT_REVIEW_TIER: record 7414461872 on502f60a5, PASS with S1 (should-fix) open. S1 is fixed at2eb5a24aand owes the delta review; the nits rode the same push. The maintainer's per-PR word on the BREAKING narrowing is still owed and is not granted by that review.!); the push to2eb5a24amoved the head.requiredWhen/readonlyWhenand an option'svisibleWhencomparing a choice field with a label are not read by this rule. Carrier: field rules: requiredWhen, readonlyWhen and option visibleWhen comparing a select to an option label never apply #39722.index.ts,rule-explanations.ts, the two semantic-relevance tests), andgit merge-tree --write-tree HEAD origin/mainmerges them clean (exit 0, no conflict).Verification
Read first, by risk:
packages/lint/src/validate-validation-rule-option-labels.ts: the identity-keyedsilencedloop andbranchesOf(r2), then the reads and the not-judged list.packages/lint/src/authoring-rules.ts, the new entry aftervalidateRuleSchemaFormats(doors andruntimeTypes).packages/spec/src/migrations/entries/semantic/19.validation-condition-option-label-refused.ts.Two-minute check:
pnpm --filter @objectstack/lint exec vitest run src/validate-validation-rule-option-labels.test.tsshows 15 passed; the second case nameswrite 'urgent' in place of 'Urgent'.Gates at head 2eb5a24 (r2, narrowed to the r2 delta)
2eb5a24a(dispatch-gates --commands, stderr names objectstack-ai/objectstack at 2eb5a24): the same 118 families. Local run narrowed to the families reading the five files r2 touched (lint rule module and test, theos explainentry, the ledger entry, the changeset), each exit captured before any pipe, all exit 0:check-adr-0087-registration.mjs --base origin/main(1 migration entry added) and--self-test,check-changeset-no-major.mjs --base origin/main,check-empty-changeset.mjs --base origin/main,check-closing-keyword-parity.mjs,check-issue-citations.mjs,check:nul-bytes,check:issue-citations,check:corpus-claim-drift,check:docs-transcript-drift(4 transcript values equal the registry),check:cross-package-test-inputs,check:test-source-alias,check:changeset-gate-self-tests,docs-audit/check-affected-docs.mjs,docs-audit/check-drift-comment.mjs, speccheck:upgrade-guide,check:spec-changes,check:liveness,check:docs(aftergen:schemarefreshed the gitignoredjson-schema/; first run was PREREQUISITE-style exit 1 on a stale tree,251 generated files in syncafter), lintcheck:doc-formula-expressions.dispatch-gates --ran:✗ dispatch-gates --ran: 98 of 118 derived famil(ies) UNRUN.Declared narrowing: the 98 derive from the r1 files (docs transcripts, the metadata-protocol test) that r2 did not move and were all run green on502f60a5(below); CI runs the full set on2eb5a24a.Gates at head 502f60a
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackat502f60a5: 118 families derived (the same set as at317fe761; the r1 diff adds one test file inpackages/metadata-protocol). All 118 re-run on502f60a5, each exit code captured before any pipe.dispatch-gates --ran:✓ dispatch-gates --ran: 118 derived famil(ies) accounted for — 117 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3).node scripts/check-plugin-teardown-shape.mjs --self-test, exit 3 PREREQUISITE NOT MET (shallow clone cannot read its pinned fixture commit); CI runs it.check:query-options-erasure(✓ query-options-erasure ratchet holds: 25 unswept non-test site(s) in 11 file(s), none new; a first run under a 300 s per-command cap was killed at the cap, exit 124, and the uncapped re-run exited 0),check:type-check-debt,check:type-check-coverage,check:cross-package-test-inputs,check:test-source-alias,check:engine-double-contract,check:nul-bytes,check:docs-transcript-drift,check:adr-0087-registration --base origin/main,check:authorable-surface.check:dual-build-cjs-loadsandcheck:lean-entry-closure(exit 3 at317fe761) exited 0 on this head.test:reponot run locally (CI'sTest Core). PR check-runs: CI owns them; not read by this round.Generated by Claude Code