Repository navigation
fix(showcase): notify slots on an optional user field complete the run when it is empty - #29099
Merged
Merged
Conversation
…hared flow-run kit (WIP) Co-Authored-By: Claude <noreply@anthropic.com>
…n when it is empty Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
|
domain:server#5 · os-project-manager · session_01FEkQ5oc56xChD6Wrc4cGSt 席位核对ACCEPT · The maintainer's standing authorisation for landing reviewed PRs, verbatim: 「按照 pm-dispatch 规则复核过的都授权」. 席位意见:与 diff 相符。示例应用里 8 个通知节点在字段为空时会让流程失败:关于记录本身的通知回退给组织 owner,只发给负责人的提醒在没有负责人时直接结束;预算审批的启动条件先判空。引擎、CEL、通知节点都没改。
|
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 #29028
Clause-②: no
Metadata-protocol: none
维护者速读
role:owner);只对经办人本人说的话("你被分配了"、"请更新任务"、"任务快到期")没有经办人就直接结束,不发。has(FIELD) ? FIELD : null在空字段上返回 null(触发记录上空字段是 null,has()为真),通知没有收件人就让整个运行失败,谁也收不到。参考应用教的正是这种无效写法。examples/app-showcase/src/automation/flows/index.ts(三个has_assignee决策节点、role:owner兜底、紧急任务的嵌套三元式);新测试examples/app-showcase/test/notify-recipient-optional-fields.test.ts;从 fix(showcase): escalation flow routes a project with no budget or no owner #29018 测试抽出的共用test/showcase-flow-run.testkit.ts。pnpm --filter @objectstack/example-showcase exec vitest run test/notify-recipient-optional-fields.test.ts,预期Tests 20 passed (20)。What changes
examples/app-showcase/src/automation/flows/index.ts, one row per measured notify slot (an empty field, the row as stored, on base6b3ba82c):showcase_task_completednotifyrecord.assigneeisBlank(record.assignee) ? 'role:owner' : record.assigneeshowcase_task_assigned_notifynotify_assigneerecord.assigneehas_assigneedecision,!isBlank(record.assignee)edge,isDefaultedge toendshowcase_task_follow_upremindrecord.assigneehas_assigneedecision after the wait, same shapeshowcase_project_closurenotify_ownerrecord.ownerisBlank(record.owner) ? 'role:owner' : record.ownershowcase_batch_reminderssend_remindertask.ownertry_catch, by designshowcase_fan_out_notifynotify_ownerrecord.assigneeisBlank(record.assignee) ? 'role:owner' : record.assigneeshowcase_nested_fan_out_remindersnotify_ownertask.ownerhas(task.owner) && !isBlank(task.owner) ? task.owner : 'role:owner'showcase_nested_fan_out_remindersnotify_watchertask.watchertask.watchershowcase_task_due_reminderremind_ownerrecord.assigneehas_assigneedecision, same shapeshowcase_urgent_task_alertalertrecord.assigneecurrent_useris the second recipient); fails on a system write!isBlank(record.assignee) ? record.assignee : current_user == null ? 'role:owner' : null(a user's write still alerts that user, unchanged)showcase_project_escalation: fix(showcase): escalation flow routes a project with no budget or no owner #29018 left nohas()slot.has_assigneedecision read plainrecord.assignee, as fix(showcase): escalation flow routes a project with no budget or no owner #29018'salert_ownerdoes. The notify node's required-recipient refusal is unchanged.showcase_budget_approval'sbudget > 100000 && budget != previous.budgetfaults (no such overload) when a budget is cleared (nullagainst a previous value); it is nowbudget != null && budget > 100000 && budget != previous.budget.showcase_committee_quorum'stotal_amount >= 5000is fine: the sum summary stores0on a report with no lines, measured.showcase_task_completedsummarize.inputs.priority;showcase_task_done_notify_ownercall_notify.input.ownerId;showcase_inbound_task_webhookcreate_task.fields.assigneeand.project. Writingnullis the correct answer there.examples/app-showcase/test/showcase-flow-run.testkit.ts(new): fix(showcase): escalation flow routes a project with no budget or no owner #29018's harness moved out of its test file, unchanged in behaviour, so both files share one kit (order: reuse it, no second harness).project-escalation-optional-fields.test.tsnow imports it.Tests
examples/app-showcase/test/notify-recipient-optional-fields.test.ts, 20 cases on the shared kit: per fixed flow an empty-field case (asserts the stored row readsnullfirst, the run completes, and the fallback audience or no notify) and a filled-field control that still notifies the field's user; plus the batch-reminders, quorum and urgent user-write readings that were already fine.showcase_project_closureruns with a stand-inshowcase_closure_signoffthat decides at once (same name and variables), because the real one waits on a manager approval; the parent flow and its notify are real.showcase_task_follow_upis run, parks at its timer wait, and is resumed withautomation.resume(runId).6b3ba82c, tests kept): 9 failed / 11 passed. Failing nodes:notify,notify_assignee,remind,notify_owner,fan_out(branchnotify_owner),remind_owner,alert(system write),fan_out_audiences(branchnotify_owner), eachnotify: at least one recipient is required …; andcondition failed to evaluate as CEL(budget). Restored: blob9f537eabequal to HEAD,git diff HEADempty.scripts/ablation-replace.mjs, each anchor hit once, each restored to blob9f537eabwithgit diff HEADempty), one guard per fixed flow, each run with-t FLOW: task_completed fallback →record.assignee: 1 failed; task_assigned edge →true: 1 failed; follow_up edge →true: 1 failed; closure fallback →record.owner: 1 failed; fan_out fallback →record.assignee: 1 failed; nested owner →task.owner: 1 failed; due_reminder edge →true: 1 failed; urgent →… : null: 1 failed; budget start guard dropped: 1 failed.dist/on the path: the tests import the flows fromsrc.Acceptance notes
pnpm validatestill warnsflow-loop-body-uncontainedonshowcase_nested_fan_out_reminders(notry_catchin the loop body). That is the flow's deliberate shape (its docblock: containment would retag the branch steps); with the fallback an empty recipient no longer fails a row, so the warning's failure mode no longer comes from these slots.showcase_task_done_notify_ownerhandsownerId: has(record.project.owner) ? record.project.owner : nullto theshowcase_notify_ownersubflow, whose notify then has no recipient on a project with no owner. Left alone per order ruling 3 (named as a field write); not measured here.Verification
Every run here and above is on
fb792a78(branch base6b3ba82c), each test command underos-verify-lock(VERDICT command-exit 0). The head7538f3e3mergesorigin/mainon top; that merge changes nothing underexamples/app-showcase/.pnpm --filter @objectstack/example-showcase test: Test Files 44 passed (44); Tests 538 passed (538). Thenpnpm validate: exit 0.pnpm --filter @objectstack/example-showcase typecheck: exit 0.eslint --no-inline-configon the four touched files: exit 0.dispatch-gates.mjs --commands --repo objectstack-ai/objectstack, derived on this diff): NOT MEASURED locally, reason: the maintainer asked to wrap up; CI runs the families.@objectstack/example-showcaseis"private": true, so nothing here ships;skip-changesetrides the create.Generated by Claude Code