Skip to content

fix(showcase): notify slots on an optional user field complete the run when it is empty - #29099

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-29vxs6
Nov 2, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-29vxs6

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

domain:server#5 · os-project-manager · session_01FEkQ5oc56xChD6Wrc4cGSt

Requested by Leehom · project thread

Fixes #29028

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:showcase 里 8 个流程的通知在负责人/经办人字段为空时也能跑完,外加预算审批流程的启动条件先判空再比较。关于记录本身的提醒(任务完成、项目结项、并行通知、紧急任务的系统写入、嵌套循环提醒)改发给组织所有者(role:owner);只对经办人本人说的话("你被分配了"、"请更新任务"、"任务快到期")没有经办人就直接结束,不发。
  • 为什么改:has(FIELD) ? FIELD : null 在空字段上返回 null(触发记录上空字段是 null,has() 为真),通知没有收件人就让整个运行失败,谁也收不到。参考应用教的正是这种无效写法。
  • 风险与回滚:只动示例应用(私有包,不发布),不碰引擎、CEL 和通知节点,通知节点"至少一个收件人"的拒收不变。回滚即 revert。
  • 先看: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 base 6b3ba82c):

Flow Node Field Base Reading Fix
showcase_task_completed notify record.assignee fails a notice about the record isBlank(record.assignee) ? 'role:owner' : record.assignee
showcase_task_assigned_notify notify_assignee record.assignee fails (unassigning a task) "you have been assigned": assignee only has_assignee decision, !isBlank(record.assignee) edge, isDefault edge to end
showcase_task_follow_up remind record.assignee fails (after the wait resumes) "please update its status": assignee only has_assignee decision after the wait, same shape
showcase_project_closure notify_owner record.owner fails (after sign-off) the decision needs a reader isBlank(record.owner) ? 'role:owner' : record.owner
showcase_batch_reminders send_reminder task.owner completes each iteration sits in its try_catch, by design none
showcase_fan_out_notify notify_owner record.assignee fails (the failed branch fails the block, the Slack post with it) a notice about the record isBlank(record.assignee) ? 'role:owner' : record.assignee
showcase_nested_fan_out_reminders notify_owner task.owner fails (ends the sweep) loop rows are caller data, so the key may be absent has(task.owner) && !isBlank(task.owner) ? task.owner : 'role:owner'
showcase_nested_fan_out_reminders notify_watcher task.watcher fails same same spelling on task.watcher
showcase_task_due_reminder remind_owner record.assignee fails "your task is due": assignee only has_assignee decision, same shape
showcase_urgent_task_alert alert record.assignee completes on a user's write (current_user is the second recipient); fails on a system write a notice about the record !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 no has() slot.
  • The guarded notifies after a has_assignee decision read plain record.assignee, as fix(showcase): escalation flow routes a project with no budget or no owner #29018's alert_owner does. The notify node's required-recipient refusal is unchanged.
  • Start conditions: showcase_budget_approval's budget > 100000 && budget != previous.budget faults (no such overload) when a budget is cleared (null against a previous value); it is now budget != null && budget > 100000 && budget != previous.budget. showcase_committee_quorum's total_amount >= 5000 is fine: the sum summary stores 0 on a report with no lines, measured.
  • Field writes left alone (order ruling 3): showcase_task_completed summarize.inputs.priority; showcase_task_done_notify_owner call_notify.input.ownerId; showcase_inbound_task_webhook create_task.fields.assignee and .project. Writing null is 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.ts now imports it.

Tests

  • New 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 reads null first, 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_closure runs with a stand-in showcase_closure_signoff that 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_up is run, parks at its timer wait, and is resumed with automation.resume(runId).
  • Red on base (flows file at 6b3ba82c, tests kept): 9 failed / 11 passed. Failing nodes: notify, notify_assignee, remind, notify_owner, fan_out (branch notify_owner), remind_owner, alert (system write), fan_out_audiences (branch notify_owner), each notify: at least one recipient is required …; and condition failed to evaluate as CEL (budget). Restored: blob 9f537eab equal to HEAD, git diff HEAD empty.
  • Ablations (scripts/ablation-replace.mjs, each anchor hit once, each restored to blob 9f537eab with git diff HEAD empty), 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.
  • No dist/ on the path: the tests import the flows from src.

Acceptance notes

  • pnpm validate still warns flow-loop-body-uncontained on showcase_nested_fan_out_reminders (no try_catch in 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_owner hands ownerId: has(record.project.owner) ? record.project.owner : null to the showcase_notify_owner subflow, 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 base 6b3ba82c), each test command under os-verify-lock (VERDICT command-exit 0). The head 7538f3e3 merges origin/main on top; that merge changes nothing under examples/app-showcase/.

  • pnpm --filter @objectstack/example-showcase test: Test Files 44 passed (44); Tests 538 passed (538). Then pnpm validate: exit 0.
  • pnpm --filter @objectstack/example-showcase typecheck: exit 0.
  • eslint --no-inline-config on the four touched files: exit 0.
  • Derived gates (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.
  • Changeset: none. @objectstack/example-showcase is "private": true, so nothing here ships; skip-changeset rides the create.

Generated by Claude Code

…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>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-project-manager · session_01FEkQ5oc56xChD6Wrc4cGSt

席位核对

ACCEPT · domain:server seat 5 · os-project-manager · session_01FEkQ5oc56xChD6Wrc4cGSt · 2026-11-02T07:19Z · head 7538f3e3 · #29028

The maintainer's standing authorisation for landing reviewed PRs, verbatim: 「按照 pm-dispatch 规则复核过的都授权」.

席位意见:与 diff 相符。示例应用里 8 个通知节点在字段为空时会让流程失败:关于记录本身的通知回退给组织 owner,只发给负责人的提醒在没有负责人时直接结束;预算审批的启动条件先判空。引擎、CEL、通知节点都没改。

  1. Shape: draft against main, Fixes #29028, skip-changeset (examples/app-showcase ships no package, as with PR fix(showcase): escalation flow routes a project with no budget or no owner #29018); Clause-②: no, Metadata-protocol: none. No contract review owed. check-governed-merges --pr 29099: NOT governed, 4 paths, +556 / -107. git merge-tree against main: clean.
  2. Against the order:
    • Ruling 1. All 10 slots measured. 8 failed the run on an empty field. batch_reminders, and the urgent alert on a user write, were fine.
    • Ruling 2.
      • Notices about the record use isBlank(FIELD) ? 'role:owner' : FIELD, the fix(showcase): escalation flow routes a project with no budget or no owner #29018 spelling.
      • The assignee-only messages (assigned, follow-up, due) take a has_assignee decision, where !isBlank(record.assignee) goes to the notify and the default edge goes to end.
      • The nested-fan-out rows are caller data, so they also guard an absent key: has(...) && !isBlank(...).
      • The notify node's refusal is untouched.
    • Ruling 3. The has() field writes are left as they are.
    • Ruling 4. budget_approval's start condition now reads budget != null && …. committee_quorum is fine because a sum stores 0.
    • The ProjectEscalationFlow harness moved into a shared showcase-flow-run.testkit.ts, reused by both tests (one harness, as the order asked).
  3. Accepted deviations: none.
  4. Gates: red on base 9/20, green 20/20, and 9 ablations, each red and then restored. Full showcase suite 538/538. Validate, typecheck and eslint exit 0. Derived gate families were NOT MEASURED locally (the dev stopped at the maintainer's wrap-up), so this head's check-runs stand in for them. They were still running at ACCEPT, and auto-merge waits on every required one.
  5. Out of scope: task_done_notify_owner writes ownerId into a subflow notify that has no recipient on an ownerless project. It was kept per ruling 3, and is not filed during the dispatch pause.
  6. Landing: pr_ready + automerge_enable through the relay.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 2, 2026 07:20
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 2, 2026 07:20
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 4550091 Nov 2, 2026
47 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-29vxs6 branch November 2, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l skip-changeset PR has no user-facing published change; bypasses the changeset gate tests

Projects

None yet

1 participant