Skip to content

fix(formula)!: flow-condition verdicts agree with the run — severity, the index spelling, macro variables - #39072

Merged
os-zhuang merged 7 commits into
mainfrom
claude/issue-38959-flow-condition-verdicts
Dec 2, 2026
Merged

os-zhuang merged 7 commits into
mainfrom
claude/issue-38959-flow-condition-verdicts

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Part of #38959 — items 1, 5 and 2 are fixed here, item 3 is recorded as accepted fail-open (below), and item 4 (the wording of the date-against-text ordering verdict) is ruled (7344060050, option A: a refusal code of its own) and is built in a later Part of #38959 PR after this one lands.
Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none — skills/objectstack-formula/SKILL.md rule 5 already says the build refuses date arithmetic and a date field in a timestamp-only call, with no exception for a source that also carries a type mismatch; no skill teaches the index spelling, the type-mismatch warning, or ordering a macro variable over date fields

维护者速读

  • 用户能看到什么变化:编写流程的管理员在校验或发布流程时,以前「条件里同时有文本比数字的小问题和日期相减的大问题」只给一条警告就能发布、上线后每次运行都失败,现在会直接拒绝(字段显示条件、按钮显示条件、共享规则条件等记录级表达式也同样处理);用下标方式读取文本或布尔字段再和数字比较的写法,现在和点号写法一样被指出;对日期列表逐项和日期文本比较这种能正常运行的写法,在条件里不再被误拒;流程赋值里的取值表达式结论不变。
  • 为什么做:属于「表达式校验与作者护栏」,替编写流程的管理员和代写流程的 AI 助手解决「校验通过、上线后每次运行都出错」与「能运行却被拒」两类误判。
  • 出错会怎样:若误判,作者在校验或发布时会看到一条拒绝;已保存的流程照常加载注册(取值表达式的结论与改动前一致,不会因本改动在加载时被拒),只在下次发布时要求改写;本改动可整体撤回。
  • 要你做什么:这是收紧已接受写法的破坏性变更,待座位契约审核通过、试跑全套通过后,需要你本人审阅并合并;另有一项「日期与文本比较的提示文案」需要你拍板(见报告里的待决问题)。

What changes

All in @objectstack/formula (validate.ts, cel-engine.ts), plus the ADR-0087 semantic entry and the changeset.

  • Item 1, precedence (typeSoundnessIssue). The type check reports one finding per source and asked the text/boolean mismatch first; the date-text family was asked only when that answered null. Now, over a mismatch graded a warning (no declared outcome: a flow that is not record-triggered, bareNamesUnproven, and every record-scoped site with no fault outcome: a formula field expression, a field visibleWhen / settledWhen / uiReadonlyWhen, a field conditionalFormatting[].condition, a field group visibleWhen, an action visible / disabled / pressed, a sharing rule condition, the object uiReadonlyWhen), the date-text family is asked and its error wins. It is asked with the full field typing, then with only the date fields typed (text/boolean fields dyn), because the check reports its first fault and a mismatch met first masks the date-text fault behind it (record.title > 5 && due_date - borrow_date > ...). Only date-text-arithmetic* / date-text-call* errors are taken (never date-duration-value, pinned). Codes: date-text-arithmetic-run-may-fail / date-text-call-run-may-fail on a flow that is not record-triggered; under bareNamesUnproven, date-text-arithmetic-run-fails / date-text-call-run-fails over a record.FIELD read and the -run-may-fail codes over a bare one; date-text-arithmetic / date-text-call at a record-scoped site. A mismatch graded an error keeps its code and words (the record-triggered arm is unchanged), except one answered by an index read alone (item 5's new reach): there the date-text family is asked first, so every code the index spelling had from PR fix(formula)!: a flow condition's mixed bare / record. date arithmetic and record['FIELD'] index reads take the date-text verdicts #38949 is kept.
  • Item 5, index reads in the mismatch pass (firstTypeMismatch). The record-root pass now opens on RECORD_ROOT_DATE_TEXT_READ_RE (member or index) as well as RECORD_ROOT_READ_RE. Where only an index read opened it, it takes the text/boolean mismatch and nothing else: date arithmetic against a number stays the date-text family's (PR fix(formula)!: a flow condition's mixed bare / record. date arithmetic and record['FIELD'] index reads take the date-text verdicts #38949's codes), and the date-against-text-field ordering (S1, record['due_date'] > record['title'], which evaluates) is not judged (confirmAgainstDateText(..., keepUndeclared)), so S1 stays clean — that verdict is item 4's question. The index read is named by its member spelling, as the date-text pass already names it, also where a member read opened the pass (review S2): record['title'] > 5 && record.status == 'open' names record.title and takes type-mismatch-run-fails under bareNamesUnproven (it was the warning), and record['title'] > 5 && record.notes == 'n' names record.title (it named record.notes). Where two text fields are read the name is the first of them in the field table, for either spelling alike (stated limit N6, carried by flow condition checks: residual verdict gaps left by #38959 — a literal-element macro, the optional index, and mixed date arithmetic #39105: previous.notes > 5 && record['title'] == 'x' names record.title). Review S3, seat ruling (a): where the mismatch kept is the ordering of a date against a text field (the keepUndeclared survivor of confirmAgainstDateText, CEL: a datetime field is typed Timestamp at authoring (validate_expression, publish gate) but bound as an ISO string at runtime, so isoDate(record.<datetime>) passes every check and then refuses every write ("no matching overload for 'isoDate(string)'") #32595's verdict, which the run answers), an index read does not supply the name (keptOrdering), so record.due_date > record['title'], record['due_date'] > record['title'] && record.status == 'open' and record.due_date > title && record['notes'] == 'n' keep the base's type-mismatch-run-may-fail warning under bareNamesUnproven. Done together with item 1, never before it.
  • Item 2, macro variables (comparesDateTextAgainstUndeclared). A comparison that reads a variable a macro binds (all, exists, exists_one, map, filter) was kept as a mismatch unconditionally. The variable is now read as an element of the list it ranges over: the operand is checked with the variable replaced by RECEIVER[0] in the same env, inner macros shadowing the name. [due_date, record.borrow_date].exists(d, d > '2026-01-01') is no longer refused; [title].exists(t, t > 5) and [due_date].exists(d, d > title) keep the verdict their written-out forms take. Where the element does not check, the verdict is kept as before. This widens flow conditions and record-scoped sites only (review M1, seat ruling option a): firstTypeMismatch takes options.macroElements, and the flow value envelope's date-text check (flowValueEnvelopeDateTextIssue), which stands down when that check finds a mismatch, asks it with macroElements: false, the typing it had at the merge base. So [record.due_date].exists(d, d > '2026-01-01') ? isoDate(record.picked_up_at) : 'x' as an assignment value validates and registers as it did; no flow value envelope verdict changes.
  • packages/spec/src/migrations/entries/semantic/19.flow-condition-mismatch-warning-and-index-mismatch-refused.ts: the semantic entry (structured TODO, no mechanical rewrite), modelled on PR fix(formula)!: a flow condition's mixed bare / record. date arithmetic and record['FIELD'] index reads take the date-text verdicts #38949's.
  • .changeset/38959-flow-condition-verdicts.md and the entry name every site and code above, and say that no value envelope verdict changes.
  • .changeset/38959-flow-condition-verdicts.md: minor for formula and spec, both declaration lines, BREAKING banner, FROM → TO, the registration marker.

Tests

packages/formula/src/validate-date-text-arithmetic.test.ts, new top-level describe for #38959 (21 tests): the five hidden-refusal sources on both arms (no outcome: the date-text error alone; record-triggered: type-mismatch-run-fails unchanged) plus a no-date-fault control that stays a warning, the record-scoped formula arm; five index/member pairs equal on three arms with equal params, the member-parity row for record['due_date'] > 5, the masked index order, PR #38949's index codes kept on three arms; five macro sources clean on three arms and evaluating true, and three that keep their verdict. Second review round (+1 in the describe, 27 now; file 149): the three S3 sources on the unproven arm stay the base's warning and evaluate, with the member spelling's error as control (S3); [due_date].exists(d, d > [title].map(d, d)[0]) stays type-mismatch-run-fails, the pin for the inner.delete line (N3). First review round (+5 in the describe): an index read beside a member read on three arms, named record.title (S2); the family filter, date-duration-value under a mismatch warning stays the warning (N2); an inner macro rebinding the name, [due_date].exists(d, d >= [record.borrow_date].filter(d, d > '2026-01-01')[0]) clean and evaluating (N3); the bareNamesUnproven and record-scope codes (N4); the review's two value envelopes give the merge-base answer (ok) at validateExpression(..., { flowValueEnvelope: true }), with controls (M1). packages/services/service-automation/src/flow-registration-checks.test.ts: both values register at registerFlow, the date-text fault alone is refused (M1). packages/lint/src/validate-expressions.mismatch-precedence-38959.test.ts: a field visibleWhen, an action visible and a sharing rule condition take the date-text error, the mismatch alone stays a warning (S1). One PR #38949 assertion that pinned the old reach (previous['title'] > 5 not judged) is replaced by the new pin; its M1 and S1 tests are untouched and green.

Second review round at 8755c4d: suites, ablations, unproven differential, gates
  • At 8755c4de17 (no merge; origin/main not re-merged): packages/formula vitest 72 files, 2238 passed; pnpm typecheck exit 0; packages/lint vitest 261 files, 10323 passed; flow-registration-checks.test.ts 35 passed; packages/spec src/migrations 213 passed; migrate-meta-engine-guidance.test.ts 3 passed (it reddened once on a tracker id in the entry's guidance, now removed; the id stays in the changeset).
  • Ablations through scripts/ablation-replace.mjs (formula's two test files, 300 tests, each restored to the HEAD blob with git diff HEAD empty): unmutated 300 passed; S3 guard off (!keptOrdering to true) 1 failed; only the inner.delete(macro.name) line removed 1 failed (the review's N3 gap); the earlier set unchanged in kind: precedence off 10, index gate off 6, keepUndeclared off 1, dates-only off 2, macro element typing off 7, index-first date-text off 3, index-only date-arithmetic guard off 1, index naming off 9, family filter off 1, shadowing branch off 1, envelope gate dropped 1.
  • unproven differential, base (merge base, packages/formula identical to 2595004f2e) against this head: 10,725 generated conditions (an ordering or arithmetic over member, index, previous and bare reads of text, boolean, date, datetime and number fields and literals, alone and joined with && to six clauses true on the row): 9,529 same, 36 error to error (code or params), 512 warning to error, 516 clean to error, 132 clean to warning. Each move to a stronger grade was evaluated on a row that makes every neighbouring clause true (the && forces the moved clause to run): all 1,160 fault, 0 evaluate. Against the previous head 90c0977c55 the same set had 240 warning-to-error moves that evaluate, all the ordering of a date against a text field (S3); 0 now. The rt, none and sweep arms: every move faults; none weaker.
  • Corpus: 6,537 recorded calls 0 changed; 224 generated envelopes 0 changed.
  • check:adr-0087-registration exit 0; dispatch-gates --ran at 8755c4de17: 99 derived, 95 run with exit 0, 4 NOT MEASURED (check:dual-build-cjs-loads, check:query-options-erasure, check:slot-lookup, check:type-check-debt: over the foreground cap or needing a full build, not started).
First review round at 90c0977: suites, ablations, corpus, gates
  • At 90c0977c55 (origin/main 4b8a67d8fa merged in): packages/formula vitest 72 files, 2237 passed; pnpm typecheck exit 0; packages/lint vitest 261 files, 10323 passed; flow-registration-checks.test.ts 35 passed; migrate-meta-engine-guidance.test.ts 3 passed.
  • Ablations through scripts/ablation-replace.mjs (formula's two test files, 299 tests, each restored to the HEAD blob with git diff HEAD empty): unmutated 299 passed; precedence off 10 failed; index gate off 6; keepUndeclared off 1; dates-only pass off 2; macro element typing off 7; index-first date-text off 3; index-only date-arithmetic guard off 1; index naming off 9; family filter off 1 (review 9, was 0); inner-macro shadowing off 1 (review 10, was 0); envelope gate macroElements: false dropped 1; naming beside a member read back to !memberRead 1. With the formula rebuilt under the mutation: precedence off reds the lint pin 3 of 4, the envelope gate dropped reds the registration pin 2 of 35. The severity === 'error' half of the filter cannot red: every date-text verdict is an error today.
  • Corpus, base 2595004f2e vs this head: the 6,537 recorded calls (2,446 unique, 11 macros, 46 value envelopes, 14 index reads) 0 changed; controls 3 of 3 changed. Generated: 224 value envelopes joining 7 macros to 8 values, 0 changed; 147 conditions with an index read beside a member read on 5 arms: 495 same, 188 params only (reference added or corrected), 52 warning to error (all bareNamesUnproven), none weaker.
  • check:adr-0087-registration exit 0; dispatch-gates --ran: 99 derived, 95 run with exit 0, 4 NOT MEASURED (check:dual-build-cjs-loads needs a full build, check:query-options-erasure exit 124 at my 280s cap, check:slot-lookup and check:type-check-debt over the cap last round, not started).
First round: suite runs, ablations, door and corpus readings
  • pnpm exec vitest run --maxWorkers=2 in packages/formula: 72 files, 2232 passed. pnpm typecheck (formula, incl. check:test-typecheck): exit 0.
  • Lint suite against the head formula build: 260 files, 10318 passed. Service-automation files that read these verdicts (4): 140 passed.
  • Ablations (each mutation landed per scripts/ablation-replace.mjs, restored to the HEAD blob, git diff HEAD empty), two test files, 294 tests: precedence off 9 failed; index gate off 6 failed; keepUndeclared off 1 failed (the S1 control); macro element typing off 5 failed; date-only unmasking off 2 failed; index-first date-text off 3 failed (incl. PR fix(formula)!: a flow condition's mixed bare / record. date arithmetic and record['FIELD'] index reads take the date-text verdicts #38949's M1 test).
  • Door (os validate --json on a scratch defineStack project, one flow per source, record-triggered and a time-relative sweep of another object, all fields required), base 2595004f2e vs head: item 1 sources warning only → error (date arithmetic DateText - DateText, isoDate(...)); record['title'] > 5 and record['active'] + 1 > 3 clean → error / warning; the masked index order clean → error; the .exists source error / warning → clean. Unchanged: M1 index rows (refused), S1 rows (clean), record.due_date > record.title (refused), the nullable ternary (clean), record['due_date'] > 5 (clean, as its member spelling).
  • Corpus: 6,537 recorded validateExpression calls (the lint suite, os validate on the five examples, and the service-automation suite up to where I stopped it), 2,446 unique, re-judged base vs head: 0 changes. Positive controls appended to the same run: 3 of 3 change (item 1, item 5, item 2 sources), 1 of 1 control unchanged.

Acceptance notes

  • Carried elsewhere, not fixed here. flow value envelopes: a false macro type-mismatch switches off the date-text check, so a value that faults on every matching row registers clean #39107: the value-envelope shape (a macro over a date read joined to a date-text fault, in a value), which this PR keeps at its merge-base verdict; it awaits the maintainer. flow condition checks: residual verdict gaps left by #38959 — a literal-element macro, the optional index, and mixed date arithmetic #39105: the review's N1 (['2026-01-01'].exists(x, due_date > x) refused while it evaluates), N5 residual shapes, and N6, a stated limit: the name follows field-table order, not the operand at the faulting operator, so previous.notes > 5 && record['title'] == 'x' names record.title (it named previous.notes); naming by the operand is the follow-up there. flow expressions: a Timestamp minus date-text whose left operand is not a direct call (a ternary, a sum, an index) publishes clean and faults on every row #39104: item 3's wider shape (Timestamp minus date text with a left operand that is not a direct call faults on every row).

  • Item 3, accepted fail-open. (status == 'open' ? now() : null) - record.picked_up_at > duration('1h') passes and faults. Carrying the branch type cannot refuse it cleanly: typed as the branch, the check sees a Timestamp minus a date text, which the evaluator answers when it can see the Timestamp (now() - record.picked_up_at > duration('1h') evaluates). It faults because the null-ternary rewrite wraps the branch in dyn(...) and the evaluator's Timestamp-vs-date-text coercion does not look through it (dyn(now()) - record.picked_up_at faults the same way), and the null branch faults on its own (null - TEXT). Refusing it means modelling that wrapper in the check, which is not the branch type; the operand stays dyn and passes by the fail-open law.

  • Item 4, not done here. The verdict stays (its ruling). Its sentence is the type-mismatch* template, which says "against a number … the expression faults" and, per arm, that the run fails or the write is refused; none is true of an ordering that evaluates. expression-refusal.ts says a code names one template, so a true sentence needs its own code. Ruled 7344060050 (option A, a new refusal code); built in a later Part of #38959 PR, which also rewrites the two comments that still call the question open (review N8).

  • A date ordered against a number (due_date > 5, record.due_date > 5, record['due_date'] > 5, [due_date].exists(d, d > 5)) passes and faults in every spelling; the index spelling now takes its member verdict, which is clean. Reported, not fixed: a new verdict for every spelling.

  • Masked mismatch in the other direction: an ordering of a date against a number ahead of date arithmetic (due_date > 5 && due_date - borrow_date > ...) is not unmasked by this change.

Verification

First read (by risk): packages/formula/src/validate.ts (typeSoundnessIssue, dateTextOver), packages/formula/src/cel-engine.ts (firstTypeMismatch root pass with its keptOrdering naming guard and its macroElements option, comparesDateTextAgainstUndeclared), and flowValueEnvelopeDateTextIssue in validate.ts, the one caller that asks for the old macro typing, the new describe in validate-date-text-arithmetic.test.ts.

Two minutes: pnpm --filter @objectstack/formula exec vitest run --maxWorkers=2 src/validate-date-text-arithmetic.test.ts — expect 149 passed (27 in the describe named "flow-condition verdicts agree with the run").

Contract-tier review re-owed at the new head (narrowing), and the dogfood battery (! title).


Generated by Claude Code

…, macro variable typing

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

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/formula, @objectstack/spec, touching 7 documentable anchor(s).

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

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

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

Coarse fallback — 184 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 06d9353705596f0be9b051ccb78ea60a5b39c2e3 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 1903e7e9fe3de728b668a14f80ff7ad20f6eef80 — the merge of head 8755c4de17bee4926a35a402887701cf98b6458c into base 06d9353705596f0be9b051ccb78ea60a5b39c2e3, 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 1903e7e9fe3de728b668a14f80ff7ad20f6eef80 && git checkout 1903e7e9fe3de728b668a14f80ff7ad20f6eef80
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 06d9353705596f0be9b051ccb78ea60a5b39c2e3 8755c4de17bee4926a35a402887701cf98b6458c && git checkout -B drift-repro 06d9353705596f0be9b051ccb78ea60a5b39c2e3 && git merge --no-ff 8755c4de17bee4926a35a402887701cf98b6458c

node scripts/docs-audit/affected-docs.mjs --json 06d9353705596f0be9b051ccb78ea60a5b39c2e3

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

Contract-review-claim: session_01QSeKYnrQ7UMtHofKQVjcH2 · head 56432c0 · 2026-12-02T08:02Z

First contract review, on the dev's report 7338023136. CI is green at this head and the dogfood battery (opt-in) passed.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 56432c03d86eb0b726e24985b8c382fd18170bbf
Local-runs: probe — the brief orders base-and-head verdicts through a public door and a re-run of the dev's ablations; every command and its exit is listed at the end of ①
Scope: packages/spec/src/migrations/entries/semantic/19.flow-condition-mismatch-warning-and-index-mismatch-refused.ts + packages/formula/src/validate.ts, packages/formula/src/cel-engine.ts, packages/formula/src/validate-date-text-arithmetic.test.ts

① Derived judgments

Read against merge base 2595004f2ede140b6b22c01317adabf2cea7fa41 (5 files, +368/−52). @objectstack/formula was built at both ends and both builds were asked through three doors: validateExpression (the package's public entry), os validate --json on a scratch defineStack project (head CLI, formula build swapped under it), and registerFlow on the built service-automation. "Arms" below: rt = record-triggered flow, sweep = time-relative sweep of the typed object, none = a flow with no declared fault outcome (autolaunched), unproven = record-triggered with bareNamesUnproven, rec = record scope.

  • Item 1, a date-text fault no longer hides behind a mismatch warning — TRUE. due_date - borrow_date > duration('1h') && record.title > 5 and its reverse order, none arm: base warning type-mismatch-run-may-fail (publishes), head error date-text-arithmetic-run-may-fail naming due_date; title > 5 && isoDate(picked_up_at) == 'x': head date-text-call-run-may-fail. Every row faults at run time. Control record.title > 5 keeps the warning. On rt and sweep the source keeps type-mismatch-run-fails / type-mismatch-sweep-run-fails, as declared. Door: autolaunched flow i1b warning to error.
  • Item 5, an index read takes the mismatch verdict — TRUE for a source whose only record reads are index reads; not exact otherwise (S2). record['title'] > 5, record['active'] + 1 > 3, previous['title'] > 5: base clean on every arm; head type-mismatch-run-fails (rt, unproven), type-mismatch-sweep-run-fails (sweep), warning (none), params.reference = record.title / record.active / previous.title. The masked order record['title'] > 5 && record['due_date'] - record['borrow_date'] > duration('1h') goes clean to date-text-arithmetic-run-fails / -run-may-fail. The declared non-shapes hold: record['due_date'] > record['title'] clean on both sides, record['due_date'] > 5 clean on both, record.due_date > record.title refused on both, the index date-text codes unchanged.
  • Item 2, a macro variable is typed as an element of its list — TRUE for conditions; FALSE as "widening only" (M1). [due_date, record.borrow_date].exists(d, d > '2026-01-01'): base type-mismatch-run-fails (rt) / warning (none), head clean, evaluates true / false. [title].exists(t, t > 5) and [due_date].exists(d, d > title) keep type-mismatch-run-fails. The same change flips the stand-down gate of the flow value-envelope check: see M1.
  • Item 3, "accepted fail-open" — honest about the check, too narrow about the cause. now() - record.picked_up_at > duration('1h') is clean on both sides and evaluates. But the evaluator answers Timestamp minus date text only when the left operand is a direct call: (status == 'open' ? now() : today()) - record.picked_up_at > duration('1h'), (now() + duration('1h')) - record.picked_up_at > duration('1h') and [now()][0] - record.picked_up_at > duration('1h') are clean on both sides and fault on every row (no overload for Timestamp minus text), with no null and no dyn wrapper involved. Unchanged by this PR; escalated in ③.
  • Item 4 — not claimed. The PR and the changeset say it waits on a decision; nothing in the diff touches it.
  • Over-refusal hunt — none found in flow conditions. Generated differential, 18,467 sources × 5 arms = 92,335 judgments, each evaluated on 4 rows: 80,554 identical; every change is clean or warning to error, or clean to warning; none goes from error to a weaker verdict (the set holds no macro source; item 2 was probed apart). 36 judgments are newly refused with no faulting row of mine: all are X || record['title'] > 5 where X was true on my rows, and the member spelling is refused the same way on both sides. Two targeted hunts on the new dates-only typing (1,224 and 1,188 judgments, tolerated date shapes joined to a mismatch): no date-text refusal where the date part alone is clean or evaluates.
  • Index against member parity at head (7,431 sources, 29,724 judgments). Differences fall in four declared classes (index-only source takes the date-text code where the member takes type-mismatch; the unjudged date-against-text ordering; index date arithmetic keeps date-text-arithmetic) and one undeclared: with a member read also in the source, unproven arm, index type-mismatch-run-may-fail warning against member type-mismatch-run-fails error, 642 judgments (S2).
  • Corpus claim (6,537 sources, 0 changed) — reproduced in part, and it does not measure reach. With a recording shim I reproduced 3,290 (lint suite) and 361 (five examples) exactly; the 2,886 from service-automation I did not re-count. Examples: 311 unique, 27 flattened, 0 index reads, 1 macro, 0 mismatch verdicts. Lint: 1,529 unique, 13 typed index reads, 7 macros, 40 mismatch verdicts. 0 changed in both. os validate --json on the five examples is byte-identical base against head apart from duration. The corpus is the repo's own fixtures and examples and holds no source of the changed shapes, so "nobody is affected" is an estimate, not a measurement.
  • FROM → TO rows and the entry's replacement — hold. daysBetween(borrow_date, due_date) >= 1 && size(record.title) > 5, size(record['title']) > 5, record['active'] == true are clean on four arms and evaluate.
  • "The run-time evaluator is unchanged" — TRUE. The diff touches validate-only functions; evaluation results are identical base against head on every probe row.
  • "registerFlow logs it as an advisory and still registers the flow" — TRUE for conditions, FALSE for value envelopes (M1). Conditions of items 1 and 5: REGISTERS on both sides, one log line.

Local runs (exit in brackets):

  • gh api reads of issue 38959 and its comments, PR 39072, review comments 7315274427 and 7316294401, head check-runs [0 each]; head re-read at the end: still 56432c03, draft, 65 success, 17 skipped, 0 failing.
  • git fetch origin claude/issue-38959-flow-condition-verdicts, git fetch origin main, git merge-base, git diff, git show, git grep [0 each].
  • node scripts/pm/record-recognisers.mjs --template --paths ... [0].
  • git worktree add --detach /tmp/l2-39072 56432c03... and /tmp/l2-39072-base 2595004f... [0, 0]; pnpm install --frozen-lockfile --prefer-offline --ignore-scripts in each [0, 0].
  • pnpm turbo run build --filter=@objectstack/formula... head and base [0, 0]; --filter=@objectstack/cli... [0]; --filter='@objectstack/example-showcase^...' [0].
  • Formula probes p1 to p10, gen, parity, rejudge, fin under node [0 each].
  • os validate --json on the scratch project, base and head [1, 1: the fixture holds refused flows by design; one earlier run exited 1 on a schema error in my own fixture, fixed]; on the five examples, base and head [0 each; app-showcase 1 once for an unbuilt dependency, then 0].
  • node reg.mjs (registerFlow), base and head [0, 0].
  • Head vitest run src/validate-date-text-arithmetic.test.ts [0, 143 passed]; whole formula vitest run --maxWorkers=2 [0, 72 files, 2,232 passed]; formula tsc --noEmit [0]; spec tsc --noEmit [0]; lint suite under the recording shim [0, 260 files, 10,318 passed].
  • node scripts/check-adr-0087-registration.mjs --base 2595004f --head 56432c03 [0: one declared-breaking changeset, registered, one entry added at protocol major 19].
  • Ablations through scripts/ablation-replace.mjs: unmutated [0, 294 passed]; mutations 1 to 8 [1 each, as expected]; mutations 9 and 10 [0: not pinned]. Each restore verified by the tool (blob equals HEAD, git diff HEAD empty).
  • Scratch worktrees removed at the end; no file inside either repository checkout was left changed.

② Semver level

  • @objectstack/formula minor, @objectstack/spec minor — the right level for a declared narrowing under the repo's rule (a narrowing rides a minor with the ! title, the BREAKING banner and a registered entry). Clause-②: no (narrowing) and Metadata-protocol: narrowed are both on the changeset; exactly one adr-0087: registered marker, and its id equals the entry's id; the FROM → TO table and the one-line fix are present; the registration check exits 0.
  • Skills-docs: none — true. skills/objectstack-formula/SKILL.md rule 5 already states the refusal without an exception for a source carrying a mismatch; no skill or doc teaches the index spelling, the mismatch warning or a macro over date fields.
  • The declaration does not match what is refused in three places (M1, S1, S2) and its code list is short (N4). The level stands; the text does not.

③ Boundary flags

  • Who is newly refused, measured at a door. (a) A flow condition on a flow with no declared-fatal mismatch grade that carries both a mismatch and a date-text fault: warning to error at os validate. (b) A text or boolean mismatch spelled by index on a record-triggered flow or a sweep: clean to error; elsewhere clean to warning. (c) Record-scoped sites with no declared fault outcome: a formula field expression as declared, and also a field visibleWhen, an action visible and a sharing-rule condition, each measured warning to error and not declared (S1). (d) A typed flow value envelope whose source joins a macro over a date read with a date-text fault: clean to error, and refused at registration (M1).
  • Measured against estimated. The verdict changes are measured. How many stored sources carry them is estimated: the in-repo corpus holds none of the changed shapes. The HTTP publish door (INVALID_METADATA, 422) was not exercised by this review; os validate and registerFlow were.
  • Run-time against publish-time. For conditions the change is publish-time only: the evaluator is untouched and registerFlow stays advisory. M1 is the exception: a stored flow that registered at the merge base is refused at registration at this head.
  • Dev flag, item 3 accepted fail-open — answered in ①. The shape is wider than described and faults on every row; it needs a carrier of its own (a card), not a note. Escalated to the seat.
  • Dev out-of-scope finding, a date ordered against a number is unflagged in every spelling — confirmed: due_date > 5, record.due_date > 5, record['due_date'] > 5 are clean on both sides and fault on every row. Not this PR's to fix; needs a card.
  • open_questions item 4 — correctly left out of the diff; it awaits the maintainer.
  • Claim line against the PR. The implementation claim on the card reads Clause-②: no / Metadata-protocol: none; the PR and changeset read no (narrowing) / narrowed. The PR's reading is the right one; the seat reconciles the claim.
  • SQL push-down check: the diff reads no data; no query, id materialisation or join. No finding.
  • Author: the PR's user.login is objectstack-fleet[bot]; no off-relay author to name.
  • Untrusted text: no instruction-shaped text in the card, the PR body or their comments. Security: nothing in the diff teaches or changes permission, sharing or credential behaviour (the sharing-rule condition site in S1 changes a lint verdict only).
  • CI: all green at this head (65 success, 17 skipped, 0 failing). The PR is a draft.

④ Design judgment

  • packages/formula/src/validate.ts, the precedence (dateTextOver, lines 628-640, wrapped around the three mismatch returns). Small and correct for conditions. It asks the date-text family only when the mismatch is a warning or is answered by an index read alone, takes only an error of the date-text family, and asks twice: full typing, then dates-only typing where the mismatch met first would mask the date operand. The dates-only pass produced no false refusal in 2,412 targeted judgments. An error-grade mismatch keeps its code, as the entry says.
  • packages/formula/src/cel-engine.ts, the index gate (lines 1514-1530). Minimal: an index read opens the record-root pass; when no member read is present the pass does not keep undeclared operands and stands down on date arithmetic, so the pre-existing date-text codes survive; offendingRecordRead names the index read by its member spelling. Correct for index-only sources. With a member read present the old path runs unchanged, which is where S2 comes from.
  • packages/formula/src/cel-engine.ts, macro typing (macroOf, substitute, elementOf, lines 1045-1085). Correct for the declared widening, inner-macro shadowing included ([due_date].exists(d, d > [title].map(d, d)[0]) stays refused). It changes the answer firstTypeMismatch gives to another caller, flowValueEnvelopeDateTextIssue (validate.ts:1037, outside the diff, read): that function stands down when a mismatch is found, so a false mismatch used to switch the envelope's date-text check off. The diff takes the false mismatch away and the envelope check now answers (M1).
  • packages/formula/src/validate-date-text-arithmetic.test.ts. The pins assert substance: codes by equality, params.reference, and that the run faults or evaluates. Dev ablations reproduced exactly: unmutated 294 passed; precedence off 9 failed; index gate off 6; keepUndeclared off 1; dates-only pass off 2; macro element typing off 5; index-first naming off 3. Reviewer ablations: index-only date-arithmetic guard off 1 failed; index naming off 8 failed; date-text family filter off 0 failed (N2); inner-macro shadowing off 0 failed (N3).
  • packages/spec/src/migrations/entries/semantic/19...ts. A structured TODO is the right kind: no mechanical rewrite exists. surface, reason and acceptanceCriteria are accurate for conditions and formula fields. They are inaccurate where M1, S1, S2 and N4 say.

Findings:

  1. M1 (must-fix). Item 2 is declared as a widening only; it also narrows flow value envelopes and changes registration. [record.due_date].exists(d, d > '2026-01-01') ? isoDate(record.picked_up_at) : 'x' as an assignment value on a record-triggered flow: validateExpression('value', ..., { fieldTypes, flowValueEnvelope: true }) base ok, head date-text-call-value-run-may-fail; [record.due_date].exists(d, d > '2026-01-01') && record.due_date - record.borrow_date > duration('1h'): base ok, head date-text-arithmetic-value-run-may-fail. os validate: base clean, head error. registerFlow: base REGISTERS, head REFUSED AT REGISTRATION ("the flow does not register until every one is fixed"). Controls: isoDate(record.picked_up_at) alone is refused on both sides; the macro alone registers on both. The head's refusal is sound in itself (the source faults on every row where the macro answers true), but a stored flow that registered and ran at the merge base no longer loads, and this contradicts the changeset's Where ("registerFlow logs it as an advisory and still registers the flow, so a stored flow keeps its run-time behaviour"), the entry's acceptanceCriteria ("A stored flow carrying the shape still registers") and the PR body's statement that stored flows load as before. It is declared nowhere and pinned nowhere. Fix one of: (a) keep the envelope gate's merge-base answer, so item 2 only widens, and file the envelope shape apart; or (b) declare it: changeset, entry surface and acceptanceCriteria, PR body, with a pin at the envelope door and a registration reading. Whether (b) needs the maintainer's word, since it refuses stored metadata at load, is the seat's call.
  2. S1 (should-fix). The declared surface names flow conditions and "a formula field expression". Item 1 also turns warning into error at a field visibleWhen, an action visible and a sharing-rule condition (each measured at os validate, base warning type-mismatch, head error date-text-arithmetic / date-text-call); by reading, the same check() call in packages/lint/src/validate-expressions.ts serves settledWhen, conditionalFormatting, field-group visibleWhen and action disabled / pressed. The verdicts are sound (they equal what the source without the mismatch takes). Name these sites in the entry's surface and the changeset, and pin or measure one of them.
  3. S2 (should-fix). "An index read of record / previous now takes the verdict its member spelling takes, named by the member spelling" is not exact when a member read is also in the source. record['title'] > 5 && record.status == 'open', unproven arm: warning type-mismatch-run-may-fail (publishes, faults on every row that reaches the clause), while record['title'] > 5 alone and record.title > 5 && record.status == 'open' are type-mismatch-run-fails. On rt it is refused with no field named, and record['title'] > 5 && record.notes == 'n' names record.notes, the wrong field. Same as the merge base, so not a regression; the published sentence overstates. Close the gap (let the index read be found when a member read is present) or state the exception in the entry and changeset.
  4. N1 (nit). The mirror case ['2026-01-01'].exists(x, due_date > x) stays type-mismatch-run-fails on both sides while it evaluates; the element substitution loses the literal. Follow-up card.
  5. N2 (nit). The date-text family and severity filter in dateTextOver is unpinned (reviewer ablation 9: 0 of 294 failed).
  6. N3 (nit). The inner-macro shadowing branch of substitute is unpinned (reviewer ablation 10: 0 failed); behaviour verified right by probe.
  7. N4 (nit). The entry's code list is short: under bareNamesUnproven the new verdicts are date-text-arithmetic-run-fails / date-text-call-run-fails, and record scope also yields date-text-call.
  8. N5 (nit). Residual shapes, for a follow-up card: record[?'title'].orValue('') > 5 is newly judged but unnamed, a warning on unproven; title > 5 && due_date + copies > 5 stays a warning (the date part alone is unjudged); title > 5 && due_date + 1 > 5 takes date-text-arithmetic-run-may-fail where the date part alone takes date-arithmetic-run-may-fail.

Implemented-by: claude/issue-38959-flow-condition-verdicts
Reviewed-by: session_01QSeKYnrQ7UMtHofKQVjcH2

VERDICT: FAIL

…ead beside a member read

Review round on #38959: the envelope's date-text check asks the mismatch check
with the macro typing it had before, so item 2 only widens; an index read is
found and named where a member read also opens the record-root pass; pins for
the family filter, inner-macro shadowing, the unproven codes, three
record-scoped lint sites and the registration door; entry 19 and the
changeset name every site and code.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

Contract-review-claim: session_01QSeKYnrQ7UMtHofKQVjcH2 · head 90c0977 · 2026-12-02T10:01Z

Delta of record 7339916410 (FAIL), on the fix round reported in 7341783451 on #38959. The seat ruled M1 option (a) and amended the claim (Clause-②: no (narrowing), Metadata-protocol: narrowed; file surface widened by two test files). The PR body was patched by the seat with the dev's proposed text.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 90c0977c55a470a9c5b1099ee4f63b6570f817a7
Local-runs: probe — the delta had to be held to the merge base at the registration door and its new verdict moves measured against the run, on three formula builds; every command and its exit is listed at the end of ①
Scope: packages/spec/src/migrations/entries/semantic/19.flow-condition-mismatch-warning-and-index-mismatch-refused.ts + packages/formula/src/validate.ts, packages/formula/src/cel-engine.ts, packages/formula/src/validate-date-text-arithmetic.test.ts, packages/lint/src/validate-expressions.mismatch-precedence-38959.test.ts, packages/services/service-automation/src/flow-registration-checks.test.ts

Delta of record 7339916410 (FAIL at 56432c03), same reviewer session. What moved: fix commit 83eab2f50d (7 files, +266/−28), then origin/main 4b8a67d8fa merged in; the merge commit changes none of the PR's seven files. Three @objectstack/formula builds were compared: base (merge base 4b8a67d8fa; its packages/formula is byte-identical to the first round's base 2595004f2e), previous head (56432c03) and head. Arms as before: rt record-triggered, sweep, none (no declared outcome), unproven (bareNamesUnproven), rec record scope.

① Derived judgments

  • M1, the value envelope is held to the base — TRUE, at both doors. By reading: flowValueEnvelopeDateTextIssue (validate.ts:1037-1040) asks firstTypeMismatch with macroElements: false, and on that path comparesDateTextAgainstUndeclared returns at its first comparison reading a macro-bound name, which is the merge base's readsBound rule line for line; the record-scope pass has no other change. By measurement: 49,018 generated sources (150 macros over member, index and bare reads, joined to 76 values, in ternaries, conjunctions and equalities), typed envelope and untyped, 98,036 judgments compared as whole error lists (code, message, params): base against head 0 differ; base against previous head 1,140 differ, so the set sees M1. The two other calls registerFlow throws on (an untyped predicate, a template): 147,054 judgments, 0 differ. registerFlow on the built service-automation, each of those 1,140 sources plus 5 controls in an assignment value, an update_record field and a create_record field, 3,435 registrations: base and head agree on every one (3,429 register, 6 refused on both: the bare date-text controls); the previous head differed on 3,420. No stored flow of my set that registers at the base is refused at the head.
  • S1, every record-scoped site is named — TRUE. The entry and changeset list a formula expression, a field visibleWhen / settledWhen / uiReadonlyWhen, conditionalFormatting[].condition, a field group visibleWhen, an action visible / disabled / pressed, a sharing rule condition, the object uiReadonlyWhen. That is every call of check() in packages/lint/src/validate-expressions.ts that passes an object, record scope and no fault outcome (lines 4298, 4343, 4371, 4601, 4772-4780, 4858, and the formula call near 3993); the remaining no-outcome calls (a * hook, an app landing visible) carry no field types and cannot change. The new lint pin goes through validateStackExpressions at three of the sites.
  • S2, the index read beside a member read — TRUE for the shape it names; it reaches further than the text says (S3). record['title'] > 5 && record.status == 'open': unproven warning to type-mismatch-run-fails, named record.title on every arm; record['title'] > 5 && record.notes == 'n' now names record.title. Previous head against head over 395,818 conditions on five arms (1,824,048 judgments): on rt, sweep and none only params.reference moves (38,204 / 38,204 / 25,574); every verdict move is on unproven: 23,095 warning to type-mismatch-run-fails, and 11,538 error to error (date-text-arithmetic-run-fails or -run-may-fail to type-mismatch-run-fails, the mismatch being an error now and keeping its code). Every moved verdict equals what the member spelling takes at head, and the member spelling took it at the base already. Nothing is weaker than at the base except 9 judgments, all macro sources of item 2.
  • Are the unproven moves inside the declared narrowing — 21,149 of 23,093 are; 1,944 are not (S3). The warning-to-error moves again, less two macro sources, evaluated on rows that make every neighbouring clause true: 21,149 fault at run time (a text or boolean read by index in arithmetic or an ordering that has no overload). 1,944 evaluate on every row. All 1,944 are an ordering of a date or datetime against a text field, in three spellings: a member date against an index text (record.due_date > record['title']); an ordering spelled by index on both sides with an unrelated member read in the source (record['due_date'] > record['title'] && record.status == 'open'); a member date against a bare text name with an unrelated index read (record.due_date > title && record['notes'] == 'n', named record.notes). Through the publish lint, a record-triggered flow with a script node: base warning, previous head warning, head error, for all three.
  • N2 pinned — TRUE. Family filter off: 1 failed (was 0). The dev's note that the severity half cannot go red is right: every date-text verdict is an error today.
  • N3 pinned — in part. Removing the whole shadowing branch of substitute reds 1. Removing only its inner.delete(macro.name) line reds nothing: the pin's two lists are both dates. With the formula rebuilt under that mutation, [due_date].exists(d, d > [title].map(d, d)[0]) goes from type-mismatch-run-fails to clean; that source is the missing pin.
  • N4 code list — TRUE and pinned. unproven: date-text-arithmetic-run-fails / date-text-call-run-fails over a record.FIELD read, the -run-may-fail codes over a bare one; record scope: date-text-arithmetic / date-text-call.
  • Carriers — exist. flow condition checks: residual verdict gaps left by #38959 — a literal-element macro, the optional index, and mixed date arithmetic #39105 (N1, N5), flow expressions: a Timestamp minus date-text whose left operand is not a direct call (a ternary, a sum, an index) publishes clean and faults on every row #39104 (item 3's wider shape), flow value envelopes: a false macro type-mismatch switches off the date-text check, so a value that faults on every matching row registers clean #39107 (the envelope shape; its thread carries a ruling, option B: refuse at publish only, log at registration), flow conditions: a date or datetime ordered against a number publishes clean and faults at run time, in every spelling #39099 (a date ordered against a number). All four are open; the PR body names the first three, and flow condition checks: residual verdict gaps left by #38959 — a literal-element macro, the optional index, and mixed date arithmetic #39105 cites flow conditions: a date or datetime ordered against a number publishes clean and faults at run time, in every spelling #39099.
  • Dev corpus (6,537 calls, 0 changed; 224 envelopes 0 changed; 147 conditions, 52 warning to error, all unproven) — consistent with mine in kind; not re-counted. os validate --json on the five examples is identical base against head. The dev's count does not say whether each of the 52 faults; on my set 8.4% of such moves do not.

Local runs (exit in brackets):

  • gh api reads: PR 39072, comments 7341783451, 7341852780, 7341826721, 7339916410, card 38959, cards 39104 / 39105 / 39107 and the comments of 39107, head check-runs [0 each]; one gh search issues [1: GraphQL is not served here; not needed].
  • git fetch of the branch and main, git merge-base, git diff, git show, git log [0 each].
  • git worktree add --detach /tmp/l2-39072 90c0977c... [0]; pnpm install --frozen-lockfile --prefer-offline --ignore-scripts [0].
  • pnpm turbo run build for the cli, service-automation and lint closures [0, 70 tasks] and for the examples' dependencies [0, 78 tasks].
  • Formula at the previous head and at the base: git checkout SHA -- src in packages/formula, pnpm build [0, 0], git checkout HEAD -- src [0], git diff HEAD empty.
  • Probes under node: envelope and untyped-door differential [0], registerFlow on three builds [0 each; a first pass had a wrong filter in my update_record fixture, fixed and re-run], condition differential [0; it outran the 600 s foreground cap and finished in the background], unproven classification [0], targeted probes [0 each], publish-lint door on three builds [0 each].
  • Head vitest run --maxWorkers=2 in packages/formula [0: 72 files, 2,237 passed].
  • Ablations through scripts/ablation-replace.mjs, whole formula suite, each restore verified by the tool: envelope gate to macroElements: true [1: 1 failed]; the !macroElements guard off [1: 1]; naming back to !memberRead [1: 1]; family filter off [1: 1]; inner.delete line off [0: nothing red]; shadowing branch off [1: 1]; precedence off [1: 10]; index gate off [1: 6].
  • Door pins, formula rebuilt under the mutation: unmutated, lint pin [0: 4 passed] and registration pin [0: 35 passed]; precedence off, lint pin [1: 3 of 4 failed], registration pin [0] (the mutated build exited 1 at its declaration step on type errors my mutation introduced; the bundle was emitted); envelope gate dropped, registration pin [1: 2 of 35 failed], lint pin [0]; both pins green again after the restore [0, 0].
  • os validate --json on the five examples, base and head formula [0 each].
  • node scripts/check-adr-0087-registration.mjs --base 4b8a67d8 --head 90c0977c [0]; node scripts/pm/record-recognisers.mjs --template --paths ... [0].
  • Scratch worktree and probe files removed at the end; no repository checkout was left changed.

② Semver level

  • Unchanged and still right: @objectstack/formula minor, @objectstack/spec minor, ! title, BREAKING banner, Clause-②: no (narrowing), Metadata-protocol: narrowed, one registered marker whose id equals the entry's; the registration check exits 0 against the new merge base, where main has added another protocol-19 entry beside this one.
  • No public surface moved in the delta. firstTypeMismatch gained an optional fifth parameter; it is not exported from the package entry (absent from the built index.d.ts).
  • The declaration now matches what is refused, except S3. The changeset's Where and the entry's acceptanceCriteria say no value envelope verdict changes and registerFlow refuses no stored flow it registered before: measured true.

③ Boundary flags

  • Who is newly refused by the delta. Only authors on the unproven arm (a record-triggered flow or typed sweep with an open binder: script, connector_action, wait, subflow, map, or a screen with no input contract) whose condition reads a text or boolean field by index with a member read elsewhere in the source: warning to error at os validate and the publish door. Nobody at registration.
  • Measured against estimated. The moves are measured; their reach in stored metadata is estimated (the examples and the dev's corpus hold none).
  • Run-time against publish-time. Publish-time only. The evaluator is untouched by the delta, and registration equals the base.
  • Dev flag, pins outside the claimed file surface (packages/lint, packages/services/service-automation): answered by the seat's claim amendment 7341826721; both are test files, and the record's Scope: names them.
  • Dev flag, offendingRecordRead names the first field of the faulting type in the field table, stated in entry and changeset: the naming limit is stated. Its consequence for the grade under unproven is not: S3. A second consequence is new for the index spelling: previous.notes > 5 && record['title'] == 'x' named previous.notes, the operand, at the previous head and names record.title, an equality read, at head (N6).
  • Dev flag, four gates NOT MEASURED locally (check:dual-build-cjs-loads, check:query-options-erasure, check:slot-lookup, check:type-check-debt): CI at this head is 66 success, 13 skipped, 0 failing, 0 pending.
  • Dev deviation, base built as an esbuild bundle for the corpus: my base is the package's own tsup build of the merge-base source; the readings agree.
  • open_questions: none this round. Item 4 still awaits the maintainer, and S3 sits on the verdict item 4 is about.
  • Claim reconciled: the seat reports the claim amended to no (narrowing) / narrowed; the PR body and the changeset read so.
  • SQL push-down check: the delta reads no data. No finding.
  • Author: objectstack-fleet[bot]. Untrusted text: nothing instruction-shaped in the card, the PR body or the comments read. Security: none. The PR is a draft.

④ Design judgment

Findings:

  • M1: closed.
  • S1: closed.
  • S2: closed.
  • S3 (should-fix) — the S2 fix also refuses, on the unproven arm, an ordering of a date against a text field that the run answers, and the declaration does not say so. record.due_date > record['title'], record['due_date'] > record['title'] && record.status == 'open' and record.due_date > title && record['notes'] == 'n' (named record.notes, which takes no part in the ordering): warning at the base and at the previous head, type-mismatch-run-fails at head; each evaluates on every row; 1,944 of the 23,093 unproven moves on my set. The verdict equals the member spelling's, which CEL: a datetime field is typed Timestamp at authoring (validate_expression, publish gate) but bound as an ISO string at runtime, so isoDate(record.<datetime>) passes every check and then refuses every write ("no matching overload for 'isoDate(string)'") #32595 ruled and item 4 of the card leaves standing, so the move is consistent; but the changeset's banner says the refused shapes "published and then failed every run", the entry's shape (2) says "against a number", its acceptance criterion says the run was failing at the condition, and its "stays unjudged" sentence is false for the second source. Fix one of: (a) where the kept mismatch is the date-against-text ordering, do not let an index read supply the name, so these sources keep the warning they had, with a pin on the unproven arm; or (b) declare the move in the entry's surface and the changeset (the shape, the arm, that the run answers it, that the verdict is the member spelling's standing one), correct the "index read alone" sentence, and pin one source. Item 4 awaits the maintainer on this very verdict, so whether (b) can be taken without that word is the seat's call; (a) keeps this PR out of the question.
  • N3 (nit): the pin covers the shadowing branch, not its inner.delete line; [due_date].exists(d, d > [title].map(d, d)[0]) staying type-mismatch-run-fails is the one-line pin.
  • N6 (nit): the name follows field-table order, so an index read of an earlier text field now takes the name from the true operand (previous.notes > 5 && record['title'] == 'x'). Stated as a limit; no carrier yet. Naming by the operand at the faulting operator would close this and S3 together.
  • N2, N4: closed. N1, N5: carried by flow condition checks: residual verdict gaps left by #38959 — a literal-element macro, the optional index, and mixed date arithmetic #39105.

Implemented-by: claude/issue-38959-flow-condition-verdicts
Reviewed-by: session_01QSeKYnrQ7UMtHofKQVjcH2

VERDICT: FAIL

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

Seat ruling on S3 (delta record 7342784139) · 2026-12-02T10:39Z

Option (a). Where the kept mismatch is the date-against-text ordering (the keepUndeclared survivor of confirmAgainstDateText), an index read does not supply the name. Those sources keep the warning they had at the base on the unproven arm.

…dering

Review S3 on #38959: the name an index read supplied promoted the kept
ordering of a date against a text field (#32595's verdict, which the run
answers) from the warning to type-mismatch-run-fails under
bareNamesUnproven. Where the kept mismatch is that ordering only a member
read is named, as before. Pins for the three sources on the unproven arm
and for the inner macro's rebinding; entry 19 and the changeset state the
ordering and the naming limit.

Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2
Co-authored-by: Claude <noreply@anthropic.com>
The printed migration guidance may not cite a tracker id
(migrate-meta-engine-guidance); the naming limit's carrier is named in the
changeset instead.

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

Contract-review-claim: session_01QSeKYnrQ7UMtHofKQVjcH2 · head 8755c4d · 2026-12-02T11:36Z

Delta of record 7342784139 (FAIL: S3 open), on the fix round reported in 7344105740 on #38959. The seat ruled S3 option (a) in 7342800940. The PR body was patched by the seat with the dev's proposed text. Item 4 is now ruled (7344060050, option A, a new code) and is built after this PR lands, so it is not in this diff.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 8755c4de17bee4926a35a402887701cf98b6458c
Local-runs: probe — S3 had to be held to the merge base on the unproven arm and against the run, and the three earlier closures re-measured, on three formula builds; every command and its exit is listed at the end of ①
Scope: packages/spec/src/migrations/entries/semantic/19.flow-condition-mismatch-warning-and-index-mismatch-refused.ts + packages/formula/src/validate.ts, packages/formula/src/cel-engine.ts, packages/formula/src/validate-date-text-arithmetic.test.ts, packages/lint/src/validate-expressions.mismatch-precedence-38959.test.ts, packages/services/service-automation/src/flow-registration-checks.test.ts

Delta of record 7342784139 (FAIL at 90c0977c, S3 open; nits N3 and N6), same reviewer session. What moved: commits 84a0e45747 and 8755c4de17 on top of 90c0977c55, 4 files, +56/−12 (cel-engine.ts, the formula test file, entry 19, the changeset); main is not merged, the merge base is still 4b8a67d8fa. Three @objectstack/formula builds were compared: base (the merge base), previous head (90c0977c) and head; the first head (56432c03) served as the control for M1. Arms as before: rt record-triggered, sweep, none (no declared outcome), unproven (bareNamesUnproven), rec record scope.

① Derived judgments

  • S3, the three sources keep the base's warning on unproven, and each evaluates — TRUE. record.due_date > record['title'], record['due_date'] > record['title'] && record.status == 'open' and record.due_date > title && record['notes'] == 'n': head equals base as whole results (code, message, params) on rt, unproven, none and sweep; on unproven it is the type-mismatch-run-may-fail warning with no field named (previous head: type-mismatch-run-fails); each evaluates on all three probe rows. Through the publish lint (validateStackExpressions, a record-triggered flow with a script node before the decision): warning at the base, error at the previous head, warning at head, for all three. By reading: confirmAgainstDateText records keptOrdering only where it returns the mismatch through comparesDateTextAgainstUndeclared, resets it on every call, and the record-root pass, the last call, is the only reader; with it set, offendingRecordRead is asked for member reads only, which is the base's naming. A real index fault beside the ordering (... && record['notes'] > 5) leaves it unset and is still named and refused, and faults when reached.
  • The whole class moved back, not only the three — TRUE. Previous head against head, 395,819 conditions on four flattened arms and 240,777 on rec (1,824,053 judgments): on unproven 1,945 judgments go from type-mismatch-run-fails to the warning (the 1,944 of the last record and one macro source) and 420 change params.reference only; on rt, none and sweep 2,365 each change params.reference only; rec does not move. Every ordering of a date against a text field with an index read in the source, 39,000 judgments over five arms: identical to the base as whole results. The entry's "keeps the verdict it had" is measured true.
  • No new evaluating refusal on any arm — TRUE on my set, with one stated limit of the measure (N7). Base against head, 152,596 judgments take a stronger grade (rt 9,305; sweep 9,305; none 51,227; unproven 54,913; rec 27,846). Each was evaluated on three rows with every neighbouring clause true (text abc, zz and the numeric text 12): none evaluates on all three at head; 1,945 did at the previous head, all on unproven. Weaker than the base: 9 judgments, all macro sources of item 2. The limit: a text operand against a number faults on the rows abc and zz and is answered on the row 12, for the index spelling as for the member spelling the base already refuses.
  • The dev's differential (10,725 conditions on unproven; 1,160 stronger, all faulting, none evaluating; 0 weaker) — consistent with mine. Not re-counted on the dev's generator; my set is the larger one above and reads the same in kind and in direction.
  • S2's shapes keep their head verdicts — TRUE. record['title'] > 5 && record.status == 'open': type-mismatch-run-fails on unproven, named record.title; record['title'] > 5 && record.notes == 'n' named record.title; publish lint on the first of the two: warning at the base, error at the previous head and at head. record['title'] > record['active'], new in the entry's text: clean at the base, refused at head (warning on none), faults on all three rows.
  • M1 still closed — TRUE. 49,628 sources through the typed value envelope and untyped (99,256 judgments, the set extended with kept orderings in values): base against head 0 differ; base against the first head 1,140 differ, so the set still sees M1. The untyped predicate and the template: 148,884 judgments, 0 differ. registerFlow on the built service-automation, 3,447 registrations (1,140 moved sources and 9 controls in an assignment value, an update_record field and a create_record field): base and head agree on every one (3,441 register, 6 refused on both); the first head differed on 3,420.
  • S1 still closed — TRUE. The delta touches no site list; the entry and changeset still name every record-scoped site, and the lint pin is green.
  • N3 pinned — TRUE. [due_date].exists(d, d > [title].map(d, d)[0]) is pinned as type-mismatch-run-fails; with only the inner.delete(macro.name) line removed the suite reds 1 (0 at the previous head). The verdict is the same on all three builds.
  • N6 stated as a limit — TRUE in the entry; its carrier is not yet written (N9). previous.notes > 5 && record['title'] == 'x' names record.title, as the entry says. The entry carries no tracker id in its guidance (the CLI guidance test is green, 3 passed); the changeset and the PR body name flow condition checks: residual verdict gaps left by #38959 — a literal-element macro, the optional index, and mixed date arithmetic #39105, and flow condition checks: residual verdict gaps left by #38959 — a literal-element macro, the optional index, and mixed date arithmetic #39105's body lists four items (N1 and N5) and does not mention this one; it has no comments.
  • Entry and changeset against the code — TRUE, one phrase inexact (N7). Shape (2) now reads against a number or against a boolean, with a member read beside it, named by the first field of the faulting type in the field table; the ordering sentence reads unjudged with no member read, otherwise kept as before and named only by a member read; the three sources are listed. Read with its parenthesis the last sentence holds: a member read of a text field still names a kept ordering and makes it the error (record.due_date > record['title'] && record.notes == 'n', named record.notes), at the base and at head alike, which is the standing verdict and not a move of this PR.
  • Item 4, nothing in the diff contradicts ruling 7344060050 (option A) — TRUE. The verdict is kept exactly as at the base; keptOrdering isolates the very verdict the new code will rename; the pin and the changeset name type-mismatch-run-may-fail for it, which is true at this head, and the later PR owes its own changeset for the code move. Two comments and the PR body still call the question open (N8).

Local runs (exit in brackets):

  • gh api reads: PR 39072 and its body, comments 7344105740, 7344153246, 7342800940, 7344060050, 7342784139, cards 38959, 39104, 39105 (and its comments), 39107, 39099, head check-runs [0 each].
  • git fetch of the branch, git merge-base, git diff, git show, git log [0 each]; git worktree add --detach /tmp/l2-39072 8755c4de... [0]; pnpm install --frozen-lockfile --prefer-offline --ignore-scripts [0]; pnpm turbo run build for the cli, service-automation and lint closures [0].
  • Formula at the base, the first head and the previous head: git checkout SHA -- src in packages/formula, pnpm build [0 each], git checkout HEAD -- src [0], git diff HEAD empty.
  • Probes under node: targeted probes [0 each], the condition differential per arm in the background [0 on each of five arms], the envelope and untyped-door differential [0], registerFlow on base, first head and head [0 each], the publish-lint door on base, previous head and head [0 each, after two fixture corrections of mine: node labels, then the script node's function key, exit 2 each time before any judgment].
  • Head vitest run --maxWorkers=2 in packages/formula [0: 72 files, 2,238 passed].
  • Ablations through scripts/ablation-replace.mjs, whole formula suite, each restore verified by the tool and git diff HEAD empty: !keptOrdering to true [1: 1 failed, the S3 pin]; keptOrdering never recorded [1: 1]; index naming forced off [1: 9]; inner.delete line off [1: 1]; naming back to !memberRead [1: 1]; envelope gate to macroElements: true [1: 1]; family filter off [1: 1]; precedence off [1: 10]; index gate off [1: 6].
  • Pins at head, unmutated: lint pin [0: 4 passed], registration pin [0: 35 passed], packages/spec vitest run src/migrations [0: 213 passed], packages/cli vitest run test/migrate-meta-engine-guidance.test.ts [0: 3 passed].
  • node scripts/check-adr-0087-registration.mjs --base 4b8a67d8 --head 8755c4de [0]; node scripts/pm/record-recognisers.mjs --template --paths ... [0].
  • Not re-run this round: os validate --json on the five examples (identical base against head last round; the delta only returns verdicts to the base's).
  • Scratch worktree and probe files removed at the end; no repository checkout was left changed.

② Semver level

  • Unchanged and still right: @objectstack/formula minor, @objectstack/spec minor, ! title, BREAKING banner, Clause-②: no (narrowing), Metadata-protocol: narrowed, one registered marker whose id equals the entry's; the registration check exits 0 at this head.
  • The delta narrows nothing further. Against the previous head it only returns verdicts to the base's; against the base the refused set is the one the declaration names.
  • No public surface moved in the delta. keptOrdering is a local of firstTypeMismatch, which the package entry does not export.
  • The later item-4 PR is a separate level question: a new code in a closed vocabulary, with its own contract review and changeset, as the ruling says. Nothing here pre-empts it.

③ Boundary flags

  • Who is newly refused, against the base. As declared: a flow condition whose date-text fault was hidden behind a mismatch warning, and a text or boolean field read by index under arithmetic or an ordering against a number or a boolean. Under unproven the second is warning to error where a member read sits beside the index read. Nobody at registration.
  • A data-dependent case inside the declared shape, for the maintainer's eye. A text field whose stored values are numeric text is answered by the run under record['title'] > 5 (the engine retries numeric strings); such a flow worked on those rows and is now refused at publish, as its member spelling already is at the base. The shape is declared and the guidance (a number field, or an explicit conversion) fits it; only the phrase "faults on every row" does not (N7).
  • Measured against estimated. The moves are measured; their reach in stored metadata is estimated (the examples and the dev's corpus hold none).
  • Run-time against publish-time. Publish-time only. The evaluator is untouched, and registration equals the base.
  • Escalation, the carrier of N6. Seat ruling 7342800940 sends N6 to flow condition checks: residual verdict gaps left by #38959 — a literal-element macro, the optional index, and mixed date arithmetic #39105, and the changeset says so; the card's body does not carry it yet. One edit of flow condition checks: residual verdict gaps left by #38959 — a literal-element macro, the optional index, and mixed date arithmetic #39105 by the seat, before landing, makes the published sentence true.
  • Dev deviation, the third commit removes the tracker id from entry 19's guidance after the CLI guidance gate refused it; the id stays in the changeset. Read and agreed: the entry says "carried by its own card", the gate is green.
  • Dev deviation, worktree re-added on the existing local branch rather than through dev-worktree.sh: no bearing on the diff; the head I reviewed is the PR's.
  • Dev flag, four gates NOT MEASURED locally (check:dual-build-cjs-loads and three others, as last round): CI at this head is 66 success, 13 skipped, 0 failing, 0 pending.
  • open_questions: none. Item 4 is ruled (option A) and built later.
  • SQL push-down check: the delta reads no data. No finding.
  • Author: objectstack-fleet[bot]. Untrusted text: nothing instruction-shaped in the card, the PR body or the comments read. Security: none. The PR is a draft.

④ Design judgment

  • packages/formula/src/cel-engine.ts, keptOrdering. The right fix for option (a): the name is withheld from an index read exactly where the kept mismatch is the ordering the run answers, and nowhere else, so S2's naming stays for every faulting mismatch. It is a closure flag written as a side effect of confirmAgainstDateText and read after the last call; correct as written (reset on entry, one reader, no path that reads a stale value), though a returned pair would not depend on call order. Acceptable here: the item-4 PR rewrites this spot, and the flag is the distinction its new code needs.
  • packages/formula/src/validate-date-text-arithmetic.test.ts. The S3 pin asserts the code by equality on the three sources, that each evaluates, and a member-spelling control; the N3 pin asserts the one source. Each goes red under the mutation it is for.
  • packages/spec/src/migrations/entries/semantic/19...ts. The rewritten shape (2) and ordering sentence match the code as measured. One clause overstates (N7).
  • .changeset/38959-flow-condition-verdicts.md. Agrees with the entry sentence for sentence; carries the same clause (N7) and the carrier id (N9).

Findings:

No must-fix, no should-fix.

Final round under the only-nits rule: N7, N8 and N9 are recorded as accepted deviations, N8 riding the item-4 PR and N9 a card edit.

Implemented-by: claude/issue-38959-flow-condition-verdicts
Reviewed-by: session_01QSeKYnrQ7UMtHofKQVjcH2

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

L1 ACCEPT · PR #39072 (#38959) · head 8755c4de17bee4926a35a402887701cf98b6458c

席位核对 · ACCEPT

ACCEPT · repo:objectstack@os-justin · head 8755c4de17bee4926a35a402887701cf98b6458c

  1. Shape. Draft, base main. First line Part of #38959: items 1, 5 and 2 are fixed here, item 3 is recorded as accepted fail-open, and item 4 is ruled (7344060050, option A) and is built in a later Part of #38959 PR. No closing keyword; pm:dispatched stays on flow condition type verdicts: a type-mismatch warning hides a date-text refusal, .exists over date fields is refused while it runs, and a nullable-ternary minus date text passes and faults #38959 until item 4 lands.
  2. Contract record. Delta PASS 7344764746 at this head, on the FAIL before it. S3, M1, S1, S2 and N3 are closed and the record names the pins that hold them.
  3. Nits carried.
  4. Gates (check-runs at this head). 83 runs: 67 success, 15 skipped, 0 failed; Check Changeset re-ran after the body patch and is in progress at the time of writing. Dogfood battery: success (needs:dogfood-battery).
    • git merge-tree against current origin/main is clean.
    • landing-k: K = 2 < 15, no locale or shared-book leg.
  5. Landing. check-governed-merges --pr 39072: NOT governed, 0 of 7 paths. Size +649 / −51 = 700 lines; no other PR of flow condition type verdicts: a type-mismatch warning hides a date-text refusal, .exists over date fields is refused while it runs, and a nullable-ternary minus date text passes and faults #38959 has merged, so the card stands at 700 ≤ 3000.
    • The PR declares a narrowing (Clause-②: no (narrowing), Metadata-protocol: narrowed): sources that built before now fail the build. The seat does not arm auto-merge; it goes to the maintainer.

Clause-②: no (narrowing) · Metadata-protocol: narrowed

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2

维护者速读

Head-sha: 8755c4de17bee4926a35a402887701cf98b6458c

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

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants