feat(workflow-definition-model): apply spec#382
Merged
Conversation
Expose the existing workflowTemplate schema with a draft → published →
deprecated lifecycle, version pinning, a consumer contract for
status-transition-engine + role-based-step-routing, and a backfill
repair step — without growing bespoke CRUD.
Schema (manifest-first; pure CRUD goes through the manifest renderer +
OpenRegister auto-routing):
- lib/Settings/procest_register.json — workflowTemplate gains a
lifecycleStatus enum (draft|published|deprecated), version bumped to
1.1.0; caseType gains a workflowDefinition uuid reference for the
pinned active version.
- lib/Service/SettingsService.php — workflow_definition_schema alias
mirrors workflow_template_schema so consumer specs can resolve the
schema id without depending on the legacy slug.
Manifest pages (no bespoke Vue components):
- WorkflowDefinitions (index) at /settings/workflow-definitions
- WorkflowDefinitionDetail (detail) with overview / steps /
transitions / audit-trail sidebar tabs and publish / deprecate /
clone actions wired to the controller endpoints.
- Settings menu entry "Workflow definitions".
Backend services (legitimate domain logic, not CRUD):
- WorkflowDefinitionService — lifecycle (publish, deprecate,
cloneDefinition) and read-only consumer contract
(getActiveDefinitionFor, getDefinition, getDefinitionForCase,
listVersions). Atomic publish deprecates the previously active
version and pins caseType.workflowDefinition; deprecate refuses to
strand open cases; clone increments version. Referential integrity
check rejects publishing a draft whose transitions reference foreign
statusType ids. All errors logged + static error strings returned —
no raw exception leakage.
- WorkflowDefinitionController — five action-only endpoints (publish,
deprecate, clone, active, for-case). No CRUD methods.
Routes (action endpoints only, /api/workflow-definitions/...):
- POST /{id}/publish, /{id}/deprecate, /{id}/clone
- GET /active/{caseTypeId}, /for-case/{caseId}
Migration:
- lib/Repair/MigrateWorkflowDefinitions.php — idempotent backfill that
synthesises one published workflowTemplate per existing caseType from
its statusType ordering, pins caseType.workflowDefinition, and binds
open cases to workflowVersion 1. Skips caseTypes that already have a
workflowDefinition reference or any existing template.
- appinfo/info.xml — repair step registered.
Implements openspec change workflow-definition-model.
Contributor
Quality Report — ConductionNL/procest @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ❌ | ||||
| stylelint | ❌ | ||||
| composer | ✅ | ✅ 100/100 | |||
| npm | ✅ | ✅ 407/407 | |||
| PHPUnit | ⏭️ | ||||
| Newman | ⏭️ | ||||
| Playwright | ❌ |
Spec coverage: 3% (21 tests / 673 specs)
Quality workflow — 2026-05-11 11:59 UTC
Download the full PDF report from the workflow artifacts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Applies openspec change
workflow-definition-modelto Procest, exposing the existingworkflowTemplateschema with a draft → published → deprecated lifecycle and a stable consumer contract forstatus-transition-engineandrole-based-step-routing— manifest-first, without growing bespoke CRUD.lifecycleStatusenum +caseType.workflowDefinitionpin; version bumped to 1.1.0.workflow_definition_schemaalias added so consumer specs resolve the id independent of the legacy slug.WorkflowDefinitions(index) +WorkflowDefinitionDetail(detail) + settings menu entry handle CRUD — no bespoke Vue controllers or list/edit components.WorkflowDefinitionServiceowns the legitimate domain logic:publish(atomic — deprecates previous active, pinscaseType.workflowDefinition, validates that transitions only reference statusTypes of the linked caseType),deprecate(refuses to strand open cases),cloneDefinition(version + 1). Read-only consumer methods:getActiveDefinitionFor,getDefinition,getDefinitionForCase,listVersions.WorkflowDefinitionControllerexposes only action endpoints — no CRUD:POST /api/workflow-definitions/{id}/{publish|deprecate|clone},GET /api/workflow-definitions/{active|for-case}/....lib/Repair/MigrateWorkflowDefinitions.phpbackfills one published workflowTemplate per existing caseType from its statusType ordering, idempotent on re-run.All errors logged via
LoggerInterface; controller never returns raw exception messages — static error strings only.Test plan
php -landjq emptypass for all touched files (verified locally).occ maintenance:repairand confirm the backfill produces one published workflowTemplate per existing caseType withlifecycleStatus: publishedandcaseType.workflowDefinitionpinned./settings/workflow-definitions/:idwith the overview / steps / transitions / audit tabs.POST /api/workflow-definitions/{id}/publishon a draft; verifylifecycleStatusflips topublished, the previously active version flips todeprecated, andcaseType.workflowDefinitionupdates to the new id.POST /api/workflow-definitions/{id}/cloneon a published version; verify a new draft appears withversion = previous + 1.Implements openspec change
workflow-definition-model.