Fix bundled workflow activation + add connection error logging
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 5s
CI/CD / test-runners (pull_request) Has been skipped
CI/CD / test-frontend (pull_request) Successful in 6s
CI/CD / test-go-pg (pull_request) Successful in 2m46s
CI/CD / test-sqlite (pull_request) Successful in 2m54s
CI/CD / build-and-deploy (pull_request) Successful in 1m11s
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 5s
CI/CD / test-runners (pull_request) Has been skipped
CI/CD / test-frontend (pull_request) Successful in 6s
CI/CD / test-go-pg (pull_request) Successful in 2m46s
CI/CD / test-sqlite (pull_request) Successful in 2m54s
CI/CD / build-and-deploy (pull_request) Successful in 1m11s
1. Bundled workflow packages now publish version 1 and set IsActive=true after stage creation, so workflows like Content Approval are usable immediately — fixes "workflow is not active" test failure. 2. Add error logging to ListConnections handler to diagnose the 500 error in sdk/connections tests (query and schema look correct but the error was being swallowed). 3. Separate "Run All" button text from suite count label. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ package handlers
|
|||||||
import (
|
import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -30,6 +31,7 @@ func (h *ConnectionHandler) ListConnections(c *gin.Context) {
|
|||||||
// so users can see which connections are available to them.
|
// so users can see which connections are available to them.
|
||||||
conns, err := h.stores.Connections.ListAccessible(c.Request.Context(), userID)
|
conns, err := h.stores.Connections.ListAccessible(c.Request.Context(), userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Printf("[connections] ListAccessible failed for user %s: %v", userID, err)
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list connections"})
|
c.JSON(http.StatusInternalServerError, gin.H{"error": "failed to list connections"})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,6 +253,23 @@ func InstallWorkflowFromManifest(ctx *gin.Context, stores store.Stores, pkgID st
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Publish version 1 (snapshot of stages) and activate the workflow
|
||||||
|
// so it's immediately usable after install.
|
||||||
|
stages, _ := stores.Workflows.ListStages(reqCtx, workflowID)
|
||||||
|
snapshot, _ := json.Marshal(stages)
|
||||||
|
ver := &models.WorkflowVersion{
|
||||||
|
WorkflowID: workflowID,
|
||||||
|
VersionNumber: 1,
|
||||||
|
Snapshot: snapshot,
|
||||||
|
}
|
||||||
|
if err := stores.Workflows.Publish(reqCtx, ver); err != nil {
|
||||||
|
log.Printf("[workflow-pkg] failed to publish version for %s: %v", pkgID, err)
|
||||||
|
}
|
||||||
|
active := true
|
||||||
|
if err := stores.Workflows.Update(reqCtx, workflowID, models.WorkflowPatch{IsActive: &active}); err != nil {
|
||||||
|
log.Printf("[workflow-pkg] failed to activate %s: %v", pkgID, err)
|
||||||
|
}
|
||||||
|
|
||||||
// Store workflow_id in package_settings for reference
|
// Store workflow_id in package_settings for reference
|
||||||
settingsJSON, _ := json.Marshal(map[string]string{"workflow_id": workflowID})
|
settingsJSON, _ := json.Marshal(map[string]string{"workflow_id": workflowID})
|
||||||
stores.Packages.SetPackageSettings(reqCtx, pkgID, json.RawMessage(settingsJSON))
|
stores.Packages.SetPackageSettings(reqCtx, pkgID, json.RawMessage(settingsJSON))
|
||||||
|
|||||||
Reference in New Issue
Block a user