Skip to content

fix(showcase): escalation flow routes a project with no budget or no owner - #29018

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

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-zxfajt

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

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

Requested by Leehom · project thread

Fixes #28951

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:showcase 的项目升级流程(showcase_project_escalation)在项目没有预算或没有负责人时也能跑完。预算判断先确认有值再比较,"普通"分支改成决策的默认出口;没有负责人时,普通通知和收尾通知改发给组织所有者(role:owner),紧急分支里的负责人提醒放在自己的判断后面,没负责人就跳过(旁边的高管分支已经提醒了所有者)。
  • 为什么改:项目一变红,没预算的项目在决策节点就报 CEL null > int 失败,没负责人的项目在通知节点失败,谁都收不到提醒。这是新用户照抄的参考应用,教的恰是错误写法。
  • 风险与回滚:只动示例应用(私有包,不发布),不碰引擎和 CEL。回滚即 revert。
  • 先看: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:
    • e2 (critical) is record.budget != null && record.budget > 200000. e3 (normal) is the triage decision's isDefault: true edge, 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.
    • The critical branch's Owner region starts with a has_owner decision whose one edge (!isBlank(record.owner)) leads to alert_owner. A project with no owner skips that alert; the Exec branch beside it already alerts role:owner, so a fallback there would alert the exec twice.
    • notify_normal and converge send to isBlank(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.
    • The docblock says why has(record.budget) guards nothing here.
  • New examples/app-showcase/test/project-escalation-optional-fields.test.ts (7 cases).

Why

The run's record is total over the object's declared fields, so a project with no budget carries budget: null. CEL has no null > int, so the run failed at triage. has(record.owner) ? record.owner : null answered null for a project with no owner, because has() 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), because has() 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 spelling skills/objectstack-formula teaches (has() is NOT a null check), the spelling showcase_project's own validation rules use (record.budget != null && …), and the one the validate-null-guards gate accepts as dominating. The owner guard is isBlank(), so a cleared owner ('') routes the same as null.

Tests

  • New file, on the production harness for everything the defect touches: a real ObjectKernel with ObjectQL over sqlite and the automation plugin, the app's real showcase_project object 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, plus previous before the update), the way the record-change trigger hands it. Each case first asserts the stored row carries every optional field it left out as null. Messaging is a recorder of the audience each notify hands over; fetch is stubbed for the incident push.
    • no budget, with owner → completes, notify_normal success, alert skipped, both notifies to the owner;
    • budget 1000, no owner → completes, both notifies to role:owner;
    • budget 1000, blank owner ('') → completes, both to role:owner;
    • neither → completes, both to role:owner;
    • control: budget 1000 with owner → e3, notify_normal success;
    • budget 500000, no owner → completes, alert_owner skipped, alert_exec success, one critical alert, to role:owner;
    • control: budget 500000 with owner → owner and exec alerted.
  • Red on base (flows file at origin/main 135054eb, 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.
  • Ablation 1 (scripts/ablation-replace.mjs, anchor hit once, blob 9272a372 to 9aa0d008): e2 back to record.budget > 200000. 2 failed / 5 passed (no budget; neither). Restored: blob equal to HEAD (9272a372), git diff HEAD empty.
  • Ablation 2 (blob 9272a372 to 900018be): the has_owner edge condition replaced by true. 1 failed / 6 passed (critical, no owner). Restored the same way.
  • No dist/ sits on the path: the test imports the flow from src.

Acceptance notes

  • Live REST, base vs head (pnpm dev -- --fresh in examples/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):
    • base (flows file at 135054eb): two ERROR 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.
    • head: no such line. Runs: three completed, each start, triage success → alert skipped → notify_normal success → converge success.
  • Same-flow sweep (order ruling 3). Ordering comparisons in src/automation/** conditions: this flow's e2 (fixed), and three outside it, not changed here:
    • showcase_budget_approval start condition budget > 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, so budget is set there.
    • showcase_committee_quorum start condition … && total_amount >= 5000: total_amount is a sum summary; whether it reads null on a report with no lines is not measured.
    • The same has(FIELD) ? FIELD : null guard is the recipient of ten other notify slots in this file, on other flows (assignee, owner, task.owner, task.watcher). It answers null on 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, where null is a valid answer.)
  • Platform first (triage's question). No lint rule warns about a decision with no otherwise edge (the flow-decision-* rules are inclusive-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 / edge condition as 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 merges origin/main at 00d0668d (branch base 135054eb); every run below is on that tree. origin/main has since moved by 7 commits, none under examples/app-showcase/. Each test command under os-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 names showcase_project_escalation.
  • eslint --no-inline-config on the two touched files: exit 0.
  • Derived gates (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's dist/. It first read 3 (seven packages unbuilt in this worktree); after building them it read 1 with 82 Cannot 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.
  • Changeset: none. @objectstack/example-showcase is "private": true, so nothing here ships; skip-changeset rides the create.

Human Minimum

None; the seat lands it.


Generated by Claude Code

…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
@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-02T06:16Z · head 39cd0102 · #28951

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

席位意见:与 diff 相符。示例应用的项目升级流程不再因项目没有预算而整条失败:没预算走普通分支;没有负责人时,跳过负责人告警,或改发给组织所有者,升级通知总能送达。

  1. Shape: draft against main, Fixes #28951, skip-changeset (@objectstack/example-showcase is private); Clause-②: no, Metadata-protocol: none. No contract review owed. check-governed-merges --pr 29018: NOT governed, +257 / -6. git merge-tree against main: clean.
  2. Against the order:
    • Ruling 1. e2 guards the optional budget before ordering it, and e3 is the decision's isDefault otherwise edge, so a project with no budget routes normal.
    • Ruling 2. The critical owner alert sits behind its own decision, and the normal and converge notifies fall back to role:owner. The notify node's required-recipient refusal is untouched.
    • Ruling 3. The same-flow sites are fixed, and the rest are named.
    • No engine or CEL change.
  3. Accepted deviation: the ruling's spelling has(record.budget) && … was measured to still fault, because has() is true on a declared-but-null key and the run's record is total over declared fields. The PR uses record.budget != null && …, the spelling skills/objectstack-formula teaches and the null-guard gate accepts. The ruling's intent holds. Accepted.
  4. Gates: red on base 4/6, head 7/7, and two ablations red then restored. The live REST repro fails on base and completes on head. Gates: 39/40 exit 0. check:dual-build-cjs-loads NOT MEASURED (stale local dist chunks). That is accepted: the diff ships no package, and CI runs the gate. Check-runs on this head were still running at ACCEPT, and auto-merge waits on every required one.
  5. Out of scope: the null-guard gate's exclusion of flow conditions is filed as lint: the publish-time null-guard gate still excludes flow and edge conditions, so an unguarded ordering comparison on a nullable field ships and faults at run time #29026 (p3, domain:devx), and the ten other showcase has(FIELD) ? FIELD : null recipient slots plus two start conditions as showcase: ten notify recipient slots guard an optional user field with has(FIELD) ? FIELD : null, which answers null on a null column and fails the run with no recipient #29028 (p3). The "decision with no otherwise edge" lint reading is noted in the PR body and not filed.
  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 06:17
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 2, 2026 06:17
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 6b3ba82 Nov 2, 2026
50 of 51 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-zxfajt branch November 2, 2026 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

1 participant