Skip to content

Fix integrate-postgres CI: implement real SQL workflow store and API controller#3966

Draft
Copilot wants to merge 2 commits into
developfrom
copilot/fix-integrate-postgres-job
Draft

Fix integrate-postgres CI: implement real SQL workflow store and API controller#3966
Copilot wants to merge 2 commits into
developfrom
copilot/fix-integrate-postgres-job

Conversation

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

The integrate-postgres (and integrate-sqlite) dredd jobs were crashing because addWorkflowApproval() in the test hooks panicked when workflow.Nodes was nil — a consequence of CreateWorkflowTemplate() being a no-op stub that returned an empty struct. This killed the hooks server process, failing every subsequent dredd test.

Changes

pro/db/sql/workflow.go

  • Replaces the no-op stub with a real SQL implementation covering all workflow entities: templates, nodes, edges, runs, and approvals
  • CreateWorkflowTemplate / UpdateWorkflowTemplate handle logical→DB node ID remapping so edge source_node_id / destination_node_id references resolve correctly after autoincrement assignment

pro/db/factory/factory.go

  • NewWorkflowStore now type-asserts the db.Store to *coreSql.SqlDb, extracts the live connection via GetConnection(), and passes it to NewWorkflowStoreImpl — previously the store was constructed with no connection at all

pro/api/projects/workflows.go

  • All 12 HTTP handlers replaced — previously stubs returning 404 or empty arrays
  • Added workflowRepo db.WorkflowManager field to the controller and wired it through NewWorkflowController
  • ResolveWorkflowApproval uses ResolveWorkflowApprovalIfPending for atomic status transition
  • GetWorkflowRun returns a workflowRunDetails envelope pairing each node with its approval record for the run

…controller

- pro/db/sql/workflow.go: Replace no-op stub with real SQL CRUD implementation
  for all workflow entities (templates, nodes, edges, runs, approvals)
- pro/db/factory/factory.go: Wire DB connection into WorkflowStoreImpl so the
  dredd hooks get a functional store instead of a disconnected stub
- pro/api/projects/workflows.go: Replace 404-stub handlers with real
  implementations backed by workflowRepo

Root cause: addWorkflowApproval() in dredd hooks panicked because
CreateWorkflowTemplate() returned an empty WorkflowTemplate (no Nodes),
so the search for an approval-kind node found nothing and panicked,
killing the hooks server and causing all subsequent dredd tests to fail.
Copilot AI changed the title [WIP] Fix failing GitHub Actions job integrate-postgres Fix integrate-postgres CI: implement real SQL workflow store and API controller Jun 15, 2026
Copilot AI requested a review from fiftin June 15, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants