Skip to content

fix(examples): declare runAs:'system' on showcase webhook + approval-outcome flows (#1888)#2316

Merged
os-zhuang merged 1 commit into
mainfrom
fix/example-flows-runas-system
Jun 25, 2026
Merged

fix(examples): declare runAs:'system' on showcase webhook + approval-outcome flows (#1888)#2316
os-zhuang merged 1 commit into
mainfrom
fix/example-flows-runas-system

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Regression-audit follow-up to #2302 (flow runAs enforcement, #1888). Now that runAs is enforced, I audited every example-app flow for ones that would be silently under-privileged or that teach the wrong pattern as AI-authoring reference templates.

Audit result

No example flow regresses under the enforcement (consistent with the green dogfood gate). They split cleanly:

  • system (correct) — cross-owner / no-user work: CRM lead_qualification_conversion, renewal_reminder_flow, stale_opportunity_sweep; todo escalation + recurring-task flows.
  • user (correct) — acts only on the trigger user's own accessible record: CRM crm_convert_lead_wizard (get/update the user's own lead), showcase showcase_reassign_wizard (edit a task the user launched the action on), showcase_resilient_sync (updates the same task the trigger user just completed).
  • No CRUD nodes (unaffected) — approval/script/notify-only flows (discount approval, high-value-deal, opportunity-won, etc.).

Fixes (2 showcase flows)

Two flows relied on implicit elevation and would teach the wrong pattern as templates:

  • showcase_inbound_task_webhook — an HMAC webhook (type: 'api', no authenticated user) that creates a task. It only worked via the "no identity → security-skipped" fall-through. Now declares runAs: 'system' — the correct, explicit pattern for external ingest, and robust once the target object carries RLS.
  • showcase_invoice_signoff — the revert-on-reject update_record is an approval-process outcome, not an act of the submitter. runAs: 'system' so it lands regardless of whether the submitter still has edit rights on a "sent" invoice (mirrors how Salesforce approval field updates run as the process).

No behavioral change in the showcase itself (broad member perms — the gate was already green); this hardens the reference templates so they stay correct under stricter RLS and as patterns AI copies.

Verification

Example-only change to a private package → no changeset needed.

Refs #1888

🤖 Generated with Claude Code

…outcome flows (#1888)

Audit follow-up to #1888 (flow `runAs` enforcement). Two showcase flows relied on
implicit elevation and would teach the wrong pattern as AI-authoring reference
templates now that `runAs` is enforced:

- `showcase_inbound_task_webhook` — an HMAC webhook (no authenticated user) that
  creates records. It only worked via the "no identity → security-skipped"
  fall-through. Now declares `runAs:'system'` — the correct, explicit pattern for
  external ingest (and robust once the target object carries RLS).
- `showcase_invoice_signoff` — the revert-on-reject write is an approval-process
  outcome, not an act of the submitter. `runAs:'system'` so it lands regardless of
  whether the submitter still has edit rights on a "sent" invoice.

No behavioral regression in the showcase itself (broad member perms — the full
dogfood gate was already green); this hardens the templates so they stay correct
under stricter RLS and as patterns AI copies. The rest of the example flows were
audited and are correct as-is: `system` where they cross owners (lead
qualification, renewal/stale sweeps, todo escalation/recurrence) and `user` where
they act on the trigger user's own accessible record (lead convert, task reassign,
resilient-sync self-update).

Verified: `pnpm --filter @objectstack/example-showcase typecheck` + full dogfood
gate (173 tests) green.

Refs #1888

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 25, 2026 4:20am

Request Review

@os-zhuang
os-zhuang merged commit c2f1605 into main Jun 25, 2026
15 checks passed
@os-zhuang
os-zhuang deleted the fix/example-flows-runas-system branch June 25, 2026 04:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant