Skip to content

Guard provider submission success callbacks - #1363

Open
danieliser wants to merge 3 commits into
feature/form-submission-phasesfrom
feature/form-provider-success-guards
Open

Guard provider submission success callbacks#1363
danieliser wants to merge 3 commits into
feature/form-submission-phasesfrom
feature/form-provider-success-guards

Conversation

@danieliser

Copy link
Copy Markdown
Member

Summary

Forminator and WS Form expose callbacks for intermediate persistence states as well as completed submissions. Popup Maker previously treated those callbacks uniformly, so Forminator drafts/abandoned entries and WS Form saves or failed validation could enter the normalized success flow and be counted as conversions.

This stacked correctness patch narrows the existing integrations to authoritative success states:

  • Forminator dispatches only persisted entries whose native status is exactly active.
  • WS Form dispatches only submit receipts with a valid form ID and no native error or validation failures.
  • The browser observer listens only to wsf-submit-success; save receipts no longer produce normalized observations.

The change intentionally adds no new public hook and does not alter action execution. It provides the correctness boundary required by the Pro provider capability adapters in PopupMaker/Pro#142.

Validation

  • vendor/bin/phpunit -c tests/php/phpunit.xml tests/php/tests/FormSubmissionPhases_Test.php — 13 tests, 41 assertions
  • pnpm test:unit -- --runInBand tests/unit/wsforms-integration.test.js — 1 test passed
  • focused PHPCS on the changed PHP files
  • focused WordPress JS lint and Prettier on the changed JS files
  • git diff --check

Stack

Base: feature/form-submission-phases

Related Pro issue: PopupMaker/Pro#142

@danieliser
danieliser marked this pull request as ready for review August 15, 2026 14:31
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • develop

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 48d517e3-69ff-4bc5-a161-b309b61907c3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@danieliser

Copy link
Copy Markdown
Member Author

@codex review for provider success correctness, exactly-once conversion semantics, and missing regression coverage.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df57935112

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +122 to +124
$status = is_object( $entry ) && isset( $entry->status ) ? $entry->status : ( is_array( $entry ) && isset( $entry['status'] ) ? $entry['status'] : null );
if ( 'active' !== $status ) {
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve legacy Forminator success entries

On installations using Forminator versions whose Forminator_Form_Entry_Model predates the status property, successful entries reach this callback without that field and are now unconditionally discarded, disabling server-side submission actions and conversion tracking even though this integration declares no minimum Forminator version. Treat a missing status as the legacy entry shape—while checking legacy spam data where available—and reject only explicit non-success states; the new test currently codifies the regression by expecting a statusless object to be ignored.

AGENTS.md reference: AGENTS.md:L428-L432

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in a23f680. Official WordPress.org Forminator SVN tags confirm the status property is absent through 1.44.3 and present by 1.48.3. Statusless legacy entries now pass only when is_spam is false and draft_id is empty; explicit non-active statuses remain rejected. Regression coverage now includes legacy success, legacy spam/draft, and current active/failure shapes.

@danieliser

Copy link
Copy Markdown
Member Author

@codex review for an exact-head follow-up on the legacy Forminator compatibility fix and the existing exactly-once success guards.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a23f680776

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

* @param array $field_data_array Field data array.
*/
public function on_success( $entry, $form_id, $field_data_array ) {
$status = is_object( $entry ) && isset( $entry->status ) ? $entry->status : ( is_array( $entry ) && isset( $entry['status'] ) ? $entry['status'] : null );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject malformed Forminator entry values

When another plugin or a Forminator signature change invokes this hook with null or a scalar entry, both status checks fall through to the legacy path, where spam defaults to false and the draft ID to null, so the callback dispatches a submission and may run actions or record a conversion for a value that cannot represent a successful entry. Continue accepting statusless legacy objects, but return unless $entry is an object or supported array before applying the legacy fallback.

AGENTS.md reference: AGENTS.md:L428-L432

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 773a94f. The callback now rejects every non-object/non-array entry before applying legacy status fallback, with null and scalar regression cases. Focused PHP tests and PHPCS remain clean.

@danieliser

Copy link
Copy Markdown
Member Author

@codex review exact head 773a94f for the malformed-entry guard and prior provider success fixes.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 773a94f0bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danieliser danieliser changed the title [codex] Guard provider submission success callbacks Guard provider submission success callbacks Aug 15, 2026
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