Skip to content

feat: add send photo command with retries - #18

Merged
dapi merged 20 commits into
mainfrom
feature/issue-16-send-photo-retries-json-output
Mar 13, 2026
Merged

feat: add send photo command with retries#18
dapi merged 20 commits into
mainfrom
feature/issue-16-send-photo-retries-json-output

Conversation

@dapi

@dapi dapi commented Mar 12, 2026

Copy link
Copy Markdown
Owner

Closes #16

dapi and others added 19 commits March 13, 2026 12:19
- Log getMessages enrichment errors instead of silently swallowing them
- Log auth check failures to stderr before returning false
- Wrap onRetry callback in try-catch to protect retry loop
- Complete README send photo flags table (topic, silent, no-forwards, etc.)
- Add unit tests for classifySendError, getRetryDelayMs, formatSendErrorMessage
- Add test for onRetry callback crash resilience

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Log onRetry callback errors instead of silently swallowing them
- Log non-ENOENT errors in resolveEntrypointPath
- Add tests for: retry exhaustion, extractMessageIdFromSendUpdates null,
  preparePhotoMessage parse-mode without caption, retries:0 edge case,
  parseRetryBackoff invalid input, buildSendSuccessPayload without media,
  buildSendPhotoSuccessPayload inputChatId fallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Narrow catch scope in sendPreparedPhotoMessage to only getMessages
- Emit structured JSON retry events to stderr in JSON mode
- Add tests for: timeout before second attempt, retryable "timed out"
  message, inputPeerUser peer extraction, invalid photo filePath

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Change fallback error type from 'network' to 'unknown' for unrecognized errors
- Skip wrapping TypeError/ReferenceError/SyntaxError/RangeError in normalizeSendCommandError
- Add tests for: timeout before first attempt, media without fileId,
  normalizeSendCommandError behavior, FLOOD_WAIT design decision

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add tests for MtRpcError name variant classification
- Add tests for "Request timeout" substring retryable behavior

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add test for getRetryDelayMs with explicit backoff objects

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add warning field to degraded photo response when enrichment fails
- Re-throw TypeError/ReferenceError from onRetry callback
- Add writeError and logSendRetry tests
- Export writeError and logSendRetry for testability
- Add warning propagation tests for buildSendSuccessPayload

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add buildSendPhotoSuccessPayload warning propagation tests
- Add sleep clamping to remaining timeout budget test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add test for extractMessageIdFromSendUpdates fallback path
- Add test for ETIMEDOUT code precedence over bare Timeout message

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unused vi.fn() mock variable in timeout test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dapi
dapi force-pushed the feature/issue-16-send-photo-retries-json-output branch from de68636 to 472a3b3 Compare March 13, 2026 09:26
The function was already imported from core/retry.js; the local
duplicate introduced during rebase caused a SyntaxError.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dapi
dapi merged commit d2ddb72 into main Mar 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: надёжная отправка изображений (sendPhoto) + ретраи + JSON output

1 participant