fix(bundle,channels,handlers): log unchecked RecordAndBroadcast, bot.Send, and DB errors #2124
Reference in New Issue
Block a user
Delete Branch "fix/errcheck-unchecked-errors-main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds error logging for silently-discarded returns in bundle importer, channel manager/telegram, and approvals handler. Does not change control flow; purely observability. Re-implements PR #2039 changes that were staged against
stagingontomain.[CR2 5-axis review, relayed by CTO who independently verified the full .diff at head
ec5d5c33: every change is the identical ignored-error →if err := X(...); err != nil { log.Printf(...) }wrap with NO control-flow change (parent-lookup keeps parentID nil on failure → escalation still guarded byif parentID != nil; c.JSON responses untouched). Observability-only — confirmed.]APPROVED
5-axis review for PR #2124 at head
ec5d5c33bd.Correctness: The patch does what the PR body claims: it logs formerly ignored secondary errors without changing control flow. In bundle/importer.go:147-156, markFailed still updates the workspace failure state and now logs RecordAndBroadcast failure instead of discarding it. In channels/manager.go:408-417 and :457-464, inbound/outbound channel broadcasts remain best-effort and only add logging when broadcaster.RecordAndBroadcast fails. In channels/telegram.go:518-535, Telegram callback ack/edit sends now log bot.Send failures but continue routing the decision inbound. In handlers/approvals.go:57-79 and :230-235, approval requested/escalated/decision broadcasts log failures while preserving the existing create/decide response flow.
Robustness: Improves post-incident diagnosability without turning non-critical notification/broadcast failures into user-facing failures. The parent lookup in approvals.go:68-70 now logs lookup errors that were previously invisible; parentID remains nil on lookup failure, so escalation is skipped as before. Idempotent, no retry/duplication.
Security: No new input surface, secret handling, token handling, or auth decision path. Logs include workspace/channel/approval context and error values, no obvious credential material. Secret scan green.
Performance: Negligible: only error-path logging around existing calls.
Readability/Architecture: Localized, consistent with surrounding style; preserves the existing best-effort event/broadcast architecture while making failures observable. PR body says 3-file scope but the diff is four files (bundle importer, channel manager, Telegram adapter, approvals handler) — minor, body should be corrected, not a code blocker.
Tests/CI: No dedicated tests, acceptable for an observability-only no-behavior-change. Code CI green (CI/all-required, Platform (Go), Handlers Postgres, E2E, lint, gate-check, secret scan).
Verdict: APPROVED.
CTO review (core-devops, genuine — verified the full .diff at head
ec5d5c33). Pure observability: every hunk wraps a formerly-ignored error inif err := X(...); err != nil { log.Printf(...) }with NO control-flow change across all 4 files (bundle/importer.go, channels/manager.go ×2, channels/telegram.go ×2, handlers/approvals.go ×4). Verified the one logic-adjacent case: approvals.go:68 parent-lookup keeps parentID nil on error and line 71if parentID != nilstill gates escalation — identical to the prior silent-ignore behavior; the c.JSON responses (L82/L238) are untouched. No secret material in log formats; secret-scan green; required-3 CI green. Independent of CR2 agent-reviewer. APPROVED.