You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The @objectstack/client SDK is out of sync with the server REST surface around approvals/workflow:
Missing: there is no client.approvals namespace, even though the server exposes the canonical approval-decision API. This is the only path that resumes a suspended flow run (ADR-0019), so without a typed method every consumer hand-rolls fetch, or worse, bypasses it by data.update-ing the request status (which mirrors the status but does not resume the flow).
Dead:client.workflow.* and the workflow route/contract are leftovers from the workflow engine that was removed (Workflow Rules removed in refactor(automation): remove Workflow Rules; reclaim workflow for state machines #1398; approval collapsed into Flow in ADR-0019). Nothing implements /api/v1/workflow anywhere in the monorepo — these methods can never succeed.
Found while building the mobile app's approvals UI: client.workflow.approve silently no-ops and there's no typed approvals call, so we had to data.update the status (semantically wrong — the blocked flow run is never resumed).
Evidence
Server HAS the approvals API — packages/rest/src/rest-server.tsregisterApprovalsEndpoints() (always mounted; service via ctx.getService('approvals')):
GET /api/v1/approvals/requests (filters: status, object, recordId, approverId, submitterId)
GET /api/v1/approvals/requests/:id
POST /api/v1/approvals/requests/:id/approve -> svc.decide() -> finalizes the request and resumes the owning flow run
POST /api/v1/approvals/requests/:id/reject
GET /api/v1/approvals/requests/:id/actions (audit trail)
Client LACKS it — packages/client/src/index.ts: no approvals namespace and no approvals key in the route map (getRoute, ~line 3277).
workflow is dead — no /api/v1/workflow route is registered anywhere; no service-workflow / plugin-workflow package exists. Only leftovers remain:
packages/spec/src/system/core-services.zod.ts:42,84 — 'workflow' CoreServiceName (optional), surfaces as workflow: { status: 'unavailable' } in discovery
Per ADR-0019 ("Collapse Approval into Flow"): "Workflow Rules were already removed in #1398, and workflow was reclaimed for state machines." — but no state-machine workflow service was ever shipped, so the surface is dangling.
Proposed changes
Add client.approvals (mirror the existing automation namespace style):
add approvals: '/api/v1/approvals' to the route map.
Remove the dead workflow surface:
delete the workflow namespace + route-map entry in packages/client/src/index.ts
delete packages/spec/src/contracts/workflow-service.ts (IWorkflowService, Workflow* types) and its test
drop 'workflow' from CoreServiceName (core-services.zod.ts) and any discovery default that advertises it
Note: object state machines now live as Flow nodes / field-level, so transition/getState/getConfig have no replacement — remove, don't re-point.
Acceptance criteria
client.approvals.{list,get,approve,reject,actions} exist and hit /api/v1/approvals/requests…
No workflow references remain in @objectstack/client (namespace + route map)
IWorkflowService / Workflow* types and the 'workflow' CoreServiceName removed (or explicitly kept with a deprecation note if state-machine work is still planned)
discovery no longer advertises a workflow service
spec + client typecheck/test green
Secondary (separate issue?)
reports (/api/v1/reports…, 8 routes) and sharing/sharingRules (/api/v1/sharing/rules…) also have server routes but no client namespace.
Filed from the mobile app, which will switch its approvals decision to client.approvals.approve once this lands (currently using a data.update workaround that doesn't resume the flow).
Summary
The
@objectstack/clientSDK is out of sync with the server REST surface around approvals/workflow:client.approvalsnamespace, even though the server exposes the canonical approval-decision API. This is the only path that resumes a suspended flow run (ADR-0019), so without a typed method every consumer hand-rollsfetch, or worse, bypasses it bydata.update-ing the request status (which mirrors the status but does not resume the flow).client.workflow.*and theworkflowroute/contract are leftovers from the workflow engine that was removed (Workflow Rules removed in refactor(automation): remove Workflow Rules; reclaimworkflowfor state machines #1398; approval collapsed into Flow in ADR-0019). Nothing implements/api/v1/workflowanywhere in the monorepo — these methods can never succeed.Found while building the mobile app's approvals UI:
client.workflow.approvesilently no-ops and there's no typed approvals call, so we had todata.updatethe status (semantically wrong — the blocked flow run is never resumed).Evidence
Server HAS the approvals API —
packages/rest/src/rest-server.tsregisterApprovalsEndpoints()(always mounted; service viactx.getService('approvals')):GET /api/v1/approvals/requests(filters: status, object, recordId, approverId, submitterId)GET /api/v1/approvals/requests/:idPOST /api/v1/approvals/requests/:id/approve->svc.decide()-> finalizes the request and resumes the owning flow runPOST /api/v1/approvals/requests/:id/rejectGET /api/v1/approvals/requests/:id/actions(audit trail)Client LACKS it —
packages/client/src/index.ts: noapprovalsnamespace and noapprovalskey in the route map (getRoute, ~line 3277).workflowis dead — no/api/v1/workflowroute is registered anywhere; noservice-workflow/plugin-workflowpackage exists. Only leftovers remain:packages/client/src/index.ts:2464—workflow = { getConfig, getState, transition, approve, reject }packages/client/src/index.ts:3288— route mapworkflow: '/api/v1/workflow'packages/spec/src/contracts/workflow-service.ts—IWorkflowServicecontract (+Workflow*types), unimplemented/unregisteredpackages/spec/src/system/core-services.zod.ts:42,84—'workflow'CoreServiceName (optional), surfaces asworkflow: { status: 'unavailable' }in discoveryPer ADR-0019 ("Collapse Approval into Flow"): "Workflow Rules were already removed in #1398, and
workflowwas reclaimed for state machines." — but no state-machine workflow service was ever shipped, so the surface is dangling.Proposed changes
Add
client.approvals(mirror the existingautomationnamespace style):approvals: '/api/v1/approvals'to the route map.Remove the dead
workflowsurface:workflownamespace + route-map entry inpackages/client/src/index.tspackages/spec/src/contracts/workflow-service.ts(IWorkflowService,Workflow*types) and its test'workflow'fromCoreServiceName(core-services.zod.ts) and any discovery default that advertises itAcceptance criteria
client.approvals.{list,get,approve,reject,actions}exist and hit/api/v1/approvals/requests…workflowreferences remain in@objectstack/client(namespace + route map)IWorkflowService/Workflow*types and the'workflow'CoreServiceName removed (or explicitly kept with a deprecation note if state-machine work is still planned)discoveryno longer advertises aworkflowserviceSecondary (separate issue?)
reports(/api/v1/reports…, 8 routes) andsharing/sharingRules(/api/v1/sharing/rules…) also have server routes but no client namespace.Filed from the
mobileapp, which will switch its approvals decision toclient.approvals.approveonce this lands (currently using adata.updateworkaround that doesn't resume the flow).