Repository navigation
fix(formula): list-equality prescribes a rewrite that works at each site, and judges a flow condition only where the run binds the typed row - #36340
Conversation
…is read; flattened sites judged only on a proven row The `list-equality` refusal now spells its membership rewrite for the site and parenthesises it whole: - a `record.` / `previous.` read evaluated as CEL: has()-guarded `in`, which answers on a sparse row and a null `previous` instead of faulting; - a bare name at a flow condition: `!= null`-guarded `in`; - a sharing rule condition (new `ExprSchemaHint.filterCompiled`, filled by the publish lint): `.contains(...)`, which lowers to `$contains`; the CEL `in` form does not lower there (`in` needs a field on its left). At a flattened site the verdict needs `faultOutcome: 'run-fails'` (a record-triggered flow or a time-relative sweep of the typed object): an API, scheduled or trigger-less flow holds what its entrance handed it, where `labels == 'frontend'` can be correct code. registerFlow's advisory pass now declares that outcome on the same flows os validate does. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5miLqNucRZevceHwNh
📓 Docs Drift CheckThis PR changes 4 package(s): 13 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 4 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 175 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 b2ee3a5ae6fd526a113566c414de6564f7ea2d12 && git checkout b2ee3a5ae6fd526a113566c414de6564f7ea2d12
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 482afcc4df4774843b3ba863a8f7ad3eaffbd973 254d40cb40233500bc47152a1e91da62a451a324 && git checkout -B drift-repro 482afcc4df4774843b3ba863a8f7ad3eaffbd973 && git merge --no-ff 254d40cb40233500bc47152a1e91da62a451a324
node scripts/docs-audit/affected-docs.mjs --json 482afcc4df4774843b3ba863a8f7ad3eaffbd973
|
…st-equality-followup
…uality pins build fixtures that register The sharing-rule fixture named a recipient type the spec does not have and no rule type, so the three sharing-site cases stopped at the spec-validity guard. The API-flow control carried no hook secret, so registerFlow refused it before the advisory pass ran. Claude-Session: https://claude.ai/code/session_01QsR2jVXKcrF3rr7ShYFZ9E Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC Contract-review-claim: session_01QsR2jTeURPvEm465RcoYEC · head 254d40c · 2026-11-22T08:26Z |
|
repo:objectstack#7 · zhuangjianguo · session_01QsR2jS7jCv5PH4ytECQWqf L1 ACCEPT · head 维护者速读
席位核对
|
|
repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC Contract reviewServed-tier: Inputs read: card #36167 (body and all 14 comments), PR #36340 (body, both comments, 11-file list), the net diff against ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentHits file,
Implementing files, sentence by sentence:
S1 (should-fix) — Nits (no effect on correctness or the contract; left as follow-up, not fixed on this head):
Escalations for the seat (outside this diff, not graded here):
Implemented-by: VERDICT: PASS |
|
repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC Landing (seat 7, 2026-11-22T08:59Z): head |
Requested by Steedos · project thread
Fixes #36167
This is the card's last item: the builder half (#36185) and the validator half (#36207) are merged, and the remaining follow-ups have their own cards (#36217 skills text, #36218 review follow-ups, #36219 the as-you-type editor).
Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up #36217
维护者速读
What changes
Follow-up to #36207, which merged before its round-4 review findings were addressed. This PR covers four of them: r05 S1, r05 S2, r05 S4 / r06 N1, and r06 S1.
The prescribed rewrite is spelled for its site and parenthesised whole (
listMembershipRewriteinpackages/formula/src/validate.ts). Each spelling below was measured on the site's own evaluator or filter compiler:==rewrite!=rewriterecord./previous.read evaluated as CEL (validation rule, field rule, formula, actionvisible/disabled/pressed, hook condition)(has(record.f) && record.f != null && "v" in record.f)(!has(record.f) || record.f == null || !("v" in record.f))nullwhen empty)(f != null && "v" in f)(f == null || !("v" in f))condition, compiled to a query filter (newExprSchemaHint.filterCompiled, filled by the publish lint)(record.f != null && record.f.contains("v"))(record.f == null || !record.f.contains("v"))No single spelling works at every site, which is why the rewrite differs per site:
"v" in record.fdoes not lower to a filter.compileCelToFilteranswers "inrequires a field on the left (got literal)", so the sharing rule is dropped assharing-rule-unlowerable-condition.has()does not lower either ("unsupported operator call").record.f.contains("v")faults on a list, because there is nolist.containsoverload.record.f != null && "v" in record.ffaults on a row that lacks the key ("No such key"), which a sparse action row does. It also faults on a nullprevious, as on a create.The filter spelling lowers to
$and[{f:{$null:false}}, {f:{$contains:"v"}}]and$or[{f:{$null:true}}, {$not:{f:{$contains:"v"}}}].$containson a JSON-stored (multi-value) column is membership inmatchesFilterConditionand in driver-sql (sql-driver-17590-json-column-membership.test.ts). A number or boolean operand is passed as its text (contains("3")), since$containscompares text. The sharing-site message also says why==does not work there: the query filter refuses$eqagainst a list column.A flattened (flow) site is judged only where the run binds a row of the typed object (r06 S1).
checkListEqualitynow returns early at a'flattened'site unlessfaultOutcomeis'run-fails'. That outcome is declared only on a record-triggered flow, or on a time-relative sweep of the typed object: the lint'sfaultOutcomeOfledger,validate-expressions.tsaround line 1632. On any other flow (API, schedule, no trigger), the ledger's own row says the run "holds what its entrance handed it".seedRunVariablesflattens whatever record that is. So an API flow whose request body carries a stringlabelsrunslabels == 'frontend'correctly, and #36207 refused it. The MCP tool already passes this outcome forflow_condition(its defaulttriggerKindisrecord_change).registerFlow's advisory pass now passes it on the same flows (runBindsTypedRow, which this PR moves above the hint). Side effect: on those flows, the pass's logged type-mismatch lines take therun-failswording thatos validatealready prints. It still only logs and never throws.Docblocks (r05 S4 / r06 N1).
ExprSchemaHint.multiValueFieldsnow names the forms actually judged:record.f/previous.fand the bracket spelling;invalid-celfirst;run-fails, excludingflowVariablesandbareNamesUnproven;ExpressionRefusalParams['list-equality']now documentsreference(the bracket spelling rendersrecord.f; a bare name is the bare name) and the per-siterewrite.Semantic entry
cel-list-equality-refusednow has the per-site replacement text and the narrowed surface. The surface adds the sharing rule condition and limits flows to the proven-row ones.Tests
packages/formula/src/validate-list-equality-36167.test.ts[a,b]/[b]/[]/null/ absent, and withprevious = null. Each is also checked insiderecord.name == 'x' && …,record.name == 'y' && …andfalse || …, which pins the parenthesisation.compileCelToFilterand matched withmatchesFilterCondition(with the column declaredtags), including inside&&.inform is shown not to lower.record.reads,fail-closed/fail-open, plus a proven-site control.packages/formula/src/expression-refusal-codes.test.ts: the twolist-equalityPINS carry the new rewrites. Two new pins cover the bare name at a proven flattened site and thefilterCompiledsite, with params and the whole message.packages/lint/src/validate-expressions.list-equality-36167.test.ts:visiblerewrites pinned, and each validates clean;!=rewrite pinned in the parenthesised form and accepted insidestage == 'qa' && …;record.;condition: refused with thecontainsrewrite, and that rewrite draws no finding from the expression lint or fromvalidateSharingRuleEnforceability(it lowers);informs drawsharing-rule-unlowerable-conditionthere.packages/services/service-automation/src/list-equality-advisory-36167.test.ts:makeFlownow states its trigger (record-after-update);evaluateCondition, includingfalse && (…).254d40cb(they had never run; each stopped before the behaviour it pins):role) and no ruletype, so all three cases failed at the spec-validity guard. It now usestype: 'criteria'and ateamrecipient, as the other spec-valid sharing fixtures do;registerFlowrefused the flow before the advisory pass ran. It now names asecretRef(ADR-0041).packages/mcp/src/mcp-validate-expression.list-equality-36167.test.ts: theflow_conditionrewrite is pinned and validates clean. CONTROL:triggerKindapi/schedule/noneget no list-equality.Acceptance notes
Clause ② for this diff:
yes (widening). Two things widen:ExprSchemaHint.filterCompiled;Nothing in this diff refuses more. The changed rewrite text and the narrower flattened scope are not narrowings.
Metadata-protocol: addedbecause an accepted value is restored, so every package moved isminor.The driver-sql leg of the filter rewrite is cited, not run here:
$containsmembership on a JSON column is pinned insql-driver-17590-json-column-membership.test.ts, and$notis NULL-safe ($not的语义在 driver-sql 与 driver-memory / formula 之间分叉:NULL 行的去留相反,$not: {}一个是 TRUE 一个是 FALSE #5146). This PR measures the lowering andmatchesFilterCondition.Decision node
config.conditionin the lint: only the start node's gate and edge / branch conditions carry the flow's outcome. An inert node condition already has its ownflow-inert-node-conditionfinding, and gets no list-equality verdict.L2 S1 carried by review follow-ups of PR #36207 #36218 (scope !== 'record'); nits N1–N4 accepted.
Verification
Final head
254d40cb(handover head5a29954a+origin/mainmerged at2b570445+ the two fixture fixes). Every reading below is at that head.Package suites and pins
--filter '@objectstack/lint^...' --filter '@objectstack/mcp^...' --filter '@objectstack/service-automation^...' --filter '@objectstack/scenarios^...' build: lock VERDICT command-exit 0. Later a fullpnpm build --concurrency=2: 120/120 tasks, VERDICT command-exit 0.validate-list-equality-36167+expression-refusal-codes250/250 (the 8 bare-name failures of the handover run are gone); lintvalidate-expressions.list-equality-3616727/27 (3 failed before the fixture fix); mcpmcp-validate-expression.list-equality-3616715/15; service-automationlist-equality-advisory-3616722/22 (1 failed before the fixture fix).src/migrations5 files / 198 tests.Ablations (seven, each through ablation-replace WRAP mode under the lock)
Each mutation was proven on disk (anchor 1 to 0, blob changed) and restored (blob equal to the HEAD blob, empty
git diff HEAD). Every mutated module is read from source by its suite, so there is no dist leg.validate.tsfilterCompiledspellingvalidate.ts!=member-read rewritevalidate.tshas()from the==member-read rewritevalidate.tsfilterCompiledat the sharing rulevalidate-expressions.tsrun-failsflow-registration-checks.tsrun-failsflow-registration-checks.tsDerived gates
dispatch-gates --commandsat254d40cb: 96 families.dispatch-gates --ranwith recorded exit codes: 96 derived, 96 run, 0 NOT-MEASURED (a derived zero), every family exit 0.check-plugin-teardown-shape --self-test(exit 3 on the shallow clone until its pinned fixture commit was fetched, then exit 0); the climigrate-meta-engine-guidancevitest (exit 1, MODULE_NOT_FOUND on an unbuilt@objectstack/mcpdist, then 3/3 after the full build);check:dual-build-cjs-loads(exit 3 PREREQUISITE NOT MET, then exit 0 after the full build: 124 require entry points across 72 packages load).check:type-check-debtexit 0.check:nul-bytesOK.overlap-checkVERDICT clean exit 0 againstorigin/main2b570445and fix(formula)!: a flow condition's record. / previous. date arithmetic is refused as its bare name is #36333 (sharesvalidate.ts, merges cleanly).254d40cb: all 69 check-runs completed, every one success or skipped (Check Changeset, PR-body guards, Governed Surface Queue Guard, every Lint and Type Check lane, Test Core 10/10 shards, Test UI 16/16, Build Core, Dogfood Regression Gate).test:repowas not run locally (the diff touches no repo-project test); CI's Test Core ran it.Dogfood battery: n/a (no
!in the title, andClause-②: yes (widening)has no(narrowing)arm).Two-minute check:
pnpm --filter @objectstack/formula exec vitest run src/validate-list-equality-36167.test.ts. Expected: every test passes, including the "prescribed rewrite" and "no proven row" describes.Read first, by risk:
packages/formula/src/validate.ts:listMembershipRewriteand the early return incheckListEquality.packages/services/service-automation/src/flow-registration-checks.ts:faultOutcomeon the advisory hint.packages/lint/src/validate-expressions.ts: the sharing-rulecheck(…, true).🤖 Generated with Claude Code
https://claude.ai/code/session_01QsR2jVXKcrF3rr7ShYFZ9E