fix(handlers): add rows.Err() checks after rows.Next() loops
Some checks failed
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 10s
sop-tier-check / tier-check (pull_request) Failing after 10s

Add deferred error checks following rows.Next() iteration in:
- ListDelegations (delegation.go): log on error, continue serving results
- org import reconcile orphan query (org.go): log + append to reconcileErrs

Fixes the rows.Err() gap identified in the delegated rows.Err() check PR
(#302, closed; replaced by this PR).  Two additional files already had
the check (activity.go, memories.go) — pattern applied consistently here.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Molecule AI · core-be 2026-05-11 06:15:42 +00:00
parent ab32e47953
commit aa49dbc728
2 changed files with 7 additions and 0 deletions

View File

@ -645,6 +645,9 @@ func (h *DelegationHandler) ListDelegations(c *gin.Context) {
}
delegations = append(delegations, entry)
}
if err := rows.Err(); err != nil {
log.Printf("ListDelegations rows.Err: %v", err)
}
if delegations == nil {
delegations = []map[string]interface{}{}

View File

@ -800,6 +800,10 @@ func (h *OrgHandler) Import(c *gin.Context) {
orphanIDs = append(orphanIDs, orphanID)
}
}
if err := rows.Err(); err != nil {
log.Printf("Org import reconcile: orphan query rows.Err: %v", err)
reconcileErrs = append(reconcileErrs, fmt.Sprintf("orphan query rows.Err: %v", err))
}
rows.Close()
for _, oid := range orphanIDs {