Skip to content

Add Media Library upload data types and tracker events#25619

Open
crazytonyli wants to merge 2 commits into
trunkfrom
task/media-v2-upload-foundation
Open

Add Media Library upload data types and tracker events#25619
crazytonyli wants to merge 2 commits into
trunkfrom
task/media-v2-upload-foundation

Conversation

@crazytonyli

Copy link
Copy Markdown
Contributor

Note

This PR will be merged after #25618.

@dangermattic

dangermattic commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@wpmobilebot

Copy link
Copy Markdown
Contributor

🤖 Build Failure Analysis

This build has failures. Claude has analyzed them - check the build annotations for details.

@crazytonyli crazytonyli force-pushed the task/media-v2-upload-format branch from a34822c to 35848ab Compare June 8, 2026 23:18
@crazytonyli crazytonyli force-pushed the task/media-v2-upload-foundation branch from 1b5f4d8 to 26d3fb8 Compare June 8, 2026 23:18
@wpmobilebot

wpmobilebot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number32692
VersionPR #25619
Bundle IDorg.wordpress.alpha
Commit655eccc
Installation URL106j20csb5fk8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

wpmobilebot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number32692
VersionPR #25619
Bundle IDcom.jetpack.alpha
Commit655eccc
Installation URL2i2d7pbu1kht0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@crazytonyli crazytonyli force-pushed the task/media-v2-upload-foundation branch from 26d3fb8 to a4390f8 Compare June 11, 2026 00:32
@crazytonyli crazytonyli force-pushed the task/media-v2-upload-format branch from 35848ab to dad690b Compare June 11, 2026 00:33
Base automatically changed from task/media-v2-upload-format to trunk June 11, 2026 19:57
@crazytonyli crazytonyli force-pushed the task/media-v2-upload-foundation branch 2 times, most recently from 4e19015 to 486c1bf Compare June 12, 2026 00:50
Module-side foundation for the V2 upload pipeline: the upload source and
policy value types, the in-flight/failed/state models, the transport
protocol over the wp_mobile upload call, and the new tracker event cases.
Bumps wordpress-rs to 0.4.0 for the create-media API the transport calls.
@crazytonyli crazytonyli force-pushed the task/media-v2-upload-foundation branch from 486c1bf to de0286a Compare June 16, 2026 03:38
@crazytonyli crazytonyli marked this pull request as ready for review June 16, 2026 04:04
@crazytonyli crazytonyli requested a review from jkmassel June 16, 2026 04:04
@crazytonyli crazytonyli added this to the 27.0 milestone Jun 16, 2026
// .audio / .document map to no event — V1 parity.
return
}
WPAppAnalytics.track(resolvedStat, properties: baseProperties, blog: blog)

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.

media_origin is dropped here. V1 attaches it to these same events via selectionMethodfull_screen_picker for photoLibrary/camera, document_picker for otherApps — but only the .stockPhotos branch sets it. Device/camera/otherApps adds lose the dimension vs V1.

Comment on lines +150 to +153
let trackedEventNames = TestAnalyticsTracker.tracked.map(\.event)
let trackedStats = TestAnalyticsTracker.tracked.map(\.stat)
#expect(!trackedEventNames.contains("media_library_photo_added"))
#expect(!trackedStats.contains(.mediaLibraryAddedPhotoViaStockPhotos))

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.

trackedEventNames is always "" (the adapter only does stat-based tracking), so this assertion can never fail. Assert nothing fired instead:

Suggested change
let trackedEventNames = TestAnalyticsTracker.tracked.map(\.event)
let trackedStats = TestAnalyticsTracker.tracked.map(\.stat)
#expect(!trackedEventNames.contains("media_library_photo_added"))
#expect(!trackedStats.contains(.mediaLibraryAddedPhotoViaStockPhotos))
#expect(TestAnalyticsTracker.tracked.isEmpty)


static let uploadBannerUploadingOnly = NSLocalizedString(
"mediaLibrary.upload.banner.uploadingOnly",
value: "Uploading %1$d items",

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.

Renders "Uploading 1 items" for a single upload — needs singular/plural handling (.stringsdict or a count == 1 branch).

)
static let uploadBannerFailedOnly = NSLocalizedString(
"mediaLibrary.upload.banner.failedOnly",
value: "%1$d upload failed",

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.

Inverse plural bug — "2 upload failed" for >1. Same singular/plural handling as the uploading banner.

value: "All in-progress uploads will be cancelled. This can't be undone.",
comment: "Body of the confirmation alert shown before canceling every in-flight upload."
)
static let cancel = NSLocalizedString(

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.

cancel maps to "Keep uploading", but the repo names alert buttons by their text (cf. notNow, cancellationAlertContinueEditing), so this reads as the destructive action — which is actually uploadBulkCancelAllConfirm ("Cancel uploads"). Suggest renaming:

Suggested change
static let cancel = NSLocalizedString(
static let keepUploading = NSLocalizedString(

Attach media_origin to device/camera/file-picker added events for V1
parity, tighten the Image Playground analytics test, and fix the upload
banner pluralization and the bulk-cancel button name.
@crazytonyli crazytonyli requested a review from jkmassel June 17, 2026 23:52
@wpmobilebot wpmobilebot modified the milestones: 27.0, 27.1 Jun 18, 2026
@wpmobilebot

Copy link
Copy Markdown
Contributor

Version 27.0 has now entered code-freeze, so the milestone of this PR has been updated to 27.1.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants