Skip to content

Conversation

@soderlind
Copy link
Owner

This pull request is a safety-focused patch release (v0.6.4) for the ContentPoll AI plugin. It introduces a conservative dry-run orphan detector for analytics, strengthens vote recording to prevent ambiguous data, and improves front-end vote submission reliability. No schema changes are made, and existing legacy data is preserved, but new problematic records are prevented.

Backend reliability and safety:

  • The vote REST controller (VoteController.php) now requires a valid, non-zero postId for all vote submissions, rejecting requests without proper post context to prevent creation of ambiguous post_id = 0 records.
  • The vote storage logic (VoteStorageService.php) is updated to handle duplicate vote prevention and error handling more robustly by using wpdb::insert and treating any insert failure as a duplicate vote.

Analytics improvements:

  • Added a very conservative dry-run orphan detector in VoteAnalyticsService to help inspect block_ids that no longer appear in post/page content, without performing any deletion. [1] [2]

Front-end enhancements:

  • The front-end vote script (vote-submit.js) now attempts to resolve postId from both the data-post-id attribute and the block editor store (core/editor), increasing reliability in various contexts.

Documentation and versioning:

  • Updated all version references to 0.6.4 and documented the changes in CHANGELOG.md and readme.txt. [1] [2] [3] [4] [5] [6]

Testing:

  • Updated tests to use a valid non-zero postId, ensuring compatibility with the new backend requirements. [1] [2]

- Updated version number in content-poll.php and package.json to 0.6.4.
- Updated stable tag in readme.txt to 0.6.4.
- Added changelog entry for 0.6.4:
  - Introduced a conservative dry-run orphan detector in VoteAnalyticsService to inspect block_ids that no longer appear in post/page content without performing deletions.
  - Emphasized safety in this patch release with no schema, REST API, or front-end behavior changes.
- Refactored VoteStorageService to use wpdb::insert for atomic duplicate prevention and improved error handling.
- Minor formatting adjustments in VoteAnalyticsService for consistency.
- Updated VoteController to require a valid non-zero postId, preventing ambiguous legacy records.
- Modified vote-submit.js to resolve postId from both data attributes and the block editor store.
- Added a dry-run orphan detector in VoteAnalyticsService for inspecting block_ids without deletion.
- Updated CHANGELOG and README to reflect changes and improvements.
- Adjusted tests to ensure postId is set correctly during vote submissions.
@soderlind soderlind merged commit 57b82d2 into main Nov 14, 2025
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.

2 participants