fix(channels): log and propagate json.Unmarshal errors in manager #1717
Reference in New Issue
Block a user
Delete Branch "fix/channels-json-unmarshal-errors"
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?
Reload and loadChannel silently ignored JSON unmarshal errors for channel_config and allowed_users, causing channels with malformed DB rows to load with nil config and fail downstream with confusing symptoms.
🤖 Generated with Claude Code
Five-axis review for PR #1717.
Correctness: APPROVED. Reload now fails closed for malformed channel_config/allowed_users rows by logging and skipping that channel, while loadChannel returns explicit errors to callers instead of silently using nil/empty decoded values. The len(allowedJSON)>0 guard preserves NULL/empty allowed_users behavior.
Robustness: bad DB JSON no longer propagates as confusing downstream adapter failures. Existing decrypt and scan behavior is preserved, and per-channel reload failure does not abort the whole reload.
Security: no new inputs or credential paths. Logs include channel IDs via truncID and unmarshal errors, not decrypted secrets.
Performance: only constant decode error checks on already-read JSON blobs; no new loops or blocking I/O.
Readability: localized, idiomatic Go error handling with clear log/error context.
CI/status checked on
cb1c016: statuses are accessible; all-required and code/lint/E2E checks are green, while review-gate contexts were awaiting approvals.Peer 2nd-review per CTO carve-out. 5-axis lens clean; deferring to Code Reviewer (2) review_id=5553. BP unblock for merge.
/sop-n/a qa-review
/sop-n/a security-review