Skip to content

[WOOMOB-1896] Attach full application logs as a file to Zendesk support tickets#16263

Open
AdamGrzybkowski wants to merge 2 commits into
trunkfrom
issue/WOOMOB-1896_attach-full-logs-to-zendesk
Open

[WOOMOB-1896] Attach full application logs as a file to Zendesk support tickets#16263
AdamGrzybkowski wants to merge 2 commits into
trunkfrom
issue/WOOMOB-1896_attach-full-logs-to-zendesk

Conversation

@AdamGrzybkowski

@AdamGrzybkowski AdamGrzybkowski commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

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.txt file 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

  1. Log in to a store.
  2. Go to Settings → Help & Support → Contact Support.
  3. Fill in the form and submit a support request.
  4. In Zendesk, open the created ticket and verify both:
    • the trimmed logs still appear in the left sidebar logs field, and
    • an application_log.txt file is attached, containing the full (untruncated) logs.
  5. Trigger the connectivity-test support flow and confirm it still attaches connectivitytest_log.txt (both attachments can coexist).

Images/gif

N/A

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

@AdamGrzybkowski AdamGrzybkowski added category: unit tests Related to unit testing. feature: support Related to anything in the help & support section, including app logs and the Zendesk SDK. type: enhancement A request for an enhancement. labels Jul 15, 2026
@AdamGrzybkowski AdamGrzybkowski added this to the 25.3 milestone Jul 15, 2026
@AdamGrzybkowski AdamGrzybkowski requested a review from Copilot July 15, 2026 12:30
@wpmobilebot

wpmobilebot commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

App Icon📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Build Number772
Version25.2-rc-1
Application IDcom.woocommerce.android.prealpha
Commit4d20ad7
Installation URL1rhi291fob9fg
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-commenter

codecov-commenter commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.17%. Comparing base (552970e) to head (4d20ad7).

Files with missing lines Patch % Lines
...android/support/zendesk/ZendeskTicketRepository.kt 76.92% 0 Missing and 6 partials ⚠️
...id/support/zendesk/ZendeskEnvironmentDataSource.kt 0.00% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@AdamGrzybkowski AdamGrzybkowski marked this pull request as ready for review July 15, 2026 13:38

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 indefinitelyconfirmed addressed: uploadTextAttachment now wraps the callback in withTimeoutOrNull(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 twiceconfirmed addressed: createRequest now fetches getFullDeviceLogs() once into deviceLogs and reuses it for both the attachment and the trimmed logs custom field (trimDeviceLogs(params.deviceLogs)); takeLast(maxLogfileLength) behavior for the custom field is preserved.
  • Missing test for the diagnosticLog != null pathconfirmed addressed: the new test verifies both connectivitytest_log.txt and application_log.txt tokens 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.

@JorgeMucientes JorgeMucientes self-assigned this Jul 15, 2026
@JorgeMucientes

Copy link
Copy Markdown
Contributor

Quick question @AdamGrzybkowski
I created a Zendesk ticket 11448350-zd-a8c after running the connectivity troubleshooting and didn't see the connectivitytest_log.txt attached in it:

Is there something specific I need to do to get them attached after running the troubleshoot and tapping on "Contact Support" directly?

Comment on lines +142 to +143
File.createTempFile(fileName, null).also {
it.writeText(content)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: unit tests Related to unit testing. feature: support Related to anything in the help & support section, including app logs and the Zendesk SDK. type: enhancement A request for an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants