[WOOMOB-1896] Attach full application logs as a file to Zendesk support tickets#16263
[WOOMOB-1896] Attach full application logs as a file to Zendesk support tickets#16263AdamGrzybkowski wants to merge 2 commits into
Conversation
|
|
There was a problem hiding this comment.
Pull request overview
This PR enhances the Zendesk support ticket creation flow in the store-management app by continuing to include trimmed logs in the ticket’s custom field while also uploading the full application logs as an application_log.txt attachment token for Zendesk.
Changes:
- Upload full device logs as a Zendesk attachment (
application_log.txt) and attach its token to the created request. - Generalize the previous diagnostic-log upload helper into a reusable “text attachment” uploader.
- Add unit tests to verify successful log upload/token attachment, and the fallback behavior when upload fails.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
WooCommerce/src/main/kotlin/com/woocommerce/android/support/zendesk/ZendeskTicketRepository.kt |
Adds full-log upload + token attachment to Zendesk requests; refactors upload helper. |
WooCommerce/src/main/kotlin/com/woocommerce/android/support/zendesk/ZendeskEnvironmentDataSource.kt |
Splits log retrieval into trimmed vs full log APIs. |
WooCommerce/src/test/kotlin/com/woocommerce/android/support/ZendeskTicketRepositoryTest.kt |
Adds tests for full-log upload success/failure behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #16263 +/- ##
============================================
+ Coverage 41.15% 41.17% +0.01%
- Complexity 13501 13502 +1
============================================
Files 2503 2503
Lines 146465 146470 +5
Branches 21761 21763 +2
============================================
+ Hits 60278 60303 +25
+ Misses 80089 80064 -25
- Partials 6098 6103 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
AI Code Review - No issues found. The changes look good.
This PR uploads the full application logs as an application_log.txt Zendesk attachment while keeping the trimmed logs in the existing custom field. The refactor is clean and the callbacks/timeouts are handled correctly.
Prior bot review investigation (Copilot): all three concerns are addressed in the current diff.
- Upload can suspend indefinitely — confirmed addressed:
uploadTextAttachmentnow wraps the callback inwithTimeoutOrNull(attachmentUploadTimeout = 30s)and treats a timeout as a failed upload (null), so ticket creation still proceeds. Verified by the new "log upload never returns" test. - Full logs built twice — confirmed addressed:
createRequestnow fetchesgetFullDeviceLogs()once intodeviceLogsand reuses it for both the attachment and the trimmedlogscustom field (trimDeviceLogs(params.deviceLogs));takeLast(maxLogfileLength)behavior for the custom field is preserved. - Missing test for the
diagnosticLog != nullpath — confirmed addressed: the new test verifies bothconnectivitytest_log.txtandapplication_log.txttokens are attached.
Minor observations (non-blocking): application_log.txt is now uploaded on every ticket even when the logs are empty, and the diagnostic + app-log uploads run sequentially so their timeouts stack; neither is a correctness problem given the per-upload timeout and the outer request-creation timeout.
Automatic review · claude-opus-4-8 · Workflow run
How to reply to a finding
Reply on this review (or inline at the line the finding refers to) with one of:
@claude addressed- I made the change. Bot verifies against the next diff before marking resolved.@claude rejected: <reason>- Will not fix; reason gets quoted on the next review.@claude not-applicable- Finding does not apply (wrong file, already covered elsewhere, etc.).
The bot honours these on the next review pass.
|
Quick question @AdamGrzybkowski
Is there something specific I need to do to get them attached after running the troubleshoot and tapping on "Contact Support" directly? |
| File.createTempFile(fileName, null).also { | ||
| it.writeText(content) |
There was a problem hiding this comment.
Could we also make the local file preparation best-effort? File.createTempFile() and writeText() run before the guarded upload, so an I/O failure—for example, low disk space—would exit the flow before the Zendesk ticket is created. Since the application-log upload now runs for every request, an optional attachment could block contacting support entirely.
Wdyt if we catch file-preparation failures, log them, and continue without the attachment token?


Description
Fixes WOOMOB-1896
This PR keeps the trimmed logs in the sidebar field (unchanged, for convenience) and additionally attaches the full, untruncated logs as an
application_log.txtfile to every support request. This mirrors the iOS counterpart WOOMOB-1800, which shipped the same approach in woocommerce-ios#16445 and has been running in production.Test Steps
logsfield, andapplication_log.txtfile is attached, containing the full (untruncated) logs.connectivitytest_log.txt(both attachments can coexist).Images/gif
N/A
RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.