KB-9D46
M002-WCR-REFACTOR Report
4 min read Revision 1
reportm002workflow-modulerefactorassembly-firstdirectus
M002-WCR-REFACTOR Report
Date: 2026-03-03
PR: #426
PR URL: https://github.com/Huyen1974/web-test/pull/426
Branch: feat/m002-wcr-ui
Refactor commit: 944034e (refactor: use directus reads in workflow ui)
Goal
Remove the redundant workflow server API proxy layer introduced in PR #426 and refactor the Workflows Supervisor UI to read Directus directly, preserving the existing UI behavior.
Files Removed
web/server/api/workflows/registry.get.tsweb/server/api/workflows/[id]/matrix.get.tsweb/server/api/workflows/[id]/change-requests.get.ts
Files Changed
web/components/modules/workflow-module/partials/ProcessRegistryView.vueweb/components/modules/workflow-module/partials/WorkflowMatrixView.vueweb/components/modules/workflow-module/partials/WcrIntakePanel.vueweb/composables/useWorkflows.tsweb/server/utils/directusService.ts
Refactor Summary
ProcessRegistryView.vue- Removed fetch through
/api/workflows/registry - Replaced it with direct Directus reads for
workflows - Preserved search, filter, pagination, sorting, tree hierarchy, loading, empty, and error states
- Added direct step counting by querying
workflow_stepsfor the workflows in the current page
- Removed fetch through
WorkflowMatrixView.vue- Removed fetch through
/api/workflows/:id/matrix - Replaced it with direct Directus reads for
workflow_stepsandworkflow_step_relations - Preserved auto-derived trigger text behavior and the existing table UI
- Removed fetch through
WcrIntakePanel.vue- Removed fetch through
/api/workflows/:id/change-requests - Replaced it with direct Directus reads for
workflow_change_requests - Replaced WCR creation with direct Directus
createItem('workflow_change_requests', ...) - Preserved the existing form, WCR list, and status badge behavior
- Removed fetch through
useWorkflows.ts- Removed registry and change-request proxy helper functions that depended on the deleted APIs
- Kept
useWorkflowMatrix(id)for page compatibility, but changed it to read Directus directly instead of calling the deleted matrix API
directusService.ts- Reverted PR #426 additions that only existed to support the deleted proxy APIs
- Left Phase 2A backend workflow/governance functions intact
Line Count / File Count Evidence
Original supervisor UI commit (ebacf87):
15 files changed, 1285 insertions(+), 17 deletions(-)
Refactor commit (944034e):
8 files changed, 190 insertions(+), 216 deletions(-)
Net effect of the refactor commit:
- 3 server API files removed
- Net code reduction:
-26lines in the refactor diff (190 added,216 deleted) - Total changed file count reduced from
15in the original UI commit to8in the refactor commit
Verification
Local verification:
pnpm typecheck-> PASSpnpm build-> PASS
PR verification:
- PR
#426updated with commit944034e Nuxt 3 CI-> PASSTerraform Deploy-> PASSFirebase Deploy-> PASSCritical File Guard-> PASSrequired-docs-guard-> PASSE2E Smoke Test-> PASS- PR status after refactor:
mergeStateStatus = CLEAN
Constraints Check
- No schema changes
- No page route changes
- No
TheHeader.vuechanges - No
WorkflowViewercore changes - No type changes
- No DOT tool changes
- No merge performed
Outcome
The Workflows Supervisor UI now uses Directus reads directly from the client/composable layer instead of an unnecessary Nuxt server proxy layer, matching the Assembly First requirement while keeping the UI behavior unchanged.