Repository navigation
fix(showcase): escalation flow routes a project with no budget or no owner - #29018
Merged
Merged
Conversation
…owner The triage decision compared the optional budget unguarded, so a project with none failed the run at the decision. The critical edge now tests record.budget != null first and the normal edge is the decision's default. The owner notifies fall back to the organization's owners, and the critical branch's owner alert sits behind its own decision. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5kZjdnPFmYVCV7PUQU
This was referenced Nov 2, 2026
Contributor
Author
|
domain:server#5 · os-project-manager · session_01FEkQ5oc56xChD6Wrc4cGSt 席位核对ACCEPT · The maintainer's standing authorisation for landing reviewed PRs, verbatim: 「按照 pm-dispatch 规则复核过的都授权」. 席位意见:与 diff 相符。示例应用的项目升级流程不再因项目没有预算而整条失败:没预算走普通分支;没有负责人时,跳过负责人告警,或改发给组织所有者,升级通知总能送达。
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
domain:server#5 · os-project-manager · session_01FEkQ5oc56xChD6Wrc4cGSt
Requested by Leehom · project thread
Fixes #28951
Clause-②: no
Metadata-protocol: none
维护者速读
showcase_project_escalation)在项目没有预算或没有负责人时也能跑完。预算判断先确认有值再比较,"普通"分支改成决策的默认出口;没有负责人时,普通通知和收尾通知改发给组织所有者(role:owner),紧急分支里的负责人提醒放在自己的判断后面,没负责人就跳过(旁边的高管分支已经提醒了所有者)。null > int失败,没负责人的项目在通知节点失败,谁都收不到提醒。这是新用户照抄的参考应用,教的恰是错误写法。examples/app-showcase/src/automation/flows/index.ts的 e2/e3 两条边和 Owner 分支;新测试examples/app-showcase/test/project-escalation-optional-fields.test.ts。pnpm --filter @objectstack/example-showcase exec vitest run test/project-escalation-optional-fields.test.ts,预期Tests 7 passed (7)。What changes
examples/app-showcase/src/automation/flows/index.ts,ProjectEscalationFlow:critical) isrecord.budget != null && record.budget > 200000. e3 (normal) is thetriagedecision'sisDefault: trueedge, the "otherwise", so a project with no budget routes as the normal path. The flow's own wording ("Critical budget?") reads a project with no budget as not critical.Ownerregion starts with ahas_ownerdecision whose one edge (!isBlank(record.owner)) leads toalert_owner. A project with no owner skips that alert; theExecbranch beside it already alertsrole:owner, so a fallback there would alert the exec twice.notify_normalandconvergesend toisBlank(record.owner) ? 'role:owner' : record.owner, so the escalation reaches the organization's owners when the project has none. The notify node's required-recipient refusal is unchanged.has(record.budget)guards nothing here.examples/app-showcase/test/project-escalation-optional-fields.test.ts(7 cases).Why
The run's
recordis total over the object's declared fields, so a project with no budget carriesbudget: null. CEL has nonull > int, so the run failed attriage.has(record.owner) ? record.owner : nullanswerednullfor a project with no owner, becausehas()is true on a null column, and the notify refused a node with no recipient. Either way nobody was alerted, and the reference flow taught the unguarded comparison.Reading on the order's spelling: the order named
has(record.budget) && record.budget > 200000. Measured against the formula engine on{ budget: null }, that still faults (no such overload: dyn‹null› > int), becausehas()is true on a null key; the card's own log (dyn‹null›) shows the trigger record carries the key. So the guard is!= null, which is the spellingskills/objectstack-formulateaches (has()is NOT a null check), the spellingshowcase_project's own validation rules use (record.budget != null && …), and the one thevalidate-null-guardsgate accepts as dominating. The owner guard isisBlank(), so a cleared owner ('') routes the same asnull.Tests
ObjectKernelwith ObjectQL over sqlite and the automation plugin, the app's realshowcase_projectobject and real flow. Each case writes a project, turns it red through the data engine, and runs the flow on the row as stored (record, pluspreviousbefore the update), the way the record-change trigger hands it. Each case first asserts the stored row carries every optional field it left out asnull. Messaging is a recorder of the audience each notify hands over;fetchis stubbed for the incident push.notify_normalsuccess,alertskipped, both notifies to the owner;role:owner;'') → completes, both torole:owner;role:owner;notify_normalsuccess;alert_ownerskipped,alert_execsuccess, one critical alert, torole:owner;origin/main135054eb, test kept): 4 failed / 2 passed (blank-owner case added after this run). Failures:condition failed to evaluate as CEL: no such overload: dyn‹null› > int(no budget; neither),Node 'notify_normal' failed: notify: at least one recipient is required …(no owner),Node 'alert' failed: parallel 'alert': branch failed — Node 'alert_owner' failed: notify: …(critical, no owner). Both controls green.scripts/ablation-replace.mjs, anchor hit once, blob9272a372to9aa0d008): e2 back torecord.budget > 200000. 2 failed / 5 passed (no budget; neither). Restored: blob equal to HEAD (9272a372),git diff HEADempty.9272a372to900018be): thehas_owneredge condition replaced bytrue. 1 failed / 6 passed (critical, no owner). Restored the same way.dist/sits on the path: the test imports the flow fromsrc.Acceptance notes
pnpm dev -- --freshinexamples/app-showcase, the card's steps: create a project as admin,PATCH /api/v1/data/showcase_project/ID {"health":"red"}→ 200, three projects: no budget, no owner, control):135054eb): twoERROR Trigger-fired run of flow 'showcase_project_escalation' failed (trigger 'record_change')lines,{"error":"condition failed to evaluate as CEL: no such overload: dyn‹null› > int … source: budget > 200000 …"}and{"error":"Node 'notify_normal' failed: notify: at least one recipient is required … has(record.owner) ? record.owner : null …"}.GET /api/v1/automation/showcase_project_escalation/runs:completed,failed,failed.completed, eachstart, triage success → alert skipped → notify_normal success → converge success.src/automation/**conditions: this flow's e2 (fixed), and three outside it, not changed here:showcase_budget_approvalstart conditionbudget > 100000 && budget != previous.budget: a project with no budget faults it. In the live base run above it logged nothing at the default level and the flow did not fire, which is the right outcome for a project with no budget. Its e4/e5 (budget > 500000/<= 500000) are reached only after that start condition held, sobudgetis set there.showcase_committee_quorumstart condition… && total_amount >= 5000:total_amountis a sum summary; whether it readsnullon a report with no lines is not measured.has(FIELD) ? FIELD : nullguard is the recipient of ten other notify slots in this file, on other flows (assignee,owner,task.owner,task.watcher). It answersnullon a null column the same way, which leaves that notify with no recipient; whether each is reachable with the field empty is not measured. (Four more slots write the guarded value into a field, wherenullis a valid answer.)flow-decision-*rules areinclusive-overlap,mode-invalid,unconditional-branch). The publish-time null-guard gate (packages/lint/src/validate-null-guards.ts) would have refused this comparison, but its surface ledger still lists flow / edgeconditionas excluded (the totality blocker is gone since #4649 的「记录对已声明字段全量」只落在两个接缝上 —— 另外三处求值仍是稀疏绑定 #4953; the widening was tracked on null-guard 闸门(#4763)只覆盖了校验规则与 hook 条件 —— action / flow 条件两面待定,formula 面待判 #4811, now closed). Reported to the seat as a finding; no engine or lint change here, per the order.Verification
Run on
39cd0102, which mergesorigin/mainat00d0668d(branch base135054eb); every run below is on that tree.origin/mainhas since moved by 7 commits, none underexamples/app-showcase/. Each test command underos-verify-lock(VERDICT command-exit 0).pnpm --filter @objectstack/example-showcase test: Test Files 43 passed (43); Tests 518 passed (518).pnpm --filter @objectstack/example-showcase typecheck: exit 0.pnpm --filter @objectstack/example-showcase validate: exit 0; no row namesshowcase_project_escalation.eslint --no-inline-configon the two touched files: exit 0.dispatch-gates.mjs --commands --repo objectstack-ai/objectstack, 40 families, each exit captured before any pipe), reconciled:✓ dispatch-gates --ran: 40 derived famil(ies) accounted for — 39 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3). NOT MEASURED:check:dual-build-cjs-loads, reason: it requires every published package'sdist/. It first read 3 (seven packages unbuilt in this worktree); after building them it read 1 with 82Cannot find module '../chunk-….js'findings across packages this diff does not touch (overlapping local rebuilds left stale chunk references). This diff changes no published package, so CI's fresh build is the reading.@objectstack/example-showcaseis"private": true, so nothing here ships;skip-changesetrides the create.Human Minimum
None; the seat lands it.
Generated by Claude Code