Skip to content

Builder audit fixes, Pro builder-feature registry and shared field helpers - #3672

Draft
Crabcyborg wants to merge 26 commits into
masterfrom
builder-audit-and-lite-helpers
Draft

Crabcyborg wants to merge 26 commits into
masterfrom
builder-audit-and-lite-helpers

Conversation

@Crabcyborg

@Crabcyborg Crabcyborg commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR fixes the issues found in a form builder audit and moves seven Pro-only builder features behind a registry, so Pro can own that code. It also adds shared helpers for the builder and the front end that Pro and the add-ons can use in place of their own MutationObservers, polling and ad hoc re-init code.

It is split into three commits for review:

  1. fix(builder): the deferred settings metadata posts dropdown instead of select.
  2. feat(front-end): the frmFieldsInserted event, frmFrontForm helpers and the re-init fixes, including Stripe.
  3. feat(builder): the builder audit fixes, the Pro builder-feature registry with its compat bundle, and the shared builder and PHP helpers.

Changes

Builder fixes

  • materializeLogicFieldSettings restores only the cached settings panels whose logic rows use the edited field. It replaces the call to materializeAllFieldSettings on choice edits and option deletes.
  • Client-rendered previews keep the label in .frm_builder_field_name and give the required indicator its frm_required_indicator_{id} id, like the PHP preview.
  • builderPreviewSync.js syncs the textarea size (through data-frmpreview on the size setting) and the HTML field excerpt, including TinyMCE edits.
  • getMultipleOpts reads sibling inputs from each option row, and guards a missing options container.
  • afterAddField initializes multiselect for the new field only, and takes skipOrderSync so a duplicated row syncs field order once. The multiselect #wpcontent click handler is namespaced (off/on), so it no longer stacks.
  • updateInSectionValue restores a cached panel through ensureFieldSettings before it writes.
  • The click binding on [data-changeme] is removed. Input is debounced per setting, and change cancels a pending update.
  • checkUniqueOpt no longer throws when the separate values setting is missing (Lite without Pro). hideShowItem returns false only for links, so input changes keep bubbling.
  • The legacy slider fallback and toggleMultSel are removed. Pro draws the slider preview through frm_update_slider_field_preview.
  • The frm_field_settings_loaded docblock now documents the contract for code that binds to deferred settings panels.
  • The deferred settings metadata posts dropdown instead of select for the field type.

Pro builder-feature registry and compat bundle

  • Calc box, page and section chrome, lookup settings, repeater settings, confirmation field, field logic rows and logic option sync move out of admin.js and into a registry. Lite's call sites use callBuilderFeature, and moved public functions such as frmAdminBuild.adjustConditionalLogicOptionOrders stay as shims.
  • js/src/admin/pro-compat/* holds Lite's original code for each key and builds to js/formidable_admin_pro_compat.js. The logic option sync copy also gets the per-option expected value fix.
  • FrmAppController::enqueue_builder_assets enqueues the compat bundle only when Pro is installed and does not list every key.

Shared helpers

  • livePreview.js, fieldReadiness.js and refreshFieldPreview.js are new modules behind the builder helpers below.
  • The frm_refresh_field_preview endpoint renders a field's builder preview with unsaved settings in memory. Nothing is saved. By default it only uses the field columns, the field's saved settings and the default settings for its type. frm_refresh_field_preview_settings can narrow that list, or return null to allow every posted setting.
  • A [hidden] rule (display:none, not !important, so an inline display from jQuery .show() still wins) applies under .frm_wrap and .with_frm_style.

New public APIs (all @since x.x)

Builder, frmAdminBuild

  • onFieldSettingsReady( selector, cb( panel, fieldId ) )
  • onFieldPreviewReady( selector, cb( fieldLi, fieldId ) )
  • whenFieldSettingsReady( fieldId ), which returns Promise<panel|null>
  • refreshFieldPreview( fieldId, { delay, data, action, apply } ), which returns Promise<fieldLi|null>
  • requestNewField( type, { fieldOptions, sectionId, hasBreak, formId } ), which returns Promise<html>
  • getSettingKey( input ), which returns { key, fieldId } | null
  • getFieldPreviewBody( fieldId )
  • fieldUpdated()
  • liveChanges( input ) (also callable as liveChanges.call( input )). It now clamps numbers to the input's min and max.
  • Registry: registerBuilderFeature( key, impl ), hasBuilderFeature( key ) and callBuilderFeature( key, fnName, ...args )
  • Exposed for registered features: getFieldList, ensureFieldSettings, toggleValidationBox, getNewRowId, fieldsInSection, materializeAllFieldSettings, materializeLogicFieldSettings, getFieldsInRow, toggleMultiSelect, triggerLogicRowEvent, getAppendedLogicRow and getChoiceNewValueAndLabel
  • data-frmpreview declarative preview sync, with data-frmpreview-mode, -fallback, -max, -classes and -prefix

Utilities, frmDom.util

  • debounceByKey( fn, wait = 100 ), which returns run( key, ...args ) with run.cancel( key ) and run.flush( key )
  • oncePerFrame( fn )

Front end, frmFrontForm

  • onFieldsReady( selector, init, { teardown } ), which returns unsubscribe()
  • debounceByKey( fn, wait = 100 )
  • oncePerFrame( fn )

Events and hooks

  • DOM event frmFieldsInserted with detail: { container, formId, source }. Lite fires it for pageChanged and formComplete.
  • wp.hooks action frm_after_live_change( input, targets )
  • wp.hooks action frm_field_preview_refreshed( fieldId, fieldLi )

PHP

  • Filter frm_pro_builder_features, a list of feature keys Pro handles
  • Filter frm_refresh_field_preview_settings( array|null $allowed_keys, object $field )
  • AJAX action frm_refresh_field_preview (FrmFieldsController::refresh_field_preview()), using frm_edit_forms and the frm_ajax nonce
  • FrmAppHelper::PRO_BUILDER_FEATURES, FrmAppHelper::get_pro_builder_features() and FrmAppHelper::needs_pro_builder_compat()
  • FrmAppHelper::is_form_settings_page()
  • frmGlobal.proBuilderFeatures in the localized admin script data

Compatibility

  • Feature detection for consumers: builder helpers use typeof window.frmAdminBuild?.onFieldSettingsReady === 'function'. Front-end helpers use typeof window.frmFrontForm?.onFieldsReady === 'function'. PHP uses is_callable( 'FrmAppHelper::is_form_settings_page' ). Pro and the add-ons keep their old code path behind the failed check, so the two paths never both bind.
  • New Lite + new Pro: Pro lists all seven keys in frm_pro_builder_features and registers its own versions. The compat bundle is not loaded.
  • New Lite + older Pro: the filter is empty, so formidable_admin_pro_compat loads and registers Lite's original code. Behavior is unchanged.
  • Older Lite + new Pro: registerBuilderFeature is missing, so Pro skips registration and older Lite's inline code runs as before.
  • Lite without Pro: nothing is registered and the call sites are no-ops. Those settings are never rendered without Pro.
  • frmFieldsInserted is new, so listeners should keep their jQuery frmPageChanged and frmFormComplete handlers and stay idempotent.

Depends on

This is the Lite PR for the shared helpers. The Pro and add-on PRs that use these helpers will be linked here once they're open.

Testing

  • Lite PHPUnit, full suite against this branch: 1009 tests passed (3 skipped, 3 incomplete, as on master). New tests cover the refresh endpoint, the settings filter, permission and nonce checks and is_form_settings_page. Repeater drop restrictions now come from master's FrmFieldPlacementHelper (covered by test_FrmFieldPlacement), so this PR no longer adds its own.
  • node --test tests/js/*.test.mjs: 26 tests passed, including the new sharedHelpers and builderHelpers tests.
  • Scoped gate on every changed file: phpcs, php-cs-fixer, rector, mago lint, phpstan (no new errors compared with master), psalm (no new errors), typos and ESLint all pass. ESLint reports warnings only, on code moved as-is into pro-compat. Oxlint flags the node: imports in the new tests/js files with no-nodejs-modules, the same rule master's tests/js/fieldPreviewQueue.test.mjs already trips.
  • Built assets were rebuilt from this branch: formidable_admin.js, formidable_admin_pro_compat.js, frm_admin.css, formidable.min.js and frmstrp.min.js.
  • Verified in a browser on the dev site before this branch was split out.

Left out

  • Nothing from this work was dropped. Other uncommitted work in the same checkout (an unrelated color picker refactor, a sniff change and a Cypress spec) is not part of this PR.
  • One change from the verified code: get_pro_builder_features() now checks is_array() on the filter result instead of casting with (array), because phpstan flagged the cast as redundant. A non-array filter result now returns an empty list.

🤖 Generated with Claude Code

Crabcyborg and others added 3 commits November 5, 2026 13:30
A deferred settings panel adds hidden inputs with the field's metadata.
For a dropdown it posted the type as "select", while the field type
setting posts "dropdown" because some security tools flag "select" as
SQL injection. Map the value so both agree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Fire a frmFieldsInserted DOM event on the new form after a page
  change and after an AJAX submit completes, so scripts can initialize
  only the inserted fields.
- Add frmFrontForm.onFieldsReady( selector, init, options ), which runs
  init once per matching element on load, on frmFieldsInserted and on
  the legacy jQuery events, with an optional teardown.
- Add frmFrontForm.debounceByKey and frmFrontForm.oncePerFrame.
- Listen for invalid fields with one document-level capture listener,
  and delegate the select placeholder color and combo label focus so
  they work for inserted fields.
- Stripe: mount the elements again on frmFormComplete and
  frmFieldsInserted, without mounting twice.
- Rebuild formidable.min.js and frmstrp.min.js.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…elpers

Builder fixes:
- Restore only the cached settings panels whose logic rows use the
  edited field, instead of every deferred panel.
- Keep the label text in its own span and give the required indicator
  its id in client-rendered previews.
- Sync the textarea size and HTML field excerpt in the preview.
- Scope option reads to each option row, guard missing containers and
  read separate values only when the setting exists.
- Init multiselect for the added field only, skip the per-field order
  sync while a duplicated row is still arriving, and namespace the
  multiselect click handler.
- Restore a cached panel before updating its in-section value.
- Drop the click binding on data-changeme, debounce input per setting
  and let change cancel a pending update.
- hideShowItem only returns false for links.
- Remove the legacy slider fallback and toggleMultSel.

Pro builder-feature registry:
- frmAdminBuild.registerBuilderFeature, hasBuilderFeature and
  callBuilderFeature. Calc box, page and section chrome, lookup,
  repeater, confirmation field, field logic rows and logic option sync
  moved behind the registry.
- FrmAppHelper::get_pro_builder_features() reads the
  frm_pro_builder_features filter. When Pro does not list every key,
  Lite enqueues formidable_admin_pro_compat with its original code.

Shared helpers:
- frmAdminBuild.onFieldSettingsReady, onFieldPreviewReady,
  whenFieldSettingsReady, refreshFieldPreview, requestNewField,
  getSettingKey, getFieldPreviewBody, fieldUpdated and liveChanges.
- data-frmpreview declarative preview sync and the
  frm_after_live_change hook.
- frmDom.util.debounceByKey and frmDom.util.oncePerFrame.
- frm_refresh_field_preview AJAX endpoint and the
  frm_refresh_field_preview_settings filter.
- FrmAppHelper::is_form_settings_page().
- FrmFieldType::allow_in_repeater() with data-norepeater on the
  builder field and add field button. GDPR opts out.
- [hidden] rule in the admin and front-end CSS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
Pre-merge checks: Passed 1 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Passed Passed checks: 1 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@deepsource-io

deepsource-io Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in e690e5a...39ae773 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Important

Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Dec 1, 2026 7:04p.m. Review ↗
JavaScript Dec 1, 2026 7:04p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

Comment thread js/formidable.js
fieldsReadyListening = true;

document.addEventListener( 'frmFieldsInserted', function( event ) {
queueFieldsReadyScan( event.detail && event.detail.container );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Prefer using an optional chain expression instead, as it's more concise and easier to read


The optional chaining operator can be used to perform null checks before accessing a property, or calling a function.

* @param array|null $allowed_keys Setting names without the field ID suffix, like 'size'. Null allows every posted setting.
* @param object $field The saved field.
*/
$allowed_keys = apply_filters( 'frm_refresh_field_preview_settings', null, $field );

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Function apply_filters invoked with 3 parameters, 2 required


