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

  1. web/server/api/workflows/registry.get.ts
  2. web/server/api/workflows/[id]/matrix.get.ts
  3. web/server/api/workflows/[id]/change-requests.get.ts

Files Changed

  1. web/components/modules/workflow-module/partials/ProcessRegistryView.vue
  2. web/components/modules/workflow-module/partials/WorkflowMatrixView.vue
  3. web/components/modules/workflow-module/partials/WcrIntakePanel.vue
  4. web/composables/useWorkflows.ts
  5. web/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_steps for the workflows in the current page
  • WorkflowMatrixView.vue
    • Removed fetch through /api/workflows/:id/matrix
    • Replaced it with direct Directus reads for workflow_steps and workflow_step_relations
    • Preserved auto-derived trigger text behavior and the existing table UI
  • 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
  • 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: -26 lines in the refactor diff (190 added, 216 deleted)
  • Total changed file count reduced from 15 in the original UI commit to 8 in the refactor commit

Verification

Local verification:

  • pnpm typecheck -> PASS
  • pnpm build -> PASS

PR verification:

  • PR #426 updated with commit 944034e
  • Nuxt 3 CI -> PASS
  • Terraform Deploy -> PASS
  • Firebase Deploy -> PASS
  • Critical File Guard -> PASS
  • required-docs-guard -> PASS
  • E2E Smoke Test -> PASS
  • PR status after refactor: mergeStateStatus = CLEAN

Constraints Check

  • No schema changes
  • No page route changes
  • No TheHeader.vue changes
  • No WorkflowViewer core 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.