From 69902be6ede9204c752afc6ff1a3efa675c325fc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Feb 2026 07:41:56 +0000 Subject: [PATCH 1/2] Initial plan From b0be2d6b5fcfc34ec86208abe9ce795db99480bb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Feb 2026 07:51:33 +0000 Subject: [PATCH 2/2] Fix silent error suppression: log errors in jwt_auth, persistence ops, distributed lock, integration, http handlers Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> --- module/api_crud_handler.go | 12 +++++++++--- module/api_v1_handler.go | 3 ++- module/api_workflow_handler.go | 4 +++- module/http_handlers.go | 4 ++-- module/http_trigger.go | 5 ++--- module/integration.go | 10 ++++------ module/jwt_auth.go | 4 +++- scale/distributed_lock.go | 5 ++++- 8 files changed, 29 insertions(+), 18 deletions(-) diff --git a/module/api_crud_handler.go b/module/api_crud_handler.go index 1a9f760d..26575855 100644 --- a/module/api_crud_handler.go +++ b/module/api_crud_handler.go @@ -196,7 +196,9 @@ func (h *RESTAPIHandler) handlePost(resourceId string, w http.ResponseWriter, r if h.persistence != nil { h.fieldMapping.SetValue(resource.Data, "state", resource.State) h.fieldMapping.SetValue(resource.Data, "lastUpdate", resource.LastUpdate) - _ = h.persistence.SaveResource(h.resourceName, resource.ID, resource.Data) + if err := h.persistence.SaveResource(h.resourceName, resource.ID, resource.Data); err != nil { + h.logger.Warn(fmt.Sprintf("failed to persist resource %s/%s: %v", h.resourceName, resource.ID, err)) + } } // If a workflow engine is configured, create an instance and trigger the initial transition @@ -252,7 +254,9 @@ func (h *RESTAPIHandler) handlePut(resourceId string, w http.ResponseWriter, r * // Write-through to persistence if h.persistence != nil { - _ = h.persistence.SaveResource(h.resourceName, resourceId, data) + if err := h.persistence.SaveResource(h.resourceName, resourceId, data); err != nil { + h.logger.Warn(fmt.Sprintf("failed to persist resource %s/%s: %v", h.resourceName, resourceId, err)) + } } if err := json.NewEncoder(w).Encode(h.resources[resourceId]); err != nil { @@ -287,7 +291,9 @@ func (h *RESTAPIHandler) handleDelete(resourceId string, w http.ResponseWriter, // Write-through to persistence if h.persistence != nil { - _ = h.persistence.DeleteResource(h.resourceName, resourceId) + if err := h.persistence.DeleteResource(h.resourceName, resourceId); err != nil { + h.logger.Warn(fmt.Sprintf("failed to delete persisted resource %s/%s: %v", h.resourceName, resourceId, err)) + } } w.WriteHeader(http.StatusNoContent) diff --git a/module/api_v1_handler.go b/module/api_v1_handler.go index 2acfb9cf..fb799e91 100644 --- a/module/api_v1_handler.go +++ b/module/api_v1_handler.go @@ -3,6 +3,7 @@ package module import ( "encoding/json" "fmt" + "log" "net/http" "os" "path/filepath" @@ -917,7 +918,7 @@ func (h *V1APIHandler) stopWorkflow(w http.ResponseWriter, r *http.Request, id s if inst, ok := h.runtimeManager.GetInstance(id); ok && inst.Status == "running" { if stopErr := h.runtimeManager.StopWorkflow(r.Context(), id); stopErr != nil { // Log but don't fail — the DB status update should still proceed - _ = stopErr + log.Printf("workflow engine: failed to stop workflow %s: %v", id, stopErr) } } } diff --git a/module/api_workflow_handler.go b/module/api_workflow_handler.go index 9dc271f0..c49a0615 100644 --- a/module/api_workflow_handler.go +++ b/module/api_workflow_handler.go @@ -108,7 +108,9 @@ func (h *RESTAPIHandler) syncResourceStateFromEngine(instanceId, resourceId stri // Write-through to persistence if h.persistence != nil { - _ = h.persistence.SaveResource(h.resourceName, res.ID, res.Data) + if err := h.persistence.SaveResource(h.resourceName, res.ID, res.Data); err != nil { + h.logger.Warn(fmt.Sprintf("failed to persist resource %s/%s: %v", h.resourceName, res.ID, err)) + } } } } diff --git a/module/http_handlers.go b/module/http_handlers.go index 528a477f..f8e0a583 100644 --- a/module/http_handlers.go +++ b/module/http_handlers.go @@ -2,6 +2,7 @@ package module import ( "encoding/json" + "log" "net/http" "github.com/CrisisTextLine/modular" @@ -54,8 +55,7 @@ func (h *SimpleHTTPHandler) Handle(w http.ResponseWriter, r *http.Request) { } if err := json.NewEncoder(w).Encode(response); err != nil { - // Log error but continue since response is already committed - _ = err + log.Printf("http handler: failed to encode response: %v", err) } } diff --git a/module/http_trigger.go b/module/http_trigger.go index 115621d5..5dd19797 100644 --- a/module/http_trigger.go +++ b/module/http_trigger.go @@ -3,6 +3,7 @@ package module import ( "context" "fmt" + "log" "maps" "net/http" @@ -246,9 +247,7 @@ func (t *HTTPTrigger) createHandler(route HTTPTriggerRoute) HTTPHandler { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusAccepted) if _, err := w.Write([]byte(`{"status": "workflow triggered"}`)); err != nil { - // Log error but don't fail the trigger - // Note: In a real implementation, we'd need access to a logger here - _ = err // Explicitly ignore error to satisfy linter + log.Printf("http trigger: failed to write response: %v", err) } } diff --git a/module/integration.go b/module/integration.go index a2349901..db98e2f8 100644 --- a/module/integration.go +++ b/module/integration.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io" + "log" "net" "net/http" "net/url" @@ -292,8 +293,7 @@ func (c *HTTPIntegrationConnector) Execute(ctx context.Context, action string, p } defer func() { if err := resp.Body.Close(); err != nil { - // Log error but continue - _ = err // Explicitly ignore error to satisfy linter + log.Printf("integration: failed to close response body: %v", err) } }() @@ -372,8 +372,7 @@ func (c *WebhookIntegrationConnector) Connect(ctx context.Context) error { // Parse the request body defer func() { if err := r.Body.Close(); err != nil { - // Log error but continue - _ = err // Explicitly ignore error to satisfy linter + log.Printf("integration: failed to close request body: %v", err) } }() body, err := io.ReadAll(r.Body) @@ -414,8 +413,7 @@ func (c *WebhookIntegrationConnector) Connect(ctx context.Context) error { // Return success w.WriteHeader(http.StatusOK) if _, err := w.Write([]byte(`{"status":"ok"}`)); err != nil { - // Log error but continue - _ = err // Explicitly ignore error to satisfy linter + log.Printf("integration: failed to write webhook response: %v", err) } }) diff --git a/module/jwt_auth.go b/module/jwt_auth.go index f553407d..3a1702fb 100644 --- a/module/jwt_auth.go +++ b/module/jwt_auth.go @@ -40,6 +40,7 @@ type JWTAuthModule struct { mu sync.RWMutex nextID int app modular.Application + logger modular.Logger persistence *PersistenceStore // optional write-through backend userStore *UserStore // optional external user store (from auth.user-store module) } @@ -89,6 +90,7 @@ func (j *JWTAuthModule) Init(app modular.Application) error { return fmt.Errorf("JWT secret must be at least 32 bytes for security") } j.app = app + j.logger = app.Logger() // Wire external user store (optional — from auth.user-store module) for _, svc := range app.SvcRegistry() { @@ -1164,7 +1166,7 @@ func (j *JWTAuthModule) Start(ctx context.Context) error { if j.seedFile != "" { if err := j.loadSeedUsers(j.seedFile); err != nil { // Non-fatal: log but don't prevent startup - _ = err + j.logger.Warn("failed to load seed users", "file", j.seedFile, "error", err) } } diff --git a/scale/distributed_lock.go b/scale/distributed_lock.go index ac468852..9495d950 100644 --- a/scale/distributed_lock.go +++ b/scale/distributed_lock.go @@ -7,6 +7,7 @@ import ( "encoding/hex" "fmt" "hash/fnv" + "log" "sync" "time" @@ -311,7 +312,9 @@ func (l *RedisLock) buildRelease(key, token string) func() { return func() { once.Do(func() { ctx := context.Background() - _ = redisReleaseScript.Run(ctx, l.client, []string{key}, token).Err() + if err := redisReleaseScript.Run(ctx, l.client, []string{key}, token).Err(); err != nil { + log.Printf("distributed lock: failed to release Redis lock for key %s: %v", key, err) + } }) } }