The function call is not valid, which will result in a fatal runtime error.

@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 5, 2026

@franky-the-going-merry franky-the-going-merry 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.

Approving as a draft-stage review: nothing blocking found, but the Pro/add-on half of this contract isn't in the PR, and CI was mostly skipped (draft). Details below.

What I ran (preview env: this PR's Lite at c264cc214 + current Pro master, i.e. the "new Lite + older Pro" path):

  • Builder, form 1: the compat bundle formidable_admin_pro_compat.js loads and registers all 7 keys (hasBuilderFeature true for each). frmGlobal.proBuilderFeatures is [], so the old-Pro path is chosen. No JS errors from window.onerror / unhandledrejection.
  • Label edit updates the preview; the Required toggle works; adding a Radio field via the add-field button works; adding a choice row works; adding a conditional-logic row on a field works.
  • Choice-label live preview behaves the same as on master (checked on both, same script, same result), so I see no regression there.
  • frm_refresh_field_preview: without a nonce it returns 403 (-1); with a nonce and unsaved name_1/size_1 it returns 200 with the field's HTML; a non-existent field_id returns {"success":false}. A posted <script> name is not persisted (a fresh load of the builder doesn't contain it). The capability (frm_edit_forms) and the field/key sanitising are source-read, not tested with a low-privilege user.
  • node --test tests/js/*.test.mjs: 26 pass.

Not exercised: the automated code-review skill pass did not finish within this tick's time budget, so this verdict rests on my own diff read and the live checks above; the "new Lite + new Pro" path (no Pro PR yet, so frm_pro_builder_features is never populated and the registry runs only through the compat bundle); FrmFieldsAjax/FrmAppHelper PHPUnit (CI is skipped on the draft, and I didn't run the suite); the front-end helpers (frmFieldsInserted, frmFrontForm.onFieldsReady, the Stripe re-init) in a browser; the built frmstrp.min.js/formidable.min.js against the sources. DeepSource's PHP and JS checks failed; I did not triage them.

Notes (non-blocking):

  1. refresh_field_preview with no frm_refresh_field_preview_settings filter allows every posted field_options[*_<id>] key through. Values are kses-stripped and nothing is saved, so it's low risk, but a default allowlist in Lite would be safer than relying on Pro/add-ons to narrow it.
  2. .frm_wrap [hidden], .with_frm_style [hidden] { display:none !important } (custom_theme.css.php, _flex.scss) is a site-wide rule on the front end. Anything that relies on hidden plus an inline display from jQuery .show() would stop working. I found no such use in Lite, but Pro and add-ons should be grepped before this ships.
  3. The PR is huge (40 files, +4.4k/−1.3k) and mixes bug fixes, a refactor and new public APIs. Merging the admin.js extraction without the Pro-side PR means the compat bundle is the only production path until Pro lands. Re-test the builder once Pro's registry PR is open.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 5, 2026
@Crabcyborg Crabcyborg added this to the 7.2 milestone Nov 11, 2026
Field preview refreshes now default to an allowlist of the field's
columns, its saved settings and the default settings for its type,
including those added by frm_default_field_options. Unknown posted
settings are ignored unless a frm_refresh_field_preview_settings
callback returns null to allow every posted setting.

The [hidden] rule under .frm_wrap and .with_frm_style is no longer
!important, so an inline display from jQuery .show() in Pro or an
add-on still shows the element. The rule also lands in the rebuilt
frm_testing_mode.css, which imports the same flex utilities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 11, 2026

@franky-the-going-merry franky-the-going-merry 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.

Approve (draft-stage, with one carried-over note). The one new commit since my last review (9bcbd8b, "limit preview settings and soften the hidden rule") fixes my notes 1 and 2. The delta is small, so I re-read only it and re-ran the checks it touches.

Notes from my last review, now resolved

  • 1 (preview allowlist): frm_refresh_field_preview_settings now starts from get_default_preview_setting_keys() (field columns, the field's saved settings, the type's defaults, including frm_default_field_opts). Returning null from the filter still allows everything. Unknown posted keys are dropped by default.
  • 2 ([hidden] rule): display:none !important became plain display:none in custom_theme.css.php and _flex.scss. The compiled frm_admin.css and frm_testing_mode.css carry the non-important rule (checked in the built files). An inline display from jQuery .show() wins again.

Tests run at 9bcbd8b in the wordpress-develop harness (PR copied over the plugin dir, restored afterwards; PHPUnit 9.6, PHP 8.2):

  • test_FrmFieldsAjax.php with --group ajax: OK, 16 tests / 152 assertions. The refresh-preview cases alone: OK, 6 tests / 31 assertions.
  • With the pre-fix FrmFieldsController.php (c264cc2) swapped in, 2 of those 6 fail: the updated filter-seed test and the new test_refresh_field_preview_ignores_unknown_settings_by_default. So the new assertions do catch the old behaviour.
  • --group ajax over the whole PHPUnit tree: OK, 23 tests / 179 assertions.
  • Full default suite: 1010 tests, with 108 errors and 1 failure, all in test_FrmAddon data-set tests (test_get_license_status_only_reports_a_verdict_from_the_api and friends). FrmAddon is not in this PR's diff. I did not get a clean master baseline for those (the harness's master copy predates that test), so treat that as unconfirmed environment noise, not a finding.
  • node --test tests/js/*.test.mjs: 26 pass. php -l clean on both changed PHP files.

Notes (non-blocking)

  • Carried over from my first review: the "new Lite + new Pro" path is still not exercised (no Pro registry PR to load, so frm_pro_builder_features is never populated and the registry runs only through the compat bundle). Re-test the builder once Pro's PR is open. The PR is still ~41 files, +4.5k/−1.3k and mixes fixes, a refactor and public APIs.
  • With no filter, get_default_preview_setting_keys() allows any key already in the field's saved field_options. That is intended (saved settings are fair game), and the values still go through the save-time sanitising.

Not run this round: a browser pass (the delta touches no render path except the CSS rule, which I checked in the built files, not live), code-review/security-review/simplify (small delta), a rebuild of the minified bundles. CI is still skipped on this draft, so these runs are the only test results; DeepSource's two failing checks were not triaged.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 11, 2026
@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 11, 2026

@franky-the-going-merry franky-the-going-merry 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.

Approve (draft-stage, with the carried-over note). Re-review of the whole PR at 9f8aafd. The only new commit since my review at 9bcbd8b is a merge of master; the PR's own changes are the same (I diffed master...9bcbd8b against master...9f8aafd: only hunk offsets and rebuilt bundles differ).

Merge check

  • js/formidable.min.js still carries master's captcha-fallback changes (try{...grecaptcha.getResponse...}catch(e){return false}), plus this PR's applySelectPlaceholderColor and frmFieldsInserted code.
  • js/formidable_admin.js still carries master's Default HTML code-tab change (hasClass("html-active")); the rest of its diff against master is webpack module renumbering from the admin.js extraction.
  • css/frm_admin.css differs from master by only the [hidden]{display:none} rule from this PR.

Tests run at 9f8aafd in the wordpress-develop harness (PR copied over the plugin dir, restored afterwards; PHPUnit 9.6, PHP 8.4):

  • test_FrmFieldsAjax with --group ajax: OK, 16 tests / 152 assertions. --group ajax over the whole tree: OK, 23 / 179.
  • Full default suite: 1031 tests, 5365 assertions, 1 failure, 3 skipped (Pro-only), 3 incomplete. The failure is test_FrmStylesController::test_front_head: WordPress core's wp_maybe_inline_styles notice that wp-includes/css/dist/commands/style.min.css is missing, i.e. the harness's WP core checkout isn't built. It is not in this PR's diff and not about Formidable code, so I'm treating it as environment, not a finding.
  • node --test tests/js/*.test.mjs: 26 pass. php -l clean on every changed PHP file.

Note (non-blocking, carried over): the "new Lite + new Pro" path is still not exercised (no Pro registry PR to load, so frm_pro_builder_features is never populated and the registry runs only through the compat bundle). Re-test the builder once Pro's PR is open. The PR is still ~41 files, +4.5k/−1.3k and mixes fixes, a refactor and public APIs.

Not run this round: a browser pass (no render-path change since my last live pass at c264cc2; the merge only brings master's unrelated changes), code-review/security-review/simplify (no new PR-authored code), a rebuild of the minified bundles. CI is still skipped on this draft, so these runs are the only test results; DeepSource's two failing checks were not triaged.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 11, 2026
@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 23, 2026

@franky-the-going-merry franky-the-going-merry 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.

Approve (draft-stage, one carried-over non-blocking note). Re-review of the whole PR at d37da4b. My last review was Approve at aa64567. Since then: 3d8b707 (one new JS test) and a master merge (d37da4b, brings in master's #3684 gated-content labels; not PR code).

New in 3d8b707 (read in full)

  • tests/js/builderHelpers.test.mjs adds the default preview request sends its action and nonce in the POST body. It stubs fetch, ajaxurl (with a ?lang=fr query) and frmGlobal, calls the default postPreviewRequest(), and asserts fetch got ajaxurl unchanged, POST, and a body ending in action=frm_refresh_field_preview and nonce=fixture-nonce. It restores the globals in finally. This closes my note from the last round.
  • Mutation check: deleting data.append( 'nonce', frmGlobal.nonce ) from js/src/admin/refreshFieldPreview.js turns that test red; restored afterwards. The test can fail.

Tests run at d37da4b (CI skips everything on this draft, so these are the only execution; wordpress-develop harness, PHP 8.4, PR tree swapped in and restored):

  • Full Lite PHPUnit: 1367 tests, 6265 assertions, 1 failure, 4 skipped, 3 incomplete. The one failure is test_FrmStylesController::test_front_head (harness WordPress build is missing wp-includes/css/dist/commands/style.min.css); it fails the same way on the harness's own Lite checkout without this PR, so it is not from this PR.
  • node --test tests/js/*.test.mjs → 71 of 74 pass. The 3 that fail (inlineSubmitAlignment, squareVerifyBuyer, style-live-preview) die with ERR_MODULE_NOT_FOUND: @babel/core because my scratch checkout has no node_modules; they are files this PR does not touch. builderHelpers.test.mjs, including the new test, passes.

Notes (non-blocking)

  • Carried over: the "new Lite + new Pro" path is still not exercised in the Lite repo; the skipped ..._with_pro_registry test covers it once the Pro registry PR (formidable-pro#6961) is loaded. The PR is still 37 files, +4.4k/-1.3k.

Not exercised: a rendered builder pass in a browser (this round's delta is a test-only commit); code-review/security-review/simplify (the delta is a 28-line test, read in full; the rest of the PR was reviewed in full last round and has not changed); PHPCS/PHPStan; DeepSource JavaScript is still failing and was not triaged. Visual check not exercised: no screenshot, the delta adds no visual change.

Tests run: vendor/bin/phpunit --no-coverage (full Lite suite, harness) and node --test tests/js/*.test.mjs at d37da4b → results above.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 23, 2026
@Crabcyborg Crabcyborg added run e2e tests Run the Cypress end-to-end suite on this PR franky-review and removed run e2e tests Run the Cypress end-to-end suite on this PR labels Nov 30, 2026
@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 30, 2026

@franky-the-going-merry franky-the-going-merry 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.

Approve (draft-stage, with notes). Re-review of the whole PR at 10e9bbb. Since my approval at d37da4b the author merged master (including the admin.js split, #3761) and re-ported this PR onto it; the last commit only adds js/formidable_admin_pro_compat.js to the oxlint/eslint ignore lists. The PHP changes are identical to what I reviewed before.

Port check (source read, not a browser):

  • Code this PR removed from master's new builder/*.js modules (conditionalLogic, fieldOptions, fieldPreview, fieldChoices, calculationFields) now lives in js/src/admin/pro-compat/*. I checked the AJAX actions and events (frm_get_options_for_get_values_field, frm_get_field_selection, frm_logic_options_loaded, frm_logic_row_added), plus valueOnFocus, frm_conf_below and the toCollapse handling; each is still present in exactly one place.
  • Master's lazy-settings fixes (#3766, #3733) were carried into the moved code: popCalcFields( element, force, settingsLoaded ) skips the field's own id and re-runs through frmAdminBuild.refreshWhenFieldSettingsLoad, and updateLogicRowsForChoiceEdit takes onlyLogicFieldId. Both callers pass the new arguments, and refreshWhenFieldSettingsLoad is exported on frmAdminBuild and present in the built bundles.

Tests run at 10e9bbb (CI skips everything on this draft, so these are the only execution; wordpress-develop harness, PR copied to its own plugin dir, PHP 8.4):

  • Full Lite PHPUnit: 1459 tests, 6456 assertions. Master baseline in the same harness: 1420 tests, 5 errors, 1 failure. The PR run has those same 6 (5 errors from the harness missing wp-admin/css/view-transitions.min.css, plus test_FrmStylesController::test_front_head) and 3 more failures: test_FrmAppHelper::test_plugin_folder, test_FrmAjax::test_plugin_activated and WP_Test_WordPress_Plugin_Tests::test_plugin_activated. Those 3 only fail because my copy dir is named formidable-pr3672 rather than formidable, so they are artifacts of how I ran it, not PR findings. test_FrmFieldsAjax and the new test_FrmAppHelper cases pass.
  • node --test tests/js/*.test.mjs: 83 of 86 pass. The 3 that fail (inlineSubmitAlignment, squareVerifyBuyer, style-live-preview) die with ERR_MODULE_NOT_FOUND: @babel/core because my scratch checkout has no node_modules; this PR does not touch them.

Notes (non-blocking)

  • The PR conflicts with master right now (GitHub shows CONFLICTING). A trial merge conflicts only in the built files css/frm_admin.css and js/formidable_builder.js; the sources auto-merge. Merge master and rebuild those bundles before it leaves draft.
  • Carried over: the "new Lite + new Pro" path is still not exercised (needs formidable-pro#6961 loaded). The PR is still 50 files, +4.5k/-1.4k and mixes fixes, a refactor and public APIs.

Not exercised: a rendered builder pass in a browser. The port moved a lot of builder code into new files, and this round I verified it by reading source and running tests, not by clicking through the builder. Re-test the builder (add a field, edit choices, conditional logic, calculations) after the master merge and rebuild. Also not run: rebuilding the minified bundles to compare with the committed ones, code-review/security-review/simplify (the PHP is unchanged from my last full review; the JS delta is a port of code already reviewed), PHPCS/PHPStan. DeepSource was not triaged.

Tests run: vendor/bin/phpunit --no-coverage (full Lite suite, harness, PHP 8.4) and node --test tests/js/*.test.mjs at 10e9bbb → results above.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 30, 2026
Crabcyborg and others added 3 commits November 30, 2026 16:08
Built css/frm_admin.css and js/formidable_builder.js conflicted; took
master's copies here and rebuild them from sources in the next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Document the settingsLoaded and onlyLogicFieldId params added during
the port, match hideShowItem's return tag to its link only return, and
drop a padded block line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Crabcyborg

Copy link
Copy Markdown
Contributor Author

Addressed the review at 10e9bbb:

  • Conflicts with master: merged master (3f1fb79). Only css/frm_admin.css and js/formidable_builder.js conflicted. Both were rebuilt from sources with npm ci + npm run build in ecb1a81, not hand merged. The build changed no other bundle.
  • Builder re-test after merge + rebuild: done in a headless browser on dev-site, with this branch at aa43192 and the current Pro, on a throwaway form that was then deleted. Adding a Text field from the sidebar worked. Editing choices worked: renaming a radio choice updated the preview, and adding a choice inserted a row and a preview input. Conditional logic worked: picking the radio field filled the value dropdown with its choices, and renaming the selected choice (Blue to Navy) updated the logic row and kept it selected. Calculations worked: the calc box listed the other fields but not the field itself, and inserting one wrote [28242] into the formula. No JS errors in the console, and nothing new in debug.log apart from the usual core "headers already sent" pair at login.
  • Extra: npx eslint . had 5 errors in files this PR touches (missing JSDoc for settingsLoaded / onlyLogicFieldId, a hideShowItem @return that did not match its link only return, a padded block). Fixed in aa43192. The rebuilt bundles are byte identical after this change.
  • Not changed (carried over, not code): the "new Lite + new Pro" path still needs https://github.com/Strategy11/formidable-pro/pull/6961, and the PR size and scope are unchanged.

Tests: node --test tests/js/*.test.mjs 124/124 pass. eslint and oxlint report 0 errors. PHPUnit (test_FrmFieldsAjax, test_FrmAppHelper, test_FrmFieldUpdateHooks, test_FrmFieldsController, test_FrmFormsController) ran 106 tests with 1 failure: test_plugin_folder, which fails only because the worktree folder is not named formidable, the same harness artifact noted in the review.

@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 30, 2026

@franky-the-going-merry franky-the-going-merry 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.

Approve (draft-stage, with the carried-over note). Re-review of the whole PR at aa43192. My last review was Approve at 10e9bbb. Since then: a master merge (3f1fb79), a rebuild of frm_admin.css and formidable_builder.js (ecb1a81), and a JSDoc lint fix (aa43192).

What changed in the PR's own code since 10e9bbb. I compared the PR's diff against its merge base at both heads, file by file. Only the compiled files and four JSDoc-only edits differ: admin.js (hideShowItem @return {false|void}), calcBox.js (settingsLoaded param), logicOptionSync.js (onlyLogicFieldId param) and a blank line removed in calculationFields.js. I checked each tag against the code: hideShowItem returns false only on the link path, popCalcFields has the settingsLoaded = false param, and updateLogicRowsForChoiceEdit destructures onlyLogicFieldId. No behaviour change.

Bundles. js/formidable_builder.js carries settingsLoaded and onlyLogicFieldId, and css/frm_admin.css carries the [hidden]{display:none} rule (non-!important) from this PR. I checked by strings, not a fresh build (a webpack build in my checkout gives different module ids). The PR is 0 commits behind master and git merge-tree against master is clean.

Tests run at aa43192 (CI is skipping on this draft except Psalm, Typos, DeepScan and Scrutinizer, so these runs are the only execution; wordpress-develop harness, PHP 8.4, PR tree swapped in and restored):

  • node --test tests/js/*.test.mjs: 124 pass, 0 fail.
  • test_FrmFieldsAjax: OK (15 tests, 148 assertions). test_FrmFieldUpdateHooks: OK (5, 19). test_FrmAppHelper: OK (54, 312, 1 skipped: ..._with_pro_registry, needs a Pro that registers the builder features). --group ajax over the tree: OK (26, 189).
  • Full default suite: 1465 tests, 6478 assertions, 5 errors and 1 failure, none in this PR's files: test_FrmSpamCompatibility (4) and test_FrmFormTemplatesController::test_enqueue_assets need a newer Pro than the harness has; test_FrmStylesController::test_front_head is the harness's unbuilt WordPress core CSS. test_FrmWelcomeTourController::test_check_for_form_embeds also fails, and it fails identically on master's copy in the same harness (this PR only touches that test file's neighbours via master merges).
  • eslint .: 0 real errors. The 9 reported errors are all Definition for rule 'sonarjs/...' was not found, from the older plugin version in the node_modules I borrowed from a Lite checkout, not from the code.

Note (non-blocking, carried over): the "new Lite + new Pro" path is still not exercised, because there is no Pro registry PR to load (https://github.com/Strategy11/formidable-pro/pull/6961 is the one named in the author's comment). The skipped ..._with_pro_registry test covers it once that exists; re-test the builder then. The PR is still ~50 files and +4.4k/−1.4k and mixes fixes, a refactor and public APIs.

Not run this round: a rendered builder pass (the PR's render code is unchanged since my last live pass; the author reports a headless pass after the merge, which I did not repeat), code-review/security-review/simplify (no new PR-authored logic), a fresh rebuild of the minified bundles. DeepSource JavaScript is still failing and was not triaged.

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 30, 2026
@@ -0,0 +1,73 @@
/* global frmDom */

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

'frmDom' is already defined as a built-in global variable


The var keyword is soft-deprecated, and should not be used to redeclare existing variables.

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