Skip to content

Udp.Code. frontend_data logger - #864

Open
alexander-b-clean wants to merge 7 commits into
devfrom
frontend_data-logger.ab
Open

Udp.Code. frontend_data logger#864
alexander-b-clean wants to merge 7 commits into
devfrom
frontend_data-logger.ab

Conversation

@alexander-b-clean

Copy link
Copy Markdown
Contributor

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 refactors bot-detector “frontend data log” collection/transfer into a consolidated browser state payload (apbct_browser_state) that is injected into frontend requests, then parsed server-side and exposed via apbct__bot_detector_get_fd_log(). It also updates AltSessions allow-listing and expands PHPUnit coverage for transport-specific state retrieval.

Changes:

  • Replace periodic “save log to AltSessions” JS with an ApbctBrowserState collector and request-injection (apbct_browser_state) across XHR/fetch/FormData/string bodies.
  • Update PHP to return apbct_browser_state (with defaults/error handling) and add helpers to parse state from RequestParameters/POST.
  • Expand standalone tests to cover AltSessions/NoCookie/POST transports and default-filling behavior.

Reviewed changes

Copilot reviewed 15 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/StandaloneFunctions/TestBotDetectorLogGathering.php Reworked tests to validate new browser-state transport behavior and defaults.
lib/Cleantalk/ApbctWP/Variables/AltSessions.php Allow-list apbct_browser_state as JSON in AltSessions validation.
js/src/public-3-bot-detector-log.js Introduces ApbctBrowserState + apbctGetBrowserStatePair() for request injection.
js/src/public-1-main.js Injects apbct_browser_state into multiple request interception paths (XHR/fetch/etc.).
js/src/public-1-functions.js Includes browser state into NoCookie hidden-field payload / storage data array.
js/prebuild/apbct-public-bundle.js Prebuilt bundle updated with browser state injection logic.
js/prebuild/apbct-public-bundle_int-protection.js Prebuilt bundle updated with browser state injection logic.
js/prebuild/apbct-public-bundle_int-protection_gathering.js Prebuilt bundle updated with browser state injection logic.
js/prebuild/apbct-public-bundle_gathering.js Prebuilt bundle updated with browser state injection logic.
js/prebuild/apbct-public-bundle_full-protection.js Prebuilt bundle updated with browser state injection logic.
js/prebuild/apbct-public-bundle_full-protection_gathering.js Prebuilt bundle updated with browser state injection logic.
js/prebuild/apbct-public-bundle_ext-protection.js Prebuilt bundle updated with browser state injection logic.
js/prebuild/apbct-public-bundle_ext-protection_gathering.js Prebuilt bundle updated with browser state injection logic.
js/apbct-public-bundle.min.js Minified public bundle updated to match new browser state behavior.
inc/cleantalk-common.php Server-side browser state parsing + updated fd-log return structure.
cleantalk.php Changes bot detector wrapper script URL constant.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cleantalk.php
Comment thread js/src/public-3-bot-detector-log.js
Comment thread inc/cleantalk-common.php
alexander-b-clean and others added 2 commits August 21, 2026 18:38
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
# Conflicts:
#	js/apbct-public-bundle.min.js
#	js/apbct-public-bundle_ext-protection.min.js
#	js/apbct-public-bundle_ext-protection_gathering.min.js
#	js/apbct-public-bundle_full-protection.min.js
#	js/apbct-public-bundle_full-protection_gathering.min.js
#	js/apbct-public-bundle_gathering.min.js
#	js/apbct-public-bundle_int-protection.min.js
#	js/apbct-public-bundle_int-protection_gathering.min.js
@Glomberg

Copy link
Copy Markdown
Member

Please, fix autotests first.

@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 29.28%. Comparing base (59767a2) to head (80501e9).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@             Coverage Diff              @@
##                dev     #864      +/-   ##
============================================
+ Coverage     29.20%   29.28%   +0.08%     
- Complexity     6443     6446       +3     
============================================
  Files           287      287              
  Lines         26064    26071       +7     
============================================
+ Hits           7611     7634      +23     
+ Misses        18453    18437      -16     

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

@AntonV1211
AntonV1211 requested review from alexandergull and removed request for AntonV1211 August 24, 2026 12:42
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.

5 participants