Skip to content

Use continue instead of return when bulk tracking pixel processing#1961

Open
claudiulodro wants to merge 2 commits intotrunkfrom
fix/log-processing
Open

Use continue instead of return when bulk tracking pixel processing#1961
claudiulodro wants to merge 2 commits intotrunkfrom
fix/log-processing

Conversation

@claudiulodro
Copy link
Copy Markdown
Contributor

All Submissions:

Changes proposed in this Pull Request:

Currently the function that records log views uses a return if it encounters an invalid newsletter tracking ID. When that happens, all of the other events after it in the list get thrown away and are not tracked. Using break is better IMO, so any valid events after the invalid one get processed.

How to test the changes in this Pull Request:

Not sure, but I encountered it in the wild. Something like this:

  1. Have a log file with multiple newsletter's tracking pixels.
  2. Manually delete or change the tracking ID meta on one of the newsletters, so the check fails.
  3. wp shell and Newspack_Newsletters\Tracking\Pixel::process_logs()
  4. Observe the data for events after the invalid newsletter isn't recorded.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Comment thread includes/tracking/class-pixel.php Outdated
@claudiulodro claudiulodro changed the title Use break instead of return when bulk tracking pixel processing Use continue instead of return when bulk tracking pixel processing Nov 21, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 24.80%. Comparing base (707891c) to head (3e92957).
⚠️ Report is 7 commits behind head on trunk.

Files with missing lines Patch % Lines
includes/tracking/class-pixel.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##              trunk    #1961   +/-   ##
=========================================
  Coverage     24.80%   24.80%           
  Complexity     2926     2926           
=========================================
  Files            50       50           
  Lines         10355    10355           
=========================================
  Hits           2569     2569           
  Misses         7786     7786           

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

[Status] Approved Ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants