Repository navigation
fix(formula)!: flow-condition verdicts agree with the run — severity, the index spelling, macro variables - #39072
Conversation
…, 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>
📓 Docs Drift CheckThis PR changes 2 package(s): 22 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 1 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 184 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 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
|
|
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. |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: ① Derived judgmentsRead against merge base
Local runs (exit in brackets):
② Semver level
③ Boundary flags
④ Design judgment
Findings:
Implemented-by: 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>
…rdicts Claude-Session: https://claude.ai/code/session_01QSeKYnrQ7UMtHofKQVjcH2 Co-authored-by: Claude <noreply@anthropic.com>
|
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 ( |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: Delta of record 7339916410 (FAIL at ① Derived judgments
Local runs (exit in brackets):
② Semver level
③ Boundary flags
④ Design judgment
Findings:
Implemented-by: VERDICT: FAIL |
|
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
|
…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>
|
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. |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 Contract reviewServed-tier: Delta of record 7342784139 (FAIL at ① Derived judgments
Local runs (exit in brackets):
② Semver level
③ Boundary flags
④ Design judgment
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: VERDICT: PASS |
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 L1 ACCEPT · PR #39072 (#38959) · head 席位核对 · ACCEPTACCEPT · repo:objectstack@os-justin · head
|
|
repo:objectstack@os-justin · os-justin · session_01QSeKYnrQ7UMtHofKQVjcH2 维护者速读
Head-sha: |
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 #38959PR after this one lands.Clause-②: no (narrowing)
Metadata-protocol: narrowed
Skills-docs: none —
skills/objectstack-formula/SKILL.mdrule 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维护者速读
What changes
All in
@objectstack/formula(validate.ts,cel-engine.ts), plus the ADR-0087 semantic entry and the changeset.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 fieldexpression, a fieldvisibleWhen/settledWhen/uiReadonlyWhen, a fieldconditionalFormatting[].condition, a field groupvisibleWhen, an actionvisible/disabled/pressed, a sharing rulecondition, the objectuiReadonlyWhen), 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 fieldsdyn), 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 > ...). Onlydate-text-arithmetic*/date-text-call*errors are taken (neverdate-duration-value, pinned). Codes:date-text-arithmetic-run-may-fail/date-text-call-run-may-failon a flow that is not record-triggered; underbareNamesUnproven,date-text-arithmetic-run-fails/date-text-call-run-failsover arecord.FIELDread and the-run-may-failcodes over a bare one;date-text-arithmetic/date-text-callat 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.firstTypeMismatch). The record-root pass now opens onRECORD_ROOT_DATE_TEXT_READ_RE(member or index) as well asRECORD_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'namesrecord.titleand takestype-mismatch-run-failsunderbareNamesUnproven(it was the warning), andrecord['title'] > 5 && record.notes == 'n'namesrecord.title(it namedrecord.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'namesrecord.title). Review S3, seat ruling (a): where the mismatch kept is the ordering of a date against a text field (thekeepUndeclaredsurvivor ofconfirmAgainstDateText, 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), sorecord.due_date > record['title'],record['due_date'] > record['title'] && record.status == 'open'andrecord.due_date > title && record['notes'] == 'n'keep the base'stype-mismatch-run-may-failwarning underbareNamesUnproven. Done together with item 1, never before it.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 byRECEIVER[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):firstTypeMismatchtakesoptions.macroElements, and the flow value envelope's date-text check (flowValueEnvelopeDateTextIssue), which stands down when that check finds a mismatch, asks it withmacroElements: 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.mdand the entry name every site and code above, and say that no value envelope verdict changes..changeset/38959-flow-condition-verdicts.md:minorfor 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-failsunchanged) 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 forrecord['due_date'] > 5, the masked index order, PR #38949's index codes kept on three arms; five macro sources clean on three arms and evaluatingtrue, and three that keep their verdict. Second review round (+1 in the describe, 27 now; file 149): the three S3 sources on theunprovenarm 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])staystype-mismatch-run-fails, the pin for theinner.deleteline (N3). First review round (+5 in the describe): an index read beside a member read on three arms, namedrecord.title(S2); the family filter,date-duration-valueunder 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); thebareNamesUnprovenand record-scope codes (N4); the review's two value envelopes give the merge-base answer (ok) atvalidateExpression(..., { flowValueEnvelope: true }), with controls (M1).packages/services/service-automation/src/flow-registration-checks.test.ts: both values register atregisterFlow, the date-text fault alone is refused (M1).packages/lint/src/validate-expressions.mismatch-precedence-38959.test.ts: a fieldvisibleWhen, an actionvisibleand a sharing ruleconditiontake the date-text error, the mismatch alone stays a warning (S1). One PR #38949 assertion that pinned the old reach (previous['title'] > 5not 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
8755c4de17(no merge; origin/main not re-merged):packages/formulavitest 72 files, 2238 passed;pnpm typecheckexit 0;packages/lintvitest 261 files, 10323 passed;flow-registration-checks.test.ts35 passed;packages/specsrc/migrations213 passed;migrate-meta-engine-guidance.test.ts3 passed (it reddened once on a tracker id in the entry's guidance, now removed; the id stays in the changeset).scripts/ablation-replace.mjs(formula's two test files, 300 tests, each restored to the HEAD blob withgit diff HEADempty): unmutated 300 passed; S3 guard off (!keptOrderingtotrue) 1 failed; only theinner.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,keepUndeclaredoff 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.unprovendifferential, base (merge base,packages/formulaidentical to2595004f2e) against this head: 10,725 generated conditions (an ordering or arithmetic over member, index,previousand 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 head90c0977c55the same set had 240 warning-to-error moves that evaluate, all the ordering of a date against a text field (S3); 0 now. Thert,noneandsweeparms: every move faults; none weaker.check:adr-0087-registrationexit 0;dispatch-gates --ranat8755c4de17: 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
90c0977c55(origin/main4b8a67d8famerged in):packages/formulavitest 72 files, 2237 passed;pnpm typecheckexit 0;packages/lintvitest 261 files, 10323 passed;flow-registration-checks.test.ts35 passed;migrate-meta-engine-guidance.test.ts3 passed.scripts/ablation-replace.mjs(formula's two test files, 299 tests, each restored to the HEAD blob withgit diff HEADempty): unmutated 299 passed; precedence off 10 failed; index gate off 6;keepUndeclaredoff 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 gatemacroElements: falsedropped 1; naming beside a member read back to!memberRead1. 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. Theseverity === 'error'half of the filter cannot red: every date-text verdict is an error today.2595004f2evs 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 (referenceadded or corrected), 52 warning to error (allbareNamesUnproven), none weaker.check:adr-0087-registrationexit 0;dispatch-gates --ran: 99 derived, 95 run with exit 0, 4 NOT MEASURED (check:dual-build-cjs-loadsneeds a full build,check:query-options-erasureexit 124 at my 280s cap,check:slot-lookupandcheck:type-check-debtover the cap last round, not started).First round: suite runs, ablations, door and corpus readings
pnpm exec vitest run --maxWorkers=2inpackages/formula: 72 files, 2232 passed.pnpm typecheck(formula, incl.check:test-typecheck): exit 0.scripts/ablation-replace.mjs, restored to the HEAD blob,git diff HEADempty), two test files, 294 tests: precedence off 9 failed; index gate off 6 failed;keepUndeclaredoff 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).os validate --jsonon a scratchdefineStackproject, one flow per source, record-triggered and a time-relative sweep of another object, all fields required), base2595004f2evs head: item 1 sources warning only → error (date arithmetic DateText - DateText,isoDate(...));record['title'] > 5andrecord['active'] + 1 > 3clean → error / warning; the masked index order clean → error; the.existssource 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).validateExpressioncalls (the lint suite,os validateon 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, soprevious.notes > 5 && record['title'] == 'x'namesrecord.title(it namedprevious.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 indyn(...)and the evaluator's Timestamp-vs-date-text coercion does not look through it (dyn(now()) - record.picked_up_atfaults 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 staysdynand 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.tssays a code names one template, so a true sentence needs its own code. Ruled 7344060050 (option A, a new refusal code); built in a laterPart of #38959PR, 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(firstTypeMismatchroot pass with itskeptOrderingnaming guard and itsmacroElementsoption,comparesDateTextAgainstUndeclared), andflowValueEnvelopeDateTextIssueinvalidate.ts, the one caller that asks for the old macro typing, the new describe invalidate-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