Skip to content

Cleanup: remove verified-dead code (ponytail audit) - #7

Merged
vapvarun merged 1 commit into
masterfrom
cleanup/dead-code
Aug 28, 2026
Merged

Cleanup: remove verified-dead code (ponytail audit)#7
vapvarun merged 1 commit into
masterfrom
cleanup/dead-code

Conversation

@vapvarun

Copy link
Copy Markdown
Member

Summary

Removes one proven-dead private method. Correctness over volume - this plugin is already lean; only a single orphaned helper qualified.

Removed

  • Infinite_Loader_For_Woocommerce_Public::debug_log() (public class, was line 620)
    • Proof: grep -rn "debug_log" --include="*.php" returns only the definition - zero callers. private method, so no dynamic/external dispatch is possible. Removing it changes no behavior.
    • Net: -11 lines, PHP-only (no JS/CSS source touched -> grunt min bundles unaffected).

Reviewed and KEPT (owner decisions - not cut)

  • Rate limiter (check_rate_limit / get_client_ip): guards the live read-GET next-page fetch, which sends infinite_loader_ajax=1 (infinite_loader_products.js:265). It protects a real endpoint against DoS/scraping - HIGH RISK to remove, owner decision.
  • add_security_headers(): live X-Frame-Options / X-Content-Type-Options / Referrer-Policy / X-XSS-Protection on frontend WooCommerce pages. Owner decision.
  • Hand-rolled sanitize_hex_color() (public + admin): many live callers; signature differs from WP core (takes a $default fallback, and runs on the frontend where the customizer's sanitize_hex_color() is not guaranteed loaded). NOT an exact core replacement - kept.
  • sanitize_css_js_option / sanitize_javascript: input sanitization on save - never removed.
  • WPPB boilerplate JS (infinite-loader-for-woocommerce-public.js hover/click handlers, admin icon-picker): thin but genuinely enqueued and executing - not dead.

Gate

bash bin/build-release.sh -> PHP lint clean, verify-build-freshness: OK, zip built (86 files). Green.

No version bump, no changelog edit, no refactors. dist/*.zip build artifacts intentionally excluded from the commit.

Proof: `grep -rn "debug_log" --include="*.php"` returns only the definition at
public/class-infinite-loader-for-woocommerce-public.php:620 - zero callers. It
is a `private` method, so no dynamic/external dispatch is possible; nothing in
the class (or repo) invokes it. Removing it changes no behavior.

PHP-only cut - no JS/CSS source touched, so the grunt min bundles are
unaffected. build-release.sh passes: PHP lint clean, verify-build-freshness OK,
zip built.

Kept (reported as owner decisions, not cut):
- Rate limiter (check_rate_limit/get_client_ip) - guards the live read-GET
  next-page fetch, which sends infinite_loader_ajax=1 (infinite_loader_products.js:265).
  DoS/scraping protection on a real endpoint; owner decision.
- add_security_headers() - live X-Frame/X-Content-Type/Referrer-Policy headers
  on frontend WooCommerce pages; owner decision.
- Hand-rolled sanitize_hex_color() (public + admin) - many live callers, and the
  signature differs from core (takes a $default fallback, runs on the frontend
  where the customizer's sanitize_hex_color() is not guaranteed loaded); NOT an
  exact core replacement.
- sanitize_css_js_option / sanitize_javascript - input sanitization, never removed.
@vapvarun
vapvarun merged commit a1d71c8 into master Aug 28, 2026
7 checks passed
@vapvarun
vapvarun deleted the cleanup/dead-code branch August 28, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant