KB-73CD
M-002 Phase 2A Report — DSL + Governance Foundation
4 min read Revision 1
reportM-002phase2aworkflowdslgovernance
M-002 Phase 2A Report — DSL + Governance Foundation
Date: 2026-03-03 Agent: codex Repos:
web-test,agent-data-testPRs: #424 (foundation), #425 (workflow API proxy hotfix)
Scope
- Built Phase 2A foundation only: DSL as SSOT, block library, WCR governance, migration, and viewer integration.
- Explicitly excluded Phase 2B overlays/color/zoom and Phase 3 execution.
- Kept Phase 1 Viewer/Modeler/Annotations working.
Schema + DOT
- Created 4 Directus collections with DOT:
workflow_steps,workflow_step_relations,block_library,workflow_change_requests. - Added Directus relations for workflows, blocks, and task linkage.
- Granted AI-agent permissions: RW for steps/relations, RO for block library, restricted RW for WCR fields.
- Seeded 5 blocks:
planning_council,ai_review_block,code_review_loop,approval_with_retry,agent_dispatch_block. - Extended OPS Proxy + OpenAPI to expose the 4 new collections for Codex/GPT.
DSL Engine + Governance
- Added deterministic server-side DSL→BPMN generator and BPMN→DSL migration/parser utilities.
- Added WCR intake, integrity scan, apply pipeline, and status update endpoints.
- Added integrity checks for duplicate
step_key, orphan steps, missing condition branches, and loop exit coverage. - Wired WCR lifecycle comments into task governance flow.
- Updated WorkflowViewer to render from DSL-backed diagram API instead of reading
workflows.bpmn_xmldirectly. - Updated WorkflowModeler to block direct BPMN saves when DSL exists.
Migration + Functional Tests
- Migrated workflow
#1from BPMN XML into DSL records. - Fixed BPMN generator tag casing bug so migration comparison became structurally equivalent.
- WCR
#1(add_step) applied successfully: workflow version3,6steps,5relations. - WCR
#2(add_blockwithai_review_block) applied successfully: workflow version4,10steps,10relations. - WCR
#3orphan test produced the expectedorphan_stepschema warning. - Governance comments were created on task
#10for planning and verify tabs.
Build + CI Verification
- Local validation passed:
pnpm typecheck, targeted ESLint,pnpm build. mainafter PR #424 and PR #425 completed green onNuxt 3 CI,Terraform Deploy,Firebase Deploy,Deploy to VPS, andE2E Tests.- VPS verification scripts passed:
test-agent-connections.sh:37/37 PASStest-all-connections.sh:20/20 PASS
Production Evidence
Before
- Before PR #425,
GET /api/workflows/1/diagramreturned404because nginx still routed/api/workflows/*to Agent Data. - After the proxy hotfix deployed, the endpoint resolved but returned
source="bpmn_cache"anddslAvailable=false. - Root cause of the second issue: running
incomex-nuxtcontainer on VPS did not haveNUXT_DIRECTUS_SERVICE_TOKEN, even though the committed compose config rendered that variable.
After
- Recreated the
nuxtservice from the committed compose config on VPS. - Verified the running container now includes
NUXT_DIRECTUS_SERVICE_TOKEN. - Verified production endpoint result:
- workflow
#1 source="dsl"dslAvailable=truestepCount=10relationCount=10
- workflow
- Confirmed
https://ai.incomexsaigoncorp.vn/knowledge/modules/10is now backed by DSL-generated BPMN.
Tech Debt Recorded
TD-058:workflow_steps.step_keyuniqueness is enforced in governance/apply logic, but not yet at DB composite-constraint level.TD-059: Deploy pipeline can report success while the runningnuxtcontainer still has env drift from compose, which caused production DSL fallback until manual recreate.
Mission Outcome
- Phase 2A foundation is live.
- DSL and governance shipped together, with WCR gate preserved.
- Workflow
#1is migrated and rendering from DSL in production. - No Phase 2B or Phase 3 scope was included.