Skip to content

Enhance data handling for Black Friday - #3198

Merged
vytisbulkevicius merged 1 commit into
developmentfrom
bugfix/3196
Nov 23, 2026
Merged

vytisbulkevicius merged 1 commit into
developmentfrom
bugfix/3196

Conversation

@girishpanchal30

@girishpanchal30 girishpanchal30 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes #3196

Summary

Improved Black Friday data integration by adding checks for missing or empty default configuration entries in Main::add_black_friday_data() and the filter callbacks in blocks-animation.php and blocks-css.php. These checks allow earlier filters to opt out of the promotion cleanly and prevent unnecessary processing when no default sale configuration is available.


Checklist before the final review

  • Included E2E or unit tests for the changes in this PR.
  • Visual elements are not affected by independent changes.
  • It is at least compatible with the minimum WordPress version.
  • It loads additional script in frontend only if it is required.
  • Does not impact the Core Web Vitals.
  • In case of deprecation, old blocks are safely migrated.
  • It is usable in Widgets and FSE.
  • Copy/Paste is working if the attributes are modified.
  • PR is following the best practices

@pirate-bot

Copy link
Copy Markdown
Contributor

Bundle Size Diff

Package Old Size New Size Diff
Animations 178.5 KB 178.5 KB 0 B (0.00%)
Blocks 1.65 MB 1.65 MB 0 B (0.00%)
CSS 7.83 KB 7.83 KB 0 B (0.00%)
Dashboard 174.07 KB 174.07 KB 0 B (0.00%)
Onboarding 68.14 KB 68.14 KB 0 B (0.00%)
Export Import 4.73 KB 4.73 KB 0 B (0.00%)
Pro 440.37 KB 440.37 KB 0 B (0.00%)

@pirate-bot

Copy link
Copy Markdown
Contributor

Plugin build for 3c5509b is ready 🛎️!

@pirate-bot

Copy link
Copy Markdown
Contributor

E2E Tests

Playwright Test Status: See serial and parallel matrix jobs

Performance Results serverResponse: {"q25":274.76,"q50":304.34,"q75":311.84,"cnt":10}, firstPaint: {"q25":1020.58,"q50":1057.15,"q75":1200.73,"cnt":10}, domContentLoaded: {"q25":2890.99,"q50":2929.87,"q75":2943.3,"cnt":10}, loaded: {"q25":2894.17,"q50":2932.81,"q75":2946.41,"cnt":10}, firstContentfulPaint: {"q25":1432.45,"q50":1475.37,"q75":2222.85,"cnt":10}, firstBlock: {"q25":12747.55,"q50":12896.15,"q75":13076.79,"cnt":10}, type: {"q25":22.13,"q50":24.23,"q75":26.03,"cnt":10}, typeWithoutInspector: {"q25":17.43,"q50":19.66,"q75":23.95,"cnt":10}, typeWithTopToolbar: {"q25":25.06,"q50":27.1,"q75":31.17,"cnt":10}, typeContainer: {"q25":11.86,"q50":12.23,"q75":13.02,"cnt":10}, focus: {"q25":93.69,"q50":100.51,"q75":114.1,"cnt":10}, inserterOpen: {"q25":33.38,"q50":33.99,"q75":36.6,"cnt":10}, inserterSearch: {"q25":21.11,"q50":21.71,"q75":21.98,"cnt":10}, inserterHover: {"q25":4.16,"q50":4.42,"q75":5.02,"cnt":20}, loadPatterns: {"q25":1404.23,"q50":1430.86,"q75":1514.25,"cnt":10}, listViewOpen: {"q25":158.04,"q50":168.25,"q75":181.6,"cnt":10}

@pirate-bot pirate-bot 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.

🟢 Approved

This approves the fix; the notes ask a developer to confirm two input shapes the new checks may meet.

  • otter-blocks.php:168 — note The themeisle_sdk_telemetry_products callback reads $product['slug'] without a check. An earlier callback that returns an entry without slug would emit Undefined array key "slug", like the fixed Black Friday warning. The SDK seeds each entry with a slug, and no known plugin removes it. Is slug guaranteed after the filter? If yes, the code is safe. If not, skip entries without slug.
Validation details
  • Files reviewed: 5/5 changed files. Narrowed input: Sources was not fully checked.
  • The new tests pass at HEAD: cd /repo && set -o pipefail; timeout 280 vendor/bin/phpunit --do-not-cache-result --filter 'TestBlackFridayData::' 2>&1 … printed OK (3 tests, 6 assertions) (run R2)
  • Against the base code, the two guard tests fail on the reported warning: rm -rf /workspace/checks/R1/base-tree && rsync -a --exclude=.git /repo/ /workspace/checks/R1/base-tree/ && cd /workspace… printed Errors: 2 (run R4)
  • The Blocks Animation and Blocks CSS callbacks warned on empty input at base and pass it through at HEAD `mkdir -p /workspace/checks/R1/base-files && cd /workspace/checks/R1 && cat > closure-harness.php <<'EOF'
Questions for the author - Does the installed SDK show no sale notice when this filter returns an empty array? The SDK v3.3.72 source suggests so. - Can a supported filter return an empty `default` and still expect the Otter entry?
Untested areas - Narrowed input: Sources. Only the SDK seed and the Easy MCP AI empty-array policy were checked as producers. - The PHPUnit suite cannot load the Blocks Animation and Blocks CSS callbacks, so only a standalone harness ran them.
🤖 Automated review · run code-review-agent_6b03edc382e5e0.76430840. --- **🤖 Review agent** — review posted ✅ on `3c5509b0` · [approved · 0 findings](https://github.com//pull/3198#pullrequestreview-6018243169) · 25 min Run `code-review-agent_6b03edc382e5e0.76430840` · [trail](https://agents.vertistudio.com/admin/trails/github-pr/Codeinwp-otter-blocks-3198)

Comment thread inc/class-main.php
*/
public function add_black_friday_data( $configs ) {
// An earlier filter may drop the default entry, or empty the list to opt out of the sale.
if ( empty( $configs['default'] ) ) {

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.

note The new empty() check also skips a present but empty default, such as array( 'default' => array() ). Before this change, Otter still added its sale entry for that value. Does any supported filter send an empty default and expect the Otter entry? If no, the change is safe. If yes, check ! isset() instead, so an empty array still gets the entry.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No supported producer sends an empty default. The SDK always seeds it from get_notice_data(), a non-empty array of title, sale_url, message and time_left (Announcements.php:212-217). Every themeisle_sdk_blackfriday_data callback on the test install reads default and none empties it, so an empty default only arrives when a filter blanks the sale data. Passing it through unchanged is the intended opt-out.

@vytisbulkevicius
vytisbulkevicius merged commit 146b603 into development Nov 23, 2026
15 checks passed
@vytisbulkevicius
vytisbulkevicius deleted the bugfix/3196 branch November 23, 2026 13:51
@pirate-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.2.12 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Indicate that an issue has been resolved and released in a particular version of the product.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants