Skip to content

fix(formula)!: validateExpression refuses == / != between a list-valued field and a scalar - #36207

Merged
os-zhuang merged 13 commits into
mainfrom
claude/issue-36167-cel-list-validator
Nov 22, 2026
Merged

os-zhuang merged 13 commits into
mainfrom
claude/issue-36167-cel-list-validator

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Part of #36167

Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: follow-up #36217

维护者速读

  • 要你做什么:这次改动把以前能保存的「多值字段直接等于单个值」的表达式写法改为拒绝(收紧),按规则需要你本人审阅批准后才能合并;条件构建器那一半另由一个拉取请求交付。
  • 作者在 Studio 保存对象、发布校验、或让 AI 助手检查表达式时,若把一个多值字段(多选、多人等)直接与单个值比较相等(含流程条件里直接写字段名的写法),现在会被拒绝并给出改写建议;以前这种写法被静默接受。
  • 属于「表达式校验与作者护栏」:这类条件在每一行都给出同一个固定答案,规则永远不触发或永远触发,且没有任何报错或日志。
  • 若误判,作者会在保存或发布时看到一条拒绝;本改动可整体回退,已存储的数据照常加载和服务,仅在下一次经校验的保存时要求改写。
  • 这是收窄已接受写法的破坏性变更,需要你审阅后亲自合并落地;条件构建器那一半另由一个拉取请求交付。

What changes

The shared CEL validator (validateExpression) now refuses == / != between a read of a list-valued field on record / previous (or, at a flow condition, its bare name) and a non-null string, number or boolean literal, as the new closed code list-equality. CEL compares the whole list with the scalar, so record.labels == 'frontend' answers false on every row (and != answers true): the condition never changes, with no fault and no log line.

  • The refusal (packages/formula/src/validate.ts, checkListEquality / listEqualityRefusal): either operand order; member spellings record.f, record['f'], previous.f. The message names the field and prescribes the null-guarded membership test, record.f != null && "v" in record.f for == and record.f == null || !("v" in record.f) for !=. Params: reference, operator, operand, answer, rewrite. Subjects resolve through a new rootMemberOf helper in relationship-traversal.ts, which reuses the existing member-spelling reader.
  • Bare names at a flow condition. At a 'flattened' site (a flow's start / edge / decision condition) a bare labels is the trigger record's field, as the type pass already reads it (expression gate: flow-condition type-mismatch verdicts still miss or misdescribe three sites after #29926 (non-record-triggered flows, record.x, decision branches) and MCP validate_expression cannot carry severity or trigger kind #29959 / mcp: validate_expression at flow_condition judges a bare name without the flow's variables, so its type verdict and the door's shadowed-read warning can differ from the runtime flow door #33176 shape), so labels == 'frontend' is refused as list-equality naming labels. Two exceptions get no verdict: a name a flow variable holds (ExprSchemaHint.flowVariables), and any bare name in a flow whose nodes can bind names no reader sees (bareNamesUnproven). record.labels is refused in both cases. A name a comprehension macro binds (exists, all, exists_one, map, filter, the engine's own COMPREHENSION_MACRO_NAMES) is one item of the list inside that macro's body, so record.items.exists(labels, labels == 'a') is not judged there, at any site; the same name outside the macro still is. Measured reading: the docs' canonical spelling is record.f and the Studio flow edge writer writes record.f, but bare field names are a documented binding, and examples/ writes record-triggered start conditions bare (title != previous.title, status == "completed" && ...).
  • Which fields are lists. A fieldTypes entry of an inherently multi-value type (MULTI_OPTION_TYPES: multiselect, checkboxes, tags), or a field named in the new optional ExprSchemaHint.multiValueFields. Every producer derives that member from isMultiValueField in @objectstack/spec/data; none hand-copies a type list. That is how a select / radio / lookup / user / file / image declared multiple: true becomes a list. When the member is absent, those types are judged exactly as before.
  • Producers filled:
    • The publish lint (os validate / os build): every CEL site that types the object's fields (predicate sites and formulas), via a per-object index (buildMultiValueFieldIndex).
    • registerFlow's schema pass: parseObjectFieldSchema returns multiValueFields. Logged, never thrown, like every finding of that pass.
    • The scenario scorer (recordExpressionRefusal).
    • The MCP validate_expression tool, at the validation / formula / flow-condition sites. The list comes off the served definition (McpDataBridge.servedObjectDefinitionOf), which carries multiple; describeObject's projection does not. The definition is read once and shared with the gate's own passes (judgeAuthoredSiteExpression), so the reads per call are unchanged. Those passes run with sharedValidatorRunByCaller, so the refusal is not given twice. A bridge without the member answers exactly as before.
    • Studio's object draft check (validateMetadataDraft: field rules, formulas, validation rules), through CelSchemaHint.multiValueFields.
  • Still accepted:
    • S == null / S != null (either side) and "a" in S.
    • A list compared with a list literal or with another list field.
    • A comparison whose other operand is not a literal.
    • Scalar fields (select, user, lookup without multiple).
  • ADR-0087: semantic entry cel-list-equality-refused (a structured TODO, not a D2 conversion, because the author's intent, membership versus whole-list match, is not recorded). Changeset: minor with the BREAKING arm, FROM → TO, and a one-line fix.

Interpretation, declared. I read "non-null operand" as a non-null scalar literal. A non-literal operand (record.labels == record.stage), a list literal, or another list subject gets no verdict. Each of these can miss a catch. On the subject side, the pass refuses only a read it can show is the list field: a record. / previous. member read, or a bare name at a flow condition that no declared flow variable and no comprehension macro binds, in a flow whose nodes bind no unseen names. One premise is inherited from the type pass: the MCP tool reads a bare name as the field unless the caller hands it the flow's variables.

Tests

  • packages/formula/src/validate-list-equality-36167.test.ts (156): first proves the premise on the real engine (["frontend","qa"] == "frontend" is false, and so is null == "frontend"). Then it covers:
    • each multi type × record / previous × == / != × every spelling (dot, reversed, bracket, number, bool, compound);
    • the optional spellings .? / [?], which get only invalid-cel against a scalar (pinned);
    • flattened and value roles;
    • select / lookup / user with and without multiValueFields;
    • every accepted shape and the no-hint case;
    • bare names at a flattened site (refused for each multi type and for select / user declared multiple), with controls: record scope, a shadowing flow variable, bareNamesUnproven, the accepted shapes;
    • a name a comprehension macro binds: exists / all / exists_one / filter / map over a variable named like a list field are accepted (premise on the engine: record.items.exists(labels, labels == 'a') answers per row). The same name outside the macro, an unbound name in the body, and record.labels in the body are still refused.
  • expression-refusal-codes.test.ts: list-equality is in the closed-code sweep and PINS (code, every param in the message).
  • Door pins named after the card:
    • lint validate-expressions.list-equality-36167.test.ts (20: action visible, a validation rule, a formula, and a record-triggered flow start condition, bare and record., with a declared-variable control and two comprehension-variable controls);
    • service-automation list-equality-advisory-36167.test.ts (18, including the bare-name premise on the flow engine's own evaluateCondition: labels == 'frontend' is false for every list and for null);
    • mcp mcp-validate-expression.list-equality-36167.test.ts (11, through the real stdio bridge: a select / user declared multiple: true is refused once, in the publish gate's sentence read off validateStackExpressions; a bridge without servedObjectDefinitionOf answers as before; flow_condition, bare and record., with a variable control);
    • scenarios scenario-expressions-list-equality-36167.test.ts (4);
    • app-shell clientValidation.listEquality-36167.test.ts (7, against the real formula engine).

All fixtures go through ObjectStackSchema.safeParse first, where a door takes a stack.

Acceptance notes

  • Census: 0 producers (measured at dd76082; the later commits only narrow what is refused). The scan covered examples/ and packages/qa, plus hotcrm read-only at 6090c83: a name-based over-approximation of every list-field name compared with a literal.
    • The 3 raw hits are not producers: a doc comment on a single-valued f_lookup, and this PR's own pins.
    • objectstack validate over app-crm, app-showcase, app-todo and app-multi-package reports 0 list-equality findings, bare-name judging included (re-run at dd76082, each exit 0).
    • Positive control, measured: on app-crm, adding multiple: true to crm_lead.assigned_to plus visible: record.assigned_to == "u1" makes validate exit 1 with "record.assigned_to holds a list". The same predicate without multiple: true exits 0. Both files were restored byte-identical to HEAD.
  • Not in this PR (builder half and catalog):
  • registerFlow's advisory pass gives the validator no flowVariables. It already types bare names that way. A flow variable that shares a list field's name can therefore draw a logged (never thrown) list-equality advisory, as it already can draw a type-mismatch one. os validate, the runtime publish gate and the MCP tool pass the variables. Carried by review follow-ups of PR #36207 #36218 (review follow-ups of PR fix(formula)!: validateExpression refuses == / != between a list-valued field and a scalar #36207).
  • A list read through a relationship is not judged (gap, declared). record.account.labels == 'a' validates clean even with traversalHydration: rootMemberOf answers only a direct member of record / previous, and the hint carries no hop target's field shapes. ExprSchemaHint holds the subject object's fields / fieldTypes / multiValueFields, attachedOnRead (names only) and traversalHydration (a boolean). Judging the hop needs either a new hint member, which is a new producer contract, or a lint pass beside refuseUndeclaredHopField, which already holds the target definitions. Reported to the seat to file; not widened here. Carried by expression check: == / != on a list field reached through a lookup hop (record.account.labels == 'a') is refused at no door, because the schema hint carries no hop target's field shapes #36237.
  • Beyond the claimed file surface:
    • relationship-traversal.ts: the shared member reader, not a copy of it.
    • The ADR-0087 semantic entry, which the narrowed declaration requires.
    • The scenario scorer, as an extra producer of the same hint.

Verification

First read, by risk:

  1. packages/formula/src/validate.ts — checkListEquality / listEqualityRefusal: what counts as a subject (member read, and the bare name at a flattened site) and an operand. This is the narrowing itself.
  2. packages/lint/src/validate-expressions.ts — buildMultiValueFieldIndex and the two sites that pass it, which decide what os validate refuses.
  3. packages/mcp/src/mcp-http-tools.ts — validate_expression: the subject read moved ahead of the hint and handed to gatePassFindings, plus multiValueFieldsOfServed.

Two-minute check: pnpm --filter @objectstack/formula exec vitest run src/validate-list-equality-36167.test.ts prints Tests 156 passed.

Every reading below was taken on this branch. The head is 32d1de4. The second fix round's readings are at that head: the gates, the changed packages' suites, the new ablation and the dogfood battery. Earlier readings are marked with their head.

Dogfood battery (full, no shard, no path) at the final head 32d1de4: VERDICT command-exit 0; Test Files 484 passed, 3 skipped (487); Tests 4107 passed, 68 skipped (4175). The earlier runs at 82d3bdd, 013e722 and dd76082 gave the same counts.

Package suites

At 32d1de4:

  • formula: build + test + typecheck, Test Files 70 passed, Tests 2063 passed, exit 0
  • mcp: test 1463 passed; typecheck exit 0
  • lint: test 9382 passed (the pin file alone: 20)
  • service-automation: test 4216 passed
  • scenarios: test 1280 passed
  • spec src/migrations: 198 passed
  • app-shell metadata-admin celAuthoring* / clientValidation*: 288 passed

At 82d3bdd (first round):

  • service-automation typecheck exit 0, scenarios typecheck exit 0, lint typecheck exit 0
  • app-shell type-check exit 0
Ablation (one per tested behaviour; each leg through ablation-replace, restore proven by blob == HEAD and an empty git diff HEAD)

Second fix round, at 32d1de4:

  • comprehension binding removed (the body walked with the enclosing bindings only): 6 failed / 150 passed (156)

First fix round, at dd76082:

  • bare-name branch removed from checkListEquality: 16 failed / 129 passed (145)
  • MCP multiValueFields hint fill removed: 4 failed / 7 passed (11). The first attempt passed a newline as --replacement; the tool refused it (the replacement count did not rise) and restored, so that reading is void. It was redone with --delete.

First round:

  • refusal call removed from validateExpression: 93 failed / 26 passed (119)
  • lint predicate-site fill removed: 1 failed / 9 passed (10)
  • lint formula-site fill removed: 1 failed / 9 passed (10)
  • parseObjectFieldSchema fill removed: 2 failed / 5 passed (7)
  • flow schemaHint pass-through removed: 1 failed / 6 passed (7)
  • scenario scorer fill removed: 1 failed / 3 passed (4)
  • Studio CelSchemaHint pass-through removed: 3 failed / 4 passed (7)
  • Studio draft-check validation-rule fill removed: 2 failed / 5 passed (7). The first attempt deleted extra lines and collected no tests, so it was void; it was redone with an exact --replacement.

Each mutated module is resolved from source by the suite that judged it, so no rebuild leg was needed.

Gates (32d1de4)
  • node scripts/pm/dispatch-gates.mjs --ran: 105 derived (one more than before: check:swallow-census-controls), 104 run, 1 NOT MEASURED, 0 unrun.
  • NOT MEASURED: check:dual-build-cjs-loads exit 3, PREREQUISITE NOT MET (packages outside this diff have no dist/). CI runs it.
  • pnpm --dir ui exec vitest run scripts/: in the battery it timed out one case (js-comment-mask-returns-interpolation-9424, a 15 s window, while the dogfood battery shared the box). Re-run alone under the lock: 172 files / 5121 tests, exit 0.
  • pnpm --filter @objectstack/cli exec vitest run test/migrate-meta-engine-guidance.test.ts: exit 99 the first time (lock queue); re-run under the lock, 3/3, exit 0.
  • check:nul-bytes exit 0. overlap-check against origin/main 5e8e243: VERDICT clean.

Generated by Claude Code

…ect carries no multiple

Claude-Session: https://claude.ai/code/session_01FEkQ5miLqNucRZevceHwNh
Co-authored-by: Claude <noreply@anthropic.com>
…er list-equality pin

Claude-Session: https://claude.ai/code/session_01FEkQ5miLqNucRZevceHwNh
Co-authored-by: Claude <noreply@anthropic.com>
… list-equality pin

check:test-source-alias: the source reach judged the new test's dynamic
imports of @objectstack/formula, @objectstack/lint and @object-ui/core as
landing inside a clocked window.

Claude-Session: https://claude.ai/code/session_01FEkQ5miLqNucRZevceHwNh
Co-authored-by: Claude <noreply@anthropic.com>
@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 Nov 21, 2026
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 6 package(s): @objectstack/formula, @objectstack/lint, @objectstack/mcp, @objectstack/scenarios, @objectstack/service-automation, @objectstack/spec, touching 24 documentable anchor(s).

2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/automation/flows.mdx (via validateExpression (symbol, a top-level function))
  • content/docs/data-modeling/formulas.mdx (via validateExpression (symbol, a top-level function))
What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: objectName (symbol, 59 pages)
  • 8 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 67 of 249 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 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 — 180 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 5e8e24302dca5cf4dbda2b97dca4c732c022e7b6 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 7cdf89ed01e6fb0ed2e775a553ba83f2446b5c6b — the merge of head 32d1de43e68c8f820fd735aecbfa41a54e364ce5 into base 5e8e24302dca5cf4dbda2b97dca4c732c022e7b6, 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 7cdf89ed01e6fb0ed2e775a553ba83f2446b5c6b && git checkout 7cdf89ed01e6fb0ed2e775a553ba83f2446b5c6b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 5e8e24302dca5cf4dbda2b97dca4c732c022e7b6 32d1de43e68c8f820fd735aecbfa41a54e364ce5 && git checkout -B drift-repro 5e8e24302dca5cf4dbda2b97dca4c732c022e7b6 && git merge --no-ff 32d1de43e68c8f820fd735aecbfa41a54e364ce5

node scripts/docs-audit/affected-docs.mjs --json 5e8e24302dca5cf4dbda2b97dca4c732c022e7b6

⚠️ 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 5e8e24302dca5cf4dbda2b97dca4c732c022e7b6 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

…tion's bare names

validate_expression reads the list-valued fields off the served definition
(servedObjectDefinitionOf), read once and shared with the gate's own passes;
a bridge without it answers as before. At a flattened (flow) site a bare name
is the trigger record's field, as the type pass reads it, unless a flow
variable holds it or the flow's nodes can bind names no reader sees.

Claude-Session: https://claude.ai/code/session_01FEkQ5miLqNucRZevceHwNh
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl and removed size/l labels Nov 22, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5miLqNucRZevceHwNh

Final green head (area a4-C, validator half of #36167, claim 7068951634; builder half is #36185 in a4-D): dd7608202e9f577c266861f760679bdefe0b1113 · 2026-11-22T01:08Z

  • 21 files, +1235/-28. validateExpression refuses == / != between a read of a list-valued field and a non-null scalar literal as the new closed code list-equality, naming the field and prescribing the null-guarded in rewrite; S == null / S != null stay accepted. A field is a list when its fieldTypes type is in MULTI_OPTION_TYPES or it is named in the new optional ExprSchemaHint.multiValueFields; every producer fills that member through isMultiValueField (@objectstack/spec/data): the publish lint, registerFlow's schema pass (logged advisory, never thrown), the scenario scorer, Studio's object draft check, and the MCP validate_expression tool. os-dev reports: round 1 7070685737, fix round 7071918743.
  • Fix round (asked by the area after round 1): (1) the MCP fill reads servedObjectDefinitionOf (round 1 had reverted it on a wrong reason); bridge reads per call unchanged, the refusal is given once, and a bridge without the member answers byte for byte as before. (2) Bare names at flattened sites (record-triggered flow conditions, which examples/ write bare) are judged as the trigger object's fields; a declared flow variable shadows the name, and bareNamesUnproven skips judging (a missed catch, never a false refusal).
  • Pins: formula 145 tests, lint 18, service-automation 18 (including the premise measured on AutomationEngine.evaluateCondition), mcp 11 through the real stdio bridge, Studio 7, scenarios 4; scalar, in and != null controls throughout. Ablation: refusal call 93/119 red (round 1), bare-name branch 16/145 red, MCP fill 4/11 red, and each producer fill red when removed; restores byte-identical.
  • Census at this head: 0 producers in examples/, packages/qa and hotcrm 6090c83 (bare names included); objectstack validate on app-crm, app-showcase, app-todo and app-multi-package reports 0 list-equality findings; positive control (a planted multiple: true plus record.assigned_to == "u1") exits 1.
  • Full dogfood battery at this head (no shard): Test Files 484 passed, 3 skipped; Tests 4107 passed, 68 skipped; no failures.
  • CI at this head (pr-state): 61 success, 12 expected skip, 0 failed, 0 pending; mergeable_state clean. check:dual-build-cjs-loads not run locally (needs every package's dist), declared to CI, which passed.
  • Files beyond the claimed surface, for the seat: packages/spec/src/migrations/entries/semantic/18.cel-list-equality-refused.ts (the ADR-0087 registration a Metadata-protocol: narrowed declaration requires), packages/formula/src/relationship-traversal.ts (rootMemberOf export reusing the existing member reader), the packages/qa/scenarios scorer and packages/mcp (as producers of the same hint).
  • Residuals: Skills-docs: follow-up owed — skills/objectstack-formula/SKILL.md (for the seat to file); registerFlow's advisory pass passes no flowVariables, so a variable sharing a list field's name can draw a logged bare-name advisory (as type-mismatch already can); the inspector as-you-type mounts (carrier fix(studio): the CEL condition builder offers membership, not equals, on a list field #36185) and the ResourceEditPage field catalog (carrier studio: the view / page-block FilterBuilderField builds fields without multiple, so a multi-value field offers = / $in #36169) pass no multiValueFields. All in the PR's Acceptance notes.
  • Owed next: L1-a, then the seat's contract-review-tier review (narrowing) and the four pieces. Not readied, not queued; the maintainer lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5nbzs5iP1HcMCFhZo5

L1 verdict (L1-a): REWORK, bookkeeping only (no code) at head dd7608202e9f577c266861f760679bdefe0b1113 (Part of #36167, the validator half; the builder half is #36185). This is a full read of origin/main...dd7608202e: 21 files, +1235/−28.

席位核对

Shape and gates.

  • l1-face --pr 36207 at dd76082:
    • First line Part of #36167. That is right: the builder half stays with fix(studio): the CEL condition builder offers membership, not equals, on a list field #36185, and the card keeps pm:dispatched (landing rule B).
    • Declarations: Clause-②: no (narrowing) and Metadata-protocol: narrowed. The ADR-0087 entry 18.cel-list-equality-refused is registered, and the changeset carries <!-- adr-0087: registered … -->.
    • Floors: success. Check-runs: 61 success, 12 expected skip, 0 failed, 0 pending. mergeable_state is clean.
  • Two flags:
    • dogfood: answered. The full battery is pinned at this head in 7072021852 (484 files passed / 3 skipped, 4107 tests passed / 68 skipped, no failures).
    • skills-docs: not answered. See R1.
  • The changeset names every touched published package, including @object-ui/app-shell, with the BREAKING text, FROM → TO, and the one-line fix.

The code.

  • The refusal. checkListEquality in validate.ts judges only == / != with a non-null scalar literal on one side. scalarLiteralOf admits string, number, bigint and boolean. On the other side it takes a read of a list subject through rootMemberOf, the field-existence pass's own member reader, so record.f, record.?f, record['f'] and previous[?'f'] are judged the same way.
  • Still answers: a null comparand, a list literal, another field, a variable or a call. Each is a missed catch, never a false refusal.
  • Bare names are judged only at a 'flattened' site, minus flowVariables, and not at all under bareNamesUnproven.
  • List subjects are MULTI_OPTION_TYPES plus multiValueFields. Every producer fills them through isMultiValueField:
    • the publish lint;
    • parseObjectFieldSchema, which registerFlow reads (logged, never thrown, like the rest of that pass);
    • MCP, through servedObjectDefinitionOf; a bridge without it answers as before;
    • the scenario scorer;
    • Studio's draft check.
  • New closed code list-equality, with params reference, operator, operand, answer and rewrite. The code-list pin is extended. The rewrite is null-guarded, because 'a' in null faults.
  • Pins and evidence.
    • Every face has scalar, in and != null controls.
    • Ablations go red and are restored byte-identical.
    • The census at this head finds 0 producers in examples/, packages/qa and hotcrm 6090c83, bare names included.
    • objectstack validate on four example apps reports 0 findings, and a planted positive control exits 1.
  • Files outside the claimed surface are disclosed and needed: the migration entry, the rootMemberOf export, and the scorer and MCP producers.

R1 (must fix before ACCEPT): the skills-docs follow-up has no card. Skills-docs: follow-up owed — skills/objectstack-formula/SKILL.md, on the PR body line and in the changeset. File the card (the seat files it, per 7072021852), then rewrite both lines to Skills-docs: follow-up #N.

R2 (must fix: a residual without a carrier). The Acceptance notes record that registerFlow's advisory pass passes no flowVariables, so a flow variable with the same name as a list field can draw a false logged list-equality advisory. It is logged only, and type-mismatch already behaves the same way, but it is a known false finding with no #N. Name a carrier on that line: the R1 card, a new card, or an existing card that covers the type-mismatch twin. The other two residuals already name theirs, #36185 and #36169.

Next. Both items are a card plus body and changeset edits. If the changeset line moves, that is one docs-only commit, and I will read only that delta and the body. After ACCEPT, the contract-review-tier record is the seat's, and the maintainer lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5krBqrrgxCYgjXmfbv

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: dd7608202e9f577c266861f760679bdefe0b1113
Local-runs: probe — the head's packages/formula was extracted to a scratch copy to run the PR's two formula suites, one ablation of the refusal call and a read-only probe of validateExpression / celEngine.evaluate on edge spellings, with a name-based census script over examples/, packages/qa and hotcrm; the repo tree and HEAD were left untouched.
Scope: diff of merge base 16a96ac2bb to head (21 files): packages/formula/src/{validate.ts,relationship-traversal.ts,expression-refusal.ts,validate-list-equality-36167.test.ts,expression-refusal-codes.test.ts}, packages/lint/src/validate-expressions.ts (+ tests), packages/mcp/src/mcp-http-tools.ts (+ test), packages/services/service-automation/src/{engine.ts,flow-registration-checks.ts,plugin.ts,dag-traversal.ts} (+ test), packages/qa/scenarios/src/score/scenario-expressions.ts (+ test), ui/packages/app-shell/src/views/metadata-admin/{celAuthoring.ts,clientValidation.ts,CelPredicateField.tsx} (+ test), packages/spec/src/migrations/entries/semantic/18.cel-list-equality-refused.ts, .changeset/36167-cel-list-equality-refused.md, skills/objectstack-formula/SKILL.md; card #36167 with comments 7068897946 and 7068927390, PR body, final-head comment 7072021852, PR #36185 state, cards #36169 and #36217.
Security-touching: no

① Derived judgments

  1. What the refusal catches. checkListEquality (packages/formula/src/validate.ts:1497, called at :1855) walks the whole AST and refuses a == / != node when one operand is a direct record.<f> / previous.<f> read (rootMemberOf, relationship-traversal.ts:232) of a list subject and the other is a string, number or boolean literal (scalarLiteralOf, :1460). Subjects are multiValueFields plus any fieldTypes entry in MULTI_OPTION_TYPES (:1444), so both the type-based and the multiple-based cases go through one path. Probed at head: refused for record.labels == 'a', 'a' != record.owners (user, multiple), !(record.labels == 'a'), record.labels == ('a'), inside a ternary, both halves of an ||, 1.5, true. Accepted: in, exists, size(...), .size(), [0] ==, == null, == ['a'], field-to-field, a non-multiple select / lookup / user, and no hint. CEL has no other equality spelling. A flow value envelope is not reached (:1847 returns before the pass), so registerFlow's throwing value check is unchanged.
  2. Refusal shape. list-equality is in the closed code table and params interface (expression-refusal.ts:336, :414), built with the shared refusal(...) helper, and swept by expression-refusal-codes.test.ts. The sentence names the read, the constant answer and the rewrite, as the package's other refusals do. Consistent.
  3. Bare names at flow conditions. Covered, not only measured: at scope: 'flattened' a bare list-field name is judged (:1514–:1521), with flowVariables and bareNamesUnproven standing it down. This branch has a false refusal: finding S1.
  4. Producers. Filled: lint predicate sites (validate-expressions.ts:3020, :3027), lint formula site (:3922), MCP validate_expression at all three CEL sites, each of which has gatePasses (mcp-http-tools.ts:3879, :3897), registerFlow's schema pass (plugin.ts:180, flow-registration-checks.ts:806, logged), the scenario scorer (scenario-expressions.ts:88), Studio's object draft check (clientValidation.ts:855, :876, :979). All derive from isMultiValueField. Not filled: the Studio as-you-type mount (CelPredicateField.tsx:303 to celAuthoring.ts:679), which also passes no fieldTypes, so it judges no list field at all: finding S2. The remaining validateExpression callers pass no object types and are unaffected.
  5. Callers broken. The dev's census is name-based (list-field names against a literal). My own script found 17 list-field names across examples/, packages/qa and hotcrm (local checkout 01d3ec4, not the dev's 6090c83) and 0 comparisons with a literal, either operand order. The dev's objectstack validate runs on the four example apps are the stronger evidence for examples/; hotcrm rests on the name scan only. No doc or skill text writes the refused shape.
  6. Tests. The two formula suites pass at head (195). With the call at validate.ts:1855 removed, 113 of 195 fail; the 82 that stay green are the accepted-shape and scalar controls. The pins would catch a removal. No control covers a comprehension variable (S1), and exists is not among the accepted-shape controls.
  7. Narrowing scope. A previously accepted expression is now an error at os validate, the MCP tool and Studio's draft check; stored rows still load. The out-of-claim touches (rootMemberOf, the ADR-0087 entry, the MCP and scenario-scorer fills) each serve the card's purpose and are listed in the PR body.

② Declarations

  • Clause-②: no (narrowing), ! in the title, Metadata-protocol: narrowed: present in the PR body and the changeset, and true to the diff.
  • Changeset: minor on formula, lint, mcp, service-automation, spec, scenarios and app-shell, with the BREAKING arm, FROM → TO and a one-line fix. Matches the seat ruling 7068927390 (minor, maintainer lands).
  • ADR-0087: 18.cel-list-equality-refused.ts has the SemanticMigration shape of its siblings (id, surface, replacement, reason, acceptanceCriteria); the registry is generated from the entries directory and the changeset carries the adr-0087: registered cel-list-equality-refused marker. Its reason says a correct expression is never affected, which S1 contradicts.
  • Skills-docs: follow-up owed — skills/objectstack-formula/SKILL.md: the skill says nothing about list fields, so it is silent, not wrong. The line still reads follow-up owed; the card now exists (skills/objectstack-formula: say that == / != on a list-valued field (multiselect, tags, a multiple: true field) is refused, and teach in / exists instead #36217) and the line has to name it before acceptance.
  • PR state: draft, mergeable_state clean, 61 checks success and 12 skipped at this head.

③ Findings

S1 (should-fix) — False refusal of a correct flow condition. At a flattened site the bare-name branch (packages/formula/src/validate.ts:1514–:1521) treats every id node named like a list field as that field, including a comprehension's iteration variable. Probed at head with labels: multiselect, items: tags: record.items.exists(labels, labels == 'a') and record.items.all(owners, owners != 'a') are refused as list-equality, while celEngine.evaluate answers the first true for items: ['a','b'] and false for a miss, so it is a per-row condition. The refusal is an error at os validate and the MCP tool, and its rewrite (labels != null && "a" in labels) is wrong for that code. The PR body and the migration entry both state the pass can miss a catch but never refuse correct code. Closes when names bound by a comprehension macro (exists, all, exists_one, filter, map) are excluded from bareSubjects inside its body, with a pinned control.

S2 (should-fix) — The Studio as-you-type producer is left out and its named carrier is spent. CelPredicateField.tsx:303 calls lintCelPredicate, which hands the engine multiValueFields only when the mount supplies it (celAuthoring.ts:683) and never fieldTypes; no inspectors/** mount supplies it, so the editor shows no finding for any list field while the save is then refused. The PR body and comment 7072021852 carry this on PR #36185, which merged on 2026-11-21 without touching CelPredicateField or celAuthoring; the catalog half is carried on #36169, which is closed. Closes when the mounts are filled here or the residual names an open card.

S3 (should-fix) — A list read through a relationship is not judged and the gap is neither declared nor carried. rootMemberOf (relationship-traversal.ts:232) answers only a direct member of record / previous, and the hint holds only the subject object's fields, so record.account.labels == 'a' validates clean with traversalHydration: true (probed). The seat's reason for choosing A was one rule with one answer; this leaves a second answer by path. Closes when the traversed read is judged from the hop target's definition, or the PR body declares the gap and names an open card for it.

N1 (nit) — A negative literal (record.labels == -1), 1u and a bytes literal are not judged; the first evaluates false like the others. A missed catch only.

N2 (nit) — checkListEquality's docblock (validate.ts:1487–:1489) says record.?f and record[?'f'] are judged alike, while the PR's own pin shows those spellings give invalid-cel against a scalar.

N3 (nit) — registerFlow's advisory pass hands the validator neither flowVariables nor bareNamesUnproven (flow-registration-checks.ts:797–:810), so a flow variable named like a list field draws a logged list-equality line. Logged only and declared in the PR body; the flow's variables are in hand at that call.

④ Accepted deviations

Implemented-by: claude/issue-36167-cel-list-validator
Reviewed-by: contract-review subagent of session_01FEkQ5krBqrrgxCYgjXmfbv (claude-fable-5-2)

VERDICT: FAIL

At a flattened site the bare-name branch read `record.items.exists(labels,
labels == 'a')`'s iteration variable as the list field and refused a per-row
condition. The list-equality walk now carries the names the enclosing
comprehension macros bind (the engine's own set, COMPREHENSION_MACRO_NAMES)
and judges neither a bound bare name nor a member read on a bound root inside
the macro's body. The docblock no longer claims the optional spellings reach
this pass, and the ADR-0087 entry says which reads are not the shape.

Claude-Session: https://claude.ai/code/session_01FEkQ5miLqNucRZevceHwNh
Co-authored-by: Claude <noreply@anthropic.com>
…ted at a flow condition

Claude-Session: https://claude.ai/code/session_01FEkQ5miLqNucRZevceHwNh
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5miLqNucRZevceHwNh

Final green head, round 3 (L1-a REWORK 7072044449 and contract review FAIL 7072103543; supersedes final-head comment 7072021852): 32d1de43e68c8f820fd735aecbfa41a54e364ce5 · 2026-11-22T03:04Z

  • Delta from dd7608202e: bookkeeping commit b09460d749, then the review fixes on top. os-dev reports 7072127032 (bookkeeping) and 7073202453 (review round).
  • L1-a R1: Skills-docs: follow-up #36217 in the changeset and the PR body. R2: the registerFlow advisory residual is carried by review follow-ups of PR #36207 #36218 (review follow-ups of PR fix(formula)!: validateExpression refuses == / != between a list-valued field and a scalar #36207), named in the body.
  • S1 fixed: the list-equality walk carries the names that enclosing comprehension macros bind and does not judge a bound bare name, or a member read on a bound root, inside that macro's body; the receiver is still judged. The macro set is the engine's own (COMPREHENSION_MACRO_NAMES, exported from cel-engine.ts, not re-exported from the package entry). record.items.exists(labels, labels == 'a') and .all(owners, owners != 'a') are accepted; the same name outside the macro, an unbound name in the body, and record.labels in the body stay refused. The ADR-0087 entry's reason and the body's sentence on what is refused were rewritten to match. 11 new tests (formula pin now 156); ablation of the binding 6/156 red, restore byte-identical.
  • N2 fixed (docblock: record.?f / record[?'f'] are refused as invalid-cel before this pass). S2: body names studio: the CEL editor's as-you-type check is given no list fields, so it never flags == / != on a multi-value field that the save then refuses #36219 as the carrier of the as-you-type mounts.
  • S3 not widened; gap declared in the body's Acceptance notes. ExprSchemaHint carries no hop target's field shapes (traversalHydration is a boolean, attachedOnRead names only), so record.account.labels == 'a' is judged at no door. Two landing routes: a new hint member (a producer contract), or a lint pass beside refuseUndeclaredHopField, which already holds the target definitions. For the seat to file.
  • Full dogfood battery at this head (no shard): Test Files 484 passed, 3 skipped; Tests 4107 passed, 68 skipped; no failures. Census unchanged at 0 (this round only narrows what is refused).
  • CI at this head (pr-state): 61 success, 12 expected skip, 0 failed, 0 pending; mergeable_state clean.
  • Owed next: L1-a delta, the contract reviewer's delta read, the seat's four pieces. Not readied, not queued; the maintainer lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5nbzs5iP1HcMCFhZo5

L1 verdict (L1-a): REWORK, one body line (no code) at head 32d1de43e68c8f820fd735aecbfa41a54e364ce5 (Part of #36167). This is a delta read of dd7608202e..32d1de43e6 (three commits; 6 files, +114/−26 over the PR's paths) plus the body, on top of 7072044449.

席位核对

R1 closed. The changeset and the body now read Skills-docs: follow-up #36217. #36217 is open, and its title is the skills/objectstack-formula teaching.

R2 closed. The body's residual line for the registerFlow flowVariables advisory names #36218. #36218 is open; its item and Done-when describe exactly that mechanism.

The review round (contract record 7072103543), read for L1.

  • S1. The list-equality walk now carries the names that enclosing comprehension macros bind.
    • The macro set is the engine's own (COMPREHENSION_MACRO_NAMES), exported from cel-engine.ts but not from the package entry.
    • The receiver is walked outside the binding and the body inside it, the same reading the date-text pass takes.
    • A bound bare name, or a member read on a bound root, is not judged.
    • record.labels in the body, the same name outside the macro, and an unbound name are still refused.
    • 11 new tests. Ablation: 6/156 red, restored byte-identical.
    • Dropping the visited set is safe, because the CEL AST is a tree.
    • The ADR-0087 entry's reason is rewritten to match, so the registered shape and the code agree.
  • N2. The docblock now says record.?f / record[?'f'] are refused as invalid-cel before this pass.
  • S2. The as-you-type mounts are carried by studio: the CEL editor's as-you-type check is given no list fields, so it never flags == / != on a multi-value field that the save then refuses #36219, which is open, and the body names it.
  • Battery. Pinned at this head in 7073315874: 484 files passed / 3 skipped, 4107 tests passed / 68 skipped, no failures.
  • Gates. 61 success, 12 expected skip, 0 failed, 0 pending; mergeable_state is clean.

R3 (must fix: a residual without a carrier). The body's Acceptance note "A list read through a relationship is not judged (gap, declared)" covers record.account.labels == 'a', which validates clean. It ends "Reported to the seat to file; not widened here", with no #N. Once the seat files it, put the number on that line. That needs only a body edit and no push, and I will read only that line.

Next. R3, then ACCEPT. After that come the contract reviewer's delta read and the seat's four pieces, and the maintainer lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5nbzs5iP1HcMCFhZo5

L1 verdict (L1-a): ACCEPT at head 32d1de43e68c8f820fd735aecbfa41a54e364ce5 (Part of #36167). Delta read: PR body only, on top of 7073331262. The head is unchanged, so that record's read of the code stands.

席位核对

Next. The contract reviewer's delta read and the seat's four pieces come next, then the maintainer lands it.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5krBqrrgxCYgjXmfbv

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 32d1de43e68c8f820fd735aecbfa41a54e364ce5
Local-runs: probe — the new head's packages/formula was extracted to a scratch copy to run its list-equality, refusal-code and cel-engine suites and a read-only probe of validateExpression on comprehension spellings; the repo tree and HEAD were left untouched.
Scope: delta dd7608202e9f577c266861f760679bdefe0b1113 to 32d1de43e68c8f820fd735aecbfa41a54e364ce5 (3 commits, 6 files): packages/formula/src/{validate.ts,cel-engine.ts,index.ts,validate-list-equality-36167.test.ts}, packages/lint/src/validate-expressions.list-equality-36167.test.ts, packages/spec/src/migrations/entries/semantic/18.cel-list-equality-refused.ts, .changeset/36167-cel-list-equality-refused.md; the PR body at this head (re-read after the body edit naming #36237); cards #36217, #36218, #36219, #36237; the previous record at head dd7608202e.
Security-touching: no

① Derived judgments

  1. S1 closes. checkListEquality's walk now carries the names bound by the enclosing comprehension macros (packages/formula/src/validate.ts:1525–:1566): at an rcall whose name is in COMPREHENSION_MACRO_NAMES (cel-engine.ts:1081: all, exists, exists_one, map, filter) the receiver is walked outside the binding and the body inside it, and subjectOf gives no verdict for a bound bare name or a record. read where the macro binds record. The set is the one the engine's date-text pass already reads (cel-engine.ts:1063), shared and not copied. Probed at this head, flattened scope: record.items.exists(labels, labels == 'a'), record.items.all(owners, owners != 'a'), labels.exists(labels, labels == 'a') and the filter / map forms are accepted. Still refused: the same name outside the macro (items.exists(labels, labels == 'a') && labels == 'b'), an unbound name in a body (items.exists(x, labels == 'a')), a name after an inner binding ends (items.exists(x, items.exists(labels, labels == x) && labels == 'q')), record.labels == 'a' inside a body, and the plain labels == 'a' and record.labels == 'a'. No catch was lost.
  2. Pins. The new formula describe block holds the engine premise, six accepted spellings and four still-refused controls; the lint door pin adds two comprehension controls at a flow start condition. The three formula suites pass at this head (291 tests). The area's ablation reading (6 of 156 red with the binding removed) fits the pins: the accepted-spelling cases go red and the controls stay green.
  3. S3: declaring the gap is acceptable for this PR; widening here is not required. The (narrowing) declaration covers what is newly refused. A traversed read that is still accepted is unchanged behaviour, so the gap is a missed catch and cannot refuse correct code. Judging it needs the hop target's field shapes, which ExprSchemaHint does not carry; that is a new producer contract or a lint pass beside the existing hop-field check, and either is its own change. The PR body declares the gap with that reasoning and its gap line now ends Carried by #36237 (a body edit only; the head is unchanged). expression check: == / != on a list field reached through a lookup hop (record.account.labels == 'a') is refused at no door, because the schema hint carries no hop target's field shapes #36237 is open, p2, and covers the gap: it names record.account.labels == 'a', the missing hop-target shapes, both routes, and pins for one hop to a multiple: true field refused and one hop to a scalar accepted. Moved to an accepted deviation.
  4. S2. The body now carries the as-you-type mounts on studio: the CEL editor's as-you-type check is given no list fields, so it never flags == / != on a multi-value field that the save then refuses #36219, which is open and titled for exactly this. Moved to an accepted deviation.
  5. Nothing new of substance in the delta. COMPREHENSION_MACRO_NAMES is exported from cel-engine.ts only; packages/formula/src/index.ts names its exports one by one and does not list it, so the package's public face is unchanged. The removed visited set guarded a tree that has no shared nodes; the suites pass without it. The migration entry's surface and reason now state that a macro-bound name and a declared flow variable are not the refused shape, which matches the code.

② Declarations

③ Findings

S1 (should-fix): closed

S2 (should-fix): closed

S3 (should-fix): closed

N1 (nit) — unchanged: a negative literal, 1u and a bytes literal are not judged. A missed catch only.

N2 (nit) — fixed: the docblock at validate.ts:1489–:1502 now says the optional spellings give invalid-cel first.

N3 (nit) — unchanged in code; now carried by #36218.

④ Accepted deviations

Implemented-by: claude/issue-36167-cel-list-validator
Reviewed-by: contract-review subagent of session_01FEkQ5krBqrrgxCYgjXmfbv (claude-fable-5-2)

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5krBqrrgxCYgjXmfbv

席位核对

Awaiting the maintainer's merge (narrowing) · 2026-11-22T03:10Z · head 32d1de43e68c8f820fd735aecbfa41a54e364ce5

@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 Nov 22, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 22, 2026 03:24
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 22, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#4 · os-project-manager · session_01FEkQ5krBqrrgxCYgjXmfbv

席位核对

Hold, do not enqueue · 2026-11-22T03:47Z · head 32d1de43e68c8f820fd735aecbfa41a54e364ce5

A later review sweep (#35270, run records r05/r06 on an older head) raised two points about the refusal's prescribed rewrites that the L1 and contract records at this head did not cover. The seat is checking them at this head before landing:

  • At a sharing-rule condition site, the prescribed "v" in record.f may not lower to a filter (cel-to-filter.ts: in needs a field on the left).
  • The != rewrite record.f == null || !("v" in record.f) is not parenthesised, so pasting it inside A && … changes the predicate.

If either holds, a4-C fixes it in a fix round, followed by L1 and contract deltas. pm:awaiting-merge is removed until then. The approval at this head stands as given. The seat re-posts its record when the PR is ready again.

@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 22, 2026
Merged via the queue into main with commit ad65d82 Nov 22, 2026
89 of 90 checks passed
@os-zhuang
os-zhuang deleted the claude/issue-36167-cel-list-validator branch November 22, 2026 04:02
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 22, 2026
…ite, and judges a flow condition only where the run binds the typed row (objectstack-ai#36340)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbPgGMxS6cCEEprR4e3dQNe9)_

Fixes objectstack-ai#36167

This is the card's last item: the builder half (objectstack-ai#36185) and the
validator half (objectstack-ai#36207) are merged, and the remaining follow-ups have
their own cards (objectstack-ai#36217 skills text, objectstack-ai#36218 review follow-ups, objectstack-ai#36219
the as-you-type editor).

Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up objectstack-ai#36217

## 维护者速读

-
作者把多值字段(多选、多人等)与单个值比较相等时,系统给出的改写建议现在在每个位置都能用:共享规则条件里也能用,且建议本身加了括号,不会被前面的条件拆开;由接口、定时或无触发方式启动的流程里,这种写法不再被误拒。
-
属于「表达式校验与作者护栏」:上一个已合并的拉取请求开始拒绝这种写法,复审发现它给的改写在共享规则里无法生效、部分写法会报错,还会误拒正确的流程条件。
- 若出错,作者看到的只是另一种改写建议,或某个流程条件不再被拦下;本改动可以整体撤回,不影响已存储的数据。
- 无

## What changes

Follow-up to objectstack-ai#36207, which merged before its round-4 review findings
were addressed. This PR covers four of them: r05 S1, r05 S2, r05 S4 /
r06 N1, and r06 S1.

**The prescribed rewrite is spelled for its site and parenthesised
whole** (`listMembershipRewrite` in `packages/formula/src/validate.ts`).
Each spelling below was measured on the site's own evaluator or filter
compiler:

| site | `==` rewrite | `!=` rewrite |
|---|---|---|
| a `record.` / `previous.` read evaluated as CEL (validation rule,
field rule, formula, action `visible` / `disabled` / `pressed`, hook
condition) | `(has(record.f) && record.f != null && "v" in record.f)` |
`(!has(record.f) \|\| record.f == null \|\| !("v" in record.f))` |
| a bare name at a flow condition (the run binds every declared field,
`null` when empty) | `(f != null && "v" in f)` | `(f == null \|\| !("v"
in f))` |
| a sharing rule `condition`, compiled to a query filter (new
`ExprSchemaHint.filterCompiled`, filled by the publish lint) |
`(record.f != null && record.f.contains("v"))` | `(record.f == null \|\|
!record.f.contains("v"))` |

No single spelling works at every site, which is why the rewrite differs
per site:

- `"v" in record.f` does not lower to a filter. `compileCelToFilter`
answers "`in` requires a field on the left (got literal)", so the
sharing rule is dropped as `sharing-rule-unlowerable-condition`.
- `has()` does not lower either ("unsupported operator call").
- On the CEL evaluator, `record.f.contains("v")` faults on a list,
because there is no `list.contains` overload.
- `record.f != null && "v" in record.f` faults on a row that lacks the
key ("No such key"), which a sparse action row does. It also faults on a
null `previous`, as on a create.

The filter spelling lowers to `$and[{f:{$null:false}},
{f:{$contains:"v"}}]` and `$or[{f:{$null:true}},
{$not:{f:{$contains:"v"}}}]`. `$contains` on a JSON-stored (multi-value)
column is membership in `matchesFilterCondition` and in driver-sql
(`sql-driver-17590-json-column-membership.test.ts`). A number or boolean
operand is passed as its text (`contains("3")`), since `$contains`
compares text. The sharing-site message also says why `==` does not work
there: the query filter refuses `$eq` against a list column.

**A flattened (flow) site is judged only where the run binds a row of
the typed object** (r06 S1). `checkListEquality` now returns early at a
`'flattened'` site unless `faultOutcome` is `'run-fails'`. That outcome
is declared only on a record-triggered flow, or on a time-relative sweep
of the typed object: the lint's `faultOutcomeOf` ledger,
`validate-expressions.ts` around line 1632. On any other flow (API,
schedule, no trigger), the ledger's own row says the run "holds what its
entrance handed it". `seedRunVariables` flattens whatever record that
is. So an API flow whose request body carries a string `labels` runs
`labels == 'frontend'` correctly, and objectstack-ai#36207 refused it. The MCP tool
already passes this outcome for `flow_condition` (its default
`triggerKind` is `record_change`). `registerFlow`'s advisory pass now
passes it on the same flows (`runBindsTypedRow`, which this PR moves
above the hint). Side effect: on those flows, the pass's logged
type-mismatch lines take the `run-fails` wording that `os validate`
already prints. It still only logs and never throws.

**Docblocks (r05 S4 / r06 N1).**
- `ExprSchemaHint.multiValueFields` now names the forms actually judged:
  - `record.f` / `previous.f` and the bracket spelling;
  - the optional spellings, which are refused as `invalid-cel` first;
- the bare name, only at a flattened site with `run-fails`, excluding
`flowVariables` and `bareNamesUnproven`;
  - comprehension-bound names, which are never the field.
- `ExpressionRefusalParams['list-equality']` now documents `reference`
(the bracket spelling renders `record.f`; a bare name is the bare name)
and the per-site `rewrite`.

**Semantic entry** `cel-list-equality-refused` now has the per-site
replacement text and the narrowed surface. The surface adds the sharing
rule condition and limits flows to the proven-row ones.

## Tests

- `packages/formula/src/validate-list-equality-36167.test.ts`
- New describe, "the prescribed rewrite tests membership where it is
read". For each site class it takes the rewrite out of the refusal
itself, pins its text, and runs it:
- **CEL member read:** evaluated on rows `[a,b]` / `[b]` / `[]` / `null`
/ absent, and with `previous = null`. Each is also checked inside
`record.name == 'x' && …`, `record.name == 'y' && …` and `false || …`,
which pins the parenthesisation.
    - **Bare name:** evaluated with the row bound as top-level names.
- **Filter:** lowered with `compileCelToFilter` and matched with
`matchesFilterCondition` (with the column declared `tags`), including
inside `&&`.
    - Each rewrite validates clean at its own site.
    - The CEL `in` form is shown not to lower.
- New describe, "a flattened site with no proven row binding gets no
verdict": bare and `record.` reads, `fail-closed` / `fail-open`, plus a
proven-site control.
- `packages/formula/src/expression-refusal-codes.test.ts`: the two
`list-equality` PINS carry the new rewrites. Two new pins cover the bare
name at a proven flattened site and the `filterCompiled` site, with
params and the whole message.
- `packages/lint/src/validate-expressions.list-equality-36167.test.ts`:
  - action `visible` rewrites pinned, and each validates clean;
- a flow condition's bare `!=` rewrite pinned in the parenthesised form
and accepted inside `stage == 'qa' && …`;
- CONTROLS: an API, a trigger-less autolaunched and a scheduled flow get
no list-equality, bare or `record.`;
- new describe, the sharing rule `condition`: refused with the
`contains` rewrite, and that rewrite draws no finding from the
expression lint or from `validateSharingRuleEnforceability` (it lowers);
- CONTROL: the CEL `in` forms draw `sharing-rule-unlowerable-condition`
there.
-
`packages/services/service-automation/src/list-equality-advisory-36167.test.ts`:
  - `makeFlow` now states its trigger (`record-after-update`);
  - parenthesised bare rewrite pinned and not reported itself;
  - CONTROLS: API, scheduled and trigger-less flows report nothing;
- premise: the bare rewrites answer per row on `evaluateCondition`,
including `false && (…)`.
- Two fixtures fixed at `254d40cb` (they had never run; each stopped
before the behaviour it pins):
- the sharing-rule describe in the lint pin built its rule with a
recipient type the spec does not have (`role`) and no rule `type`, so
all three cases failed at the spec-validity guard. It now uses `type:
'criteria'` and a `team` recipient, as the other spec-valid sharing
fixtures do;
- the API-flow CONTROL in the service-automation pin carried no hook
secret, so `registerFlow` refused the flow before the advisory pass ran.
It now names a `secretRef` (ADR-0041).
-
`packages/mcp/src/mcp-validate-expression.list-equality-36167.test.ts`:
the `flow_condition` rewrite is pinned and validates clean. CONTROL:
`triggerKind` `api` / `schedule` / `none` get no list-equality.

## Acceptance notes

- **Clause ② for this diff: `yes (widening)`.** Two things widen:
  - it adds the optional public key `ExprSchemaHint.filterCompiled`;
- flow conditions on API / scheduled / trigger-less flows are accepted
again, after objectstack-ai#36207 refused them.

Nothing in this diff refuses more. The changed rewrite text and the
narrower flattened scope are not narrowings. `Metadata-protocol: added`
because an accepted value is restored, so every package moved is
`minor`.
- The driver-sql leg of the filter rewrite is cited, not run here:
`$contains` membership on a JSON column is pinned in
`sql-driver-17590-json-column-membership.test.ts`, and `$not` is
NULL-safe (objectstack-ai#5146). This PR measures the lowering and
`matchesFilterCondition`.
- Decision node `config.condition` in the lint: only the start node's
gate and edge / branch conditions carry the flow's outcome. An inert
node condition already has its own `flow-inert-node-condition` finding,
and gets no list-equality verdict.
- L2 S1 carried by objectstack-ai#36218 (scope !== 'record'); nits N1–N4 accepted.

## Verification

Final head `254d40cb` (handover head `5a29954a` + `origin/main` merged
at `2b570445` + the two fixture fixes). Every reading below is at that
head.

<details><summary>Package suites and pins</summary>

- Build closure `--filter '@objectstack/lint^...' --filter
'@objectstack/mcp^...' --filter '@objectstack/service-automation^...'
--filter '@objectstack/scenarios^...' build`: lock VERDICT command-exit
0. Later a full `pnpm build --concurrency=2`: 120/120 tasks, VERDICT
command-exit 0.
- Pins: formula `validate-list-equality-36167` +
`expression-refusal-codes` 250/250 (the 8 bare-name failures of the
handover run are gone); lint `validate-expressions.list-equality-36167`
27/27 (3 failed before the fixture fix); mcp
`mcp-validate-expression.list-equality-36167` 15/15; service-automation
`list-equality-advisory-36167` 22/22 (1 failed before the fixture fix).
- Full suites, one locked run, VERDICT command-exit 0: formula build +
test 70 files / 2107 tests + typecheck exit 0; lint 225 files / 9434
tests + typecheck exit 0; mcp 83 files / 1467 tests + typecheck exit 0;
service-automation 290 files / 4220 tests + typecheck exit 0; spec
`src/migrations` 5 files / 198 tests.

</details>

<details><summary>Ablations (seven, each through ablation-replace WRAP
mode under the lock)</summary>

Each mutation was proven on disk (anchor 1 to 0, blob changed) and
restored (blob equal to the HEAD blob, empty `git diff HEAD`). Every
mutated module is read from source by its suite, so there is no dist
leg.

| ablation | file | pin result |
|---|---|---|
| delete the flattened proven-row early return | formula `validate.ts` |
5 failed / 245 passed (250) |
| never take the `filterCompiled` spelling | formula `validate.ts` | 13
failed / 237 |
| drop the outer parentheses of the `!=` member-read rewrite | formula
`validate.ts` | 6 failed / 244 |
| drop `has()` from the `==` member-read rewrite | formula `validate.ts`
| 4 failed / 246 |
| lint passes no `filterCompiled` at the sharing rule | lint
`validate-expressions.ts` | 2 failed / 25 (27) |
| service-automation always declares `run-fails` |
`flow-registration-checks.ts` | 3 failed / 19 (22): the API, scheduled
and trigger-less CONTROLS |
| service-automation never declares `run-fails` |
`flow-registration-checks.ts` | 5 failed / 17 (22) |

</details>

<details><summary>Derived gates</summary>

- `dispatch-gates --commands` at `254d40cb`: 96 families.
`dispatch-gates --ran` with recorded exit codes: 96 derived, 96 run, 0
NOT-MEASURED (a derived zero), every family exit 0.
- Three needed a prerequisite first and were re-run:
`check-plugin-teardown-shape --self-test` (exit 3 on the shallow clone
until its pinned fixture commit was fetched, then exit 0); the cli
`migrate-meta-engine-guidance` vitest (exit 1, MODULE_NOT_FOUND on an
unbuilt `@objectstack/mcp` dist, then 3/3 after the full build);
`check:dual-build-cjs-loads` (exit 3 PREREQUISITE NOT MET, then exit 0
after the full build: 124 require entry points across 72 packages load).
- `check:type-check-debt` exit 0. `check:nul-bytes` OK. `overlap-check`
VERDICT clean exit 0 against `origin/main` `2b570445` and objectstack-ai#36333 (shares
`validate.ts`, merges cleanly).
- CI at `254d40cb`: all 69 check-runs completed, every one success or
skipped (Check Changeset, PR-body guards, Governed Surface Queue Guard,
every Lint and Type Check lane, Test Core 10/10 shards, Test UI 16/16,
Build Core, Dogfood Regression Gate).
- `test:repo` was not run locally (the diff touches no repo-project
test); CI's Test Core ran it.

</details>

Dogfood battery: n/a (no `!` in the title, and `Clause-②: yes
(widening)` has no `(narrowing)` arm).

Two-minute check: `pnpm --filter @objectstack/formula exec vitest run
src/validate-list-equality-36167.test.ts`. Expected: every test passes,
including the "prescribed rewrite" and "no proven row" describes.

Read first, by risk:
1. `packages/formula/src/validate.ts`: `listMembershipRewrite` and the
early return in `checkListEquality`.
2.
`packages/services/service-automation/src/flow-registration-checks.ts`:
`faultOutcome` on the advisory hint.
3. `packages/lint/src/validate-expressions.ts`: the sharing-rule
`check(…, true)`.

---

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01QsR2jVXKcrF3rr7ShYFZ9E

<!-- signed: repo:objectstack#7 · zhuangjianguo ·
session_01QsR2jVXKcrF3rr7ShYFZ9E -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 22, 2026
… is refused as its bare name is (objectstack-ai#36333)

<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X8UqWLrzTYpuat8L5eLdf2c)_
Fixes objectstack-ai#34946
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none — `skills/objectstack-formula/SKILL.md` already states
"No date arithmetic. The build refuses `date + n` and `end - start`" and
names no site it is limited to, so it now holds for a flow condition's
`record.FIELD` / `previous.FIELD` reads as written

repo:objectstack#4 · os-project-manager ·
session_01FEkQ5pb2t8Z8C64PkPyVt1

## 维护者速读

-
用户能看到什么变化:作者在校验或发布流程时,若流程条件通过「当前记录」或「修改前记录」读取日期字段并直接加减数字,现在会和直接写字段名一样被拒,并提示改用按天计算的函数;以前这种写法能通过校验,运行时却每次失败。
- 为什么做:属于「表达式校验与作者护栏」,替编写流程的管理员和代写流程的 AI
助手解决「校验通过、流程每次运行都出错」的问题,与已修好的日期文本同类问题是同一族。
- 出错会怎样:若误判,作者在校验或发布流程时会看到一条拒绝;已保存的流程照常加载、照常注册,只在下次发布时要求改写;本改动可整体撤回。
- 要你做什么:这是收紧已接受写法的破坏性变更,需要你本人审阅、批准并亲手合并。L1 ACCEPT 7076562103,全量测试 0 失败
7076550688,契约 PASS 7076631700(座位 7,head f278fec);一个不阻塞的遗留写法(main
上同样存在,不是回归)和三个小问题另立 objectstack-ai#36377 跟进。

## What changes

A flow condition (start, edge, `decision` branch) is evaluated over a
scope where the run's row is bound twice: its fields flattened to bare
names, and the row itself as `record` (with the row before the write as
`previous`). The date-arithmetic verdict typed the bare names only.
`firstTypeMismatch`'s flattened record-root pass typed `record.FIELD` /
`previous.FIELD` but kept only the text/boolean mismatch, so
`record.due_date + 1 > 5` passed while `due_date + 1 > 5` was refused,
and both fault at run time on the `YYYY-MM-DD` text on every run.

Measured through `validateStackExpressions` (the `os validate` body) on
a record-triggered flow (`record-after-update`), object `library_loan`
with `due_date: date` and `picked_up_at: datetime` (both `required`),
start condition:

| start condition | before (`origin/main` 28ba01f) | after (this
head) |
|:---|:---|:---|
| `due_date + 1 > 5` | 1 error, date arithmetic
`google.protobuf.Timestamp + int`, `due_date` | 1 error (unchanged) |
| `record.due_date + 1 > 5` | 0 | 1 error, same verdict,
`record.due_date` named |
| `previous.due_date + 1 > 5` | 0 | 1 error, same verdict,
`previous.due_date` named |
| `picked_up_at + 1 > 5` (CONTROL, datetime) | 1 error, `picked_up_at` |
1 error (unchanged) |
| `record.picked_up_at + 1 > 5` (CONTROL) | 0 | 1 error, matching the
bare name |
| `previous.picked_up_at + 1 > 5` (CONTROL) | 0 | 1 error, matching the
bare name |
| `record.due_date < today()` (CONTROL) | 0 | 0 |
| `timestamp(record.due_date) < now()` (CONTROL, date-text) | 1 error,
date-text call | 1 error (unchanged, no second finding) |

The datetime control: a `datetime` field is a Timestamp in the type
check exactly as a `date` field is, and its bare name already took the
date-arithmetic verdict, so its root reads now take that verdict too,
word for word with the reference swapped. That is the dispatch's control
("keep whatever verdict the bare name gets for a datetime").

- `packages/formula/src/cel-engine.ts`, `firstTypeMismatch`: the
record-root pass now answers `category: 'date-arith'` when its first
operator fault is date/duration arithmetic against a number
(`isDateArith`), with `field` and `root` from `offendingRecordRead(…,
'timestamp')`. The text/boolean branch is unchanged. The comment that
said the `date-arith` verdict "stays the bare name's alone" is
corrected, and the `root` field's doc and
`recordRootReadsFaultDateArith`'s doc say the root read is answered
there too.
- `packages/formula/src/validate.ts`, `typeSoundnessIssue`: a root
read's date verdict takes the row's arm (`dateArm` with
`bareNamesUnproven` false), as the root read's type mismatch (objectstack-ai#30025)
and date-text verdicts (`recordRootDateTextIssue`) already do. So
`record.due_date + 1 > 5` stays `date-arithmetic-run-fails` where bare
names are unproven or a flow variable shadows `due_date`. The bare
name's arm is unchanged.
- No double report: `recordRootDateTextIssue` runs only when
`firstTypeMismatch` answers null, and it already stood down on this
exact shape (`recordRootReadsFaultDateArith`). The objectstack-ai#34662 date-text pins
are green and unchanged.
-
`packages/spec/src/migrations/entries/semantic/18.flow-condition-record-date-arithmetic-refused.ts`:
the ADR-0087 semantic entry (a structured TODO; no mechanical rewrite,
since a span in days and a shifted date are different intents), modelled
on `18.cel-list-equality-refused.ts`.
- `.changeset/34946-flow-record-date-arithmetic.md`: `minor` for
`@objectstack/formula` and `@objectstack/spec` (`Metadata-protocol:
narrowed` grades `minor`; spec ships the new ADR-0087 entry in its
generated migration registry), the declaration lines, the **BREAKING**
banner, a FROM to TO table, and `adr-0087: registered
flow-condition-record-date-arithmetic-refused`.

Reach (the dispatch asked to stop if the narrowing reached beyond flow
conditions): the flattened scope is used only by flow conditions.
`@objectstack/lint` passes it for start, edge and `decision` conditions,
`@objectstack/service-automation`'s `registerFlow` (advisory only) and
the MCP `validate_expression` tool's `flow_condition` site. Formula
fields, validation rules, hooks and actions are `record`-scoped, where
`record.due_date + 1` was already refused (`date-arithmetic`,
`-fail-closed`, `-fail-open`). No widening was needed.

## Tests

- `packages/formula/src/validate.test.ts`, new top-level describe
(objectstack-ai#34946): `record.` and `previous.` date arithmetic refused under
`date-arithmetic-run-fails` with full params (`operands`, `reference`
naming the read), and the evaluator faults on them over the run's scope.
CONTROL: the datetime field's root reads equal the bare name's verdict.
Arms: `run-may-fail` with no declared outcome, `run-fails` kept on a
root read when bare names are unproven or shadowed. CONTROL:
`record.due_date < today()`, `previous.due_date < today()`,
`date(record.due_date) < now()` and the prescribed rewrites
(`daysBetween(record.due_date, today()) > 5`, `addDays(record.due_date,
1) < today()`, `addDays(previous.due_date, -7) < today()`) are clean.
The date-text shapes keep their one finding (`date-text-call-run-fails`,
`date-text-arithmetic-run-fails`) and `record.title > 5` keeps
`type-mismatch-run-fails`.
- `packages/lint/src/validate-expressions.test.ts`, new top-level
describe: start, edge and `decision` conditions refuse `record.` /
`previous.` at the bare name's path and severity, with the bare name's
message and the reference swapped. Reported under `expression-invalid`
through `runAuthoringRules('build', …)`, the rule body the runtime
publish door runs. CONTROL: datetime root reads equal the bare name's
findings at all three sites; `record.due_date < today()` stays clean;
`timestamp(record.due_date) < now()` keeps exactly one date-text
finding.
-
`packages/services/service-automation/src/flow-registration-schema-e2e.test.ts`,
new top-level describe: `registerFlow` logs the date-arithmetic advisory
for `record.` / `previous.` as for the bare name and still registers.
CONTROL: an ordering against `today()` is not advised.

-
`packages/runtime/src/domains/meta-flow-condition-record-date-text.test.ts`,
new top-level describe (objectstack-ai#34946, added at `f278fece6f`): the publish door
(`publishMetaItem` over the real `ObjectQL` engine) refuses the bare
name, `record.due_date` and `previous.due_date` date arithmetic with
`INVALID_METADATA` / 422 and one date-arithmetic issue naming the read,
leaving the item draft. CONTROL: a datetime field's root reads take the
same refusal; `record.due_date < today()` publishes and goes active. The
loan fixture gains one required `date` field `due_date`. Runs at
`f278fece6f`: 4/4 passed; ablating the cel-engine record-root
`isDateArith` branch turns exactly the 2 new tests red, restored to the
HEAD blob with `git diff HEAD` empty and `ablation-dist-preflight
--absent` clean.

Publish door, first measured on head 4426723 as a scratch copy of the
same rig (now committed as the pin above):

| start condition | publish | date-arithmetic finding | row state |
|:---|:---|:---|:---|
| `due_date + 1 > 5` | `INVALID_METADATA` / 422 | `expression-invalid`,
`due_date` | draft |
| `record.due_date + 1 > 5` | `INVALID_METADATA` / 422 |
`expression-invalid`, `record.due_date` | draft |
| `previous.due_date + 1 > 5` | `INVALID_METADATA` / 422 |
`expression-invalid`, `previous.due_date` | draft |
| `picked_up_at + 1 > 5` (CONTROL) | `INVALID_METADATA` / 422 |
`expression-invalid`, `picked_up_at` | draft |
| `record.picked_up_at + 1 > 5` (CONTROL) | `INVALID_METADATA` / 422 |
`expression-invalid`, `record.picked_up_at` | draft |
| `previous.picked_up_at + 1 > 5` (CONTROL) | `INVALID_METADATA` / 422 |
`expression-invalid`, `previous.picked_up_at` | draft |
| `record.due_date < today()` (CONTROL) | published | none | active |

At `f278fece6f` (the patch round: changeset regrade and the runtime
pin): runtime pin 4/4 and its ablation as above; `dispatch-gates
--commands` 98 families derived (one more than at 4426723:
`check:route-envelope`); the families for the changed paths
(`check-adr-0087-registration`, `check-changeset-no-major`,
`check-empty-changeset`, `check:cross-package-test-inputs`,
`check:test-source-alias`, `check:tier-file-adoption`,
`check:route-envelope`) exit 0; `overlap-check` clean. The runs below
and the dogfood battery are from 4426723; the patch round changed
only the changeset and a runtime test file.

<details><summary>Local runs (head 4426723)</summary>

All under `scripts/pm/os-verify-lock.sh`, exit codes captured before any
pipe:

- `pnpm --filter @objectstack/formula build` exit 0; `pnpm --filter
@objectstack/formula test` exit 0, Test Files 70 passed (70), Tests 2067
passed (2067); `pnpm --filter @objectstack/formula typecheck` exit 0
(test layer: 7 errors held in `test-typecheck-debt.json`, unchanged).
- `pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2
src/validate-expressions.test.ts` exit 0, Tests 529 passed (529).
- `pnpm --filter @objectstack/service-automation exec vitest run
--maxWorkers=2 src/flow-registration-schema-e2e.test.ts` exit 0, Tests 7
passed (7).
- `pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2
src/migrations` exit 0, Test Files 5 passed (5), Tests 198 passed (198)
(spec built with the new entry; `gen:migration-registry` runs in its
build).
- `node scripts/pm/dispatch-gates.mjs --commands` derived 97 families
for this diff; all 97 run locally, reconciled with `--ran`: "97 derived,
97 run, 0 NOT-MEASURED, 0 UNRUN". `pnpm check:dual-build-cjs-loads`
first answered PREREQUISITE NOT MET (exit 3, no full build yet), then
exit 0 after `check:type-check-debt` built the tree; every other family
exit 0 on the first run.
- Dogfood battery (the `!` title), on head 4426723: `pnpm --filter
@objectstack/dogfood test` under the lock, VERDICT command-exit 0, Test
Files 484 passed, 3 skipped (487), Tests 4107 passed, 68 skipped (4175),
no failure.
- `test:repo` (vitest `repo` project) not run locally: the diff touches
none of its tests; it is CI's (`Test Core`).

</details>

<details><summary>Ablations (each committed first, mutated through
scripts/ablation-replace.mjs, restored to the HEAD blob)</summary>

1. Subject: the new `isDateArith` branch of the record-root pass
(`packages/formula/src/cel-engine.ts`). Anchor `if (rootTyped &&
isDateArith(rootTyped)) {` replaced by a never-true guard carrying
`ABLATED_34946` (anchor 1 to 0, blob `8eb099d83f32` to `4975d5dd3077`),
formula rebuilt, `ablation-dist-preflight.mjs @objectstack/formula
ABLATED_34946` exit 0 (the marker reached `dist/`, which the lint and
service-automation suites read). Red: formula `validate.test.ts` 3
failed / 236 passed (the three objectstack-ai#34946 verdict tests; the CONTROL for
orderings and date-text stayed green), lint 5 failed / 524 passed (all
five non-ordering objectstack-ai#34946 tests), service-automation 1 failed / 6 passed
(the advisory test). Restored: blob back to `8eb099d83f32` =
`HEAD:packages/formula/src/cel-engine.ts`, `git diff HEAD` empty,
rebuilt, preflight `--absent` exit 0, lint 529/529 again.
2. Subject: the root read's arm in `typeSoundnessIssue`
(`packages/formula/src/validate.ts`). Anchor `dateArm(scope,
faultOutcome, mismatch.root !== undefined ? false : bareNamesUnproven)`
replaced by `dateArm(scope, faultOutcome, bareNamesUnproven ...)` (blob
`aeedf005910e` to `b35d7d64bb2a`). Red: formula `validate.test.ts` 1
failed / 146 passed, the arm test (`record.due_date + 1 > 5` under
unproven bare names). Restored: blob `aeedf005910e` = HEAD, `git diff
HEAD` empty, 147/147.

</details>

## Acceptance notes

- Kept as before, deliberately: where bare names are unproven and a
source holds both a bare-name date-arithmetic fault and a root-read one
(`due_date + 1 > 5 && record.due_date + 1 > 5`), the first (bare)
verdict is reported, at `date-arithmetic-run-may-fail`. Still an error;
the swap-to-the-root-read step `typeSoundnessIssue` does for a bare type
mismatch was not extended to the date verdict.
- The field a multi-date expression names is best effort, as for the
bare name: `offendingRecordRead` names the first `timestamp` field read
through a root, in field-map order.
- Declarations follow the two closest precedents in this family (objectstack-ai#34935,
objectstack-ai#36207): `Metadata-protocol: narrowed` with a `minor` changeset
(regraded at `f278fece6f`).
- Carried by objectstack-ai#36377: contract review 7076631700 S1 (a bare date ordering
against text AND-ed before a `record.` date arithmetic still passes;
measured first on that card) and nits N1–N3.

## Verification

Read first, by risk:
1. `packages/formula/src/cel-engine.ts`, the new `isDateArith` branch of
`firstTypeMismatch`'s record-root pass (the narrowing itself).
2. `packages/formula/src/validate.ts`, the `dateArm` call in
`typeSoundnessIssue` (the root read's arm).
3.
`packages/spec/src/migrations/entries/semantic/18.flow-condition-record-date-arithmetic-refused.ts`
(the upgrade-guide text).

Two-minute check: `pnpm --filter @objectstack/formula exec vitest run
--maxWorkers=2 src/validate.test.ts -t 34946` shows 4 passing tests.

---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5pb2t8Z8C64PkPyVt1)_

<!-- signed: repo:objectstack#4 · os-project-manager ·
session_01FEkQ5krBqrrgxCYgjXmfbv -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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 size/xl 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.

3 participants