Skip to content

feat(approvals): retire process engine — approval is flow-node only (ADR-0019 P4/P5) - #1408

Merged
xuyushun441-sys merged 3 commits into
mainfrom
feat/adr-0019-p4-p5-retire-process-engine
May 31, 2026
Merged

feat(approvals): retire process engine — approval is flow-node only (ADR-0019 P4/P5)#1408
xuyushun441-sys merged 3 commits into
mainfrom
feat/adr-0019-p4-p5-retire-process-engine

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Summary

Destructive removal phase of ADR-0019 (approval as a flow node). With P1–P3 (#1407) approval already worked as a durable-pause flow node; this PR lands A4/A5 and deletes the standalone approval process engine. Approval now exists only as type: 'approval' on a Flow.

What changed

Removed

  • spec: ApprovalProcessSchema / ApprovalStepSchema / ApprovalActionSchema, approval.form.ts, the approvals stack collection (metadata-collection, stack.zod, metadata-type-schemas, metadata-form-registry), process_hash pinning.
  • platform-objects: sys_approval_process object + Setup nav + i18n; sys_approval_request reframed to the node era (process_nameSource, no process_hash).
  • plugin-approvals: action-executor.ts, defineProcess / submit / recall, per-object process hooks → one node-era global record-lock hook reading policy from the request's node_config_json; decide() bridges a decision into the engine's resume(runId, { branchLabel }). phase-b.test.ts deleted; approval-service.test.ts rewritten to drive the node.
  • rest: /approvals/processes + submit + recall routes (kept request reads + approve/reject decision routes, now via svc.decide).
  • runtime: app-plugin process seeder.
  • cli/metadata: approvals stats + plural→singular mapping.

Migrated examples off approvals:

  • app-crm → DiscountApprovalFlow
  • app-showcase → BudgetApprovalFlow

connector_action is retained — a deliberate ADR-0018 open extension point, not a process remnant.

Test plan

Green builds + tests across: spec (6601), platform-objects (78), plugin-approvals (29), runtime (325), rest (78), cli (137), metadata (241), service-automation (79), and both example apps (app-crm 29, app-showcase 8).

…only (ADR-0019 P4/P5)
Destructive removal of the standalone approval *process* engine. After ADR-0019
P1-P3 made approval work as a durable-pause flow node, this lands A4/A5: the
process model is gone and approval exists only as `type: 'approval'` on a Flow.
Removed:
- spec: ApprovalProcessSchema/Step/Action, approval.form.ts, `approvals` stack
collection (metadata-collection, stack.zod, metadata-type-schemas,
metadata-form-registry), process_hash pinning
- platform-objects: sys_approval_process object + nav + i18n; reframed
sys_approval_request to node-era (process_name -> Source, no process_hash)
- plugin-approvals: action-executor.ts, process defineProcess/submit/recall,
per-object process hooks -> single node-era global record-lock hook;
decide() bridges decision -> engine resume; phase-b.test deleted,
approval-service.test rewritten to drive the node
- rest: /approvals/processes + submit + recall routes (kept request reads +
approve/reject decision routes wired to svc.decide)
- runtime: app-plugin process seeder
- cli/metadata: `approvals` stats + plural mapping
Migrated examples off `approvals:` to approval-node flows:
- app-crm: DiscountApprovalFlow
- app-showcase: BudgetApprovalFlow
connector_action is retained as a deliberate ADR-0018 open extension point.
Green: spec/platform-objects/plugin-approvals/runtime/rest/cli/metadata/
service-automation + app-crm/app-showcase.
@vercel

vercelBot commented May 31, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentMay 31, 2026 9:57am

Request Review

… field
Self-review follow-ups on the P4/P5 removal:
- Drop decideApprovalNode (approval-node.ts) — it duplicated the resume
orchestration now owned by the contract entrypoint ApprovalService.decide().
Migrated approval-node.test.ts to drive decide() via attachAutomation, and
removed the now-unused export. One decision/resume path, not two.
- Add a readonly approval_status select to crm_opportunity so the Discount
Approval flow's approvalStatusField mirror has a real target (the mirror is
try/caught, so before this it silently no-op'd in the example).
…tate-machine shape
The metadata-validation-sweep workflow fixture still used the legacy
workflow-rule shape (objectName/triggerType/criteria); `workflow` maps to
StateMachineSchema (id/initial/states) since the workflow→state-machine
migration, so the valid fixture failed validation. Updated it to a minimal
valid state machine. Pre-existing failure surfaced by Test Core; unrelated to
the approval node work but fixed here to keep CI green.
@xuyushun441-sys
xuyushun441-sys merged commit 047602e into mainMay 31, 2026
12 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the feat/adr-0019-p4-p5-retire-process-engine branch May 31, 2026 10:04
xuyushun441-sys added a commit that referenced this pull request May 31, 2026
…1409)
P4/P5 (#1408) removed the standalone approval-process engine; approval now
exists only as a `type: 'approval'` flow node. This brings the docs and the
automation skill back in line with that — no code changes.
- skills/objectstack-automation/SKILL.md: drop the deleted ApprovalProcess
API; rewrite the approval section to the node model (config schema,
approve/reject edges, decision via ApprovalService.decide), add `approval`
to the Flow node table (19 node types), add the old→new re-home mapping,
refresh best practices + CRM blueprint.
- README / guides/packages / concepts/packages: fix the plugin one-liner
(no more "approval-process engine"/sys_approval_process).
- references/*: regenerate auto-docs from current schemas — approval.mdx now
shows ApprovalNodeConfig/ApprovalDecision/etc; also syncs other drifted
auto-docs whose schemas changed but weren't regenerated (workflow.mdx ->
state-machine.mdx, field `secret` type, ADR-0018 open-registry text, …).
Historical records left as-is: CHANGELOGs, ROADMAP milestone, ADR 0009/0018.
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationprotocol:dataprotocol:systemsize/xltests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@xuyushun441-sys@os-zhuang