Skip to content

Fix failing analysis, PHPUnit and JS unit test CI - #3721

Merged
Crabcyborg merged 2 commits into
masterfrom
fix/lite-ci-green
Nov 18, 2026
Merged

Crabcyborg merged 2 commits into
masterfrom
fix/lite-ci-green

Conversation

@Crabcyborg

@Crabcyborg Crabcyborg commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Brings master back to green. Each of these was failing on a clean checkout of master (310cf1d):

Workflow Before Fix
mago (analyze) 53 errors Declare symbols the CI job can't see: FrmProFieldText, FrmProCopy::install(), wp_unregister_ability_category(), did_filter() (newer than the pinned 5.9 stubs), WPDieException, and the PHPUnit RunInSeparateProcess / PreserveGlobalState / ExpectationFailedException (mago's job doesn't install PHPUnit). Tighten a few test type hints.
phpstan 2 errors Cast the frm_builder_preview_in_browser filter result to bool; drop a redundant (string) cast in FrmFormApi::include_boosts().
php-cs-fixer 1 file Docblock type order in RemoveUselessParenthesesSniff.
oxlint 2 errors Move the microtask wait loops in paypalBootstrap.test.mjs into a helper.
PHPUnit every job dies at "Creating database" (/etc/init.d/mysql: command not found) The ubuntu-26.04 runner no longer ships MySQL. Run it as a service container and point wp-tests-config.php at 127.0.0.1 — same setup Pro's phpunit.yml already uses.
JS unit tests 2 files fail with Cannot find package '@babel/core' Two tests parse source with @babel/core; install dev dependencies first (same cache + npm ci steps as jscs.yml).

No suppressions or baseline entries were added. Every new stub is referenced by code on master.

Verified locally on this branch: mago lint/analyze, phpstan, php-cs-fixer, rector, phpcs, oxlint, typos, JS unit tests all exit 0. PHPUnit and psalm passed locally with the same code changes applied.

🤖 Generated with Claude Code

- mago analyze: declare symbols the analysis jobs cannot see (Pro classes,
  newer WP functions, WPDieException, PHPUnit attributes/exceptions) and
  tighten test type hints.
- phpstan: cast the frm_builder_preview_in_browser filter result to bool;
  drop a redundant string cast.
- php-cs-fixer: normalize docblock type order in RemoveUselessParenthesesSniff.
- oxlint: move the microtask wait loops in paypalBootstrap.test.mjs into a helper.

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

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request updates two runtime expressions and documented union types. It adds PHP and PHPUnit stubs, refines PHP test annotations and inputs, and changes how a PayPal test waits for deferred discovery.

Changes: Runtime and test support updates

Layer / File(s) Summary
Runtime expressions and type documentation
classes/helpers/FrmBuilderPreviewHelper.php, classes/models/FrmFormApi.php, phpcs-sniffs/Formidable/Sniffs/CodeAnalysis/RemoveUselessParenthesesSniff.php
supports() now casts the filter result to a boolean. include_boosts() passes the cache key directly to str_starts_with(). The sniff’s documented union types use a reordered form.
PHP test stubs and annotations
stubs.php, tests/phpunit/phpunit-attributes-stubs.php, tests/phpunit/fields/test_FrmFieldAddress.php, tests/phpunit/fields/test_FrmFieldCombo.php, tests/phpunit/fields/test_FrmFieldsController.php, tests/phpunit/misc/test_FrmAddon.php
New stubs cover additional classes and WordPress APIs. PHPUnit stubs add process-related attributes and an exception class. PHP test annotations and export-heading inputs are updated.
PayPal initialization test waiting
tests/js/paypalBootstrap.test.mjs
A shared helper waits for deferred-discovery counts, replacing the test’s inline microtask loops.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: truongwp, franky-the-going-merry

Merge Risk: Minimal · up to 0eb5e

This change restores static-analysis and lint results with small type, stub and test-helper adjustments. It makes no meaningful change to production behavior, so the risk of merging is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the purpose of the PR, which is fixing failing CI checks, but it does not name the specific tools involved. The changeset covers analysis fixes (mago, phpstan, php-cs-fixer, oxlint) an…
Full details: Title check

Explanation

The title names the purpose of the PR, which is fixing failing CI checks, but it does not name the specific tools involved. The changeset covers analysis fixes (mago, phpstan, php-cs-fixer, oxlint) and PHPUnit/JS test updates. The title is partially related: it refers to real parts of the change but is broad. It is not vague enough to be inconclusive, and it is not off-topic.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 310cf1d and 0eb5e4a.

Files selected for processing: 10

  • classes/helpers/FrmBuilderPreviewHelper.php
  • classes/models/FrmFormApi.php
  • phpcs-sniffs/Formidable/Sniffs/CodeAnalysis/RemoveUselessParenthesesSniff.php
  • stubs.php
  • tests/js/paypalBootstrap.test.mjs
  • tests/phpunit/fields/test_FrmFieldAddress.php
  • tests/phpunit/fields/test_FrmFieldCombo.php
  • tests/phpunit/fields/test_FrmFieldsController.php
  • tests/phpunit/misc/test_FrmAddon.php
  • tests/phpunit/phpunit-attributes-stubs.php

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@deepsource-io

deepsource-io Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 310cf1d...f107c9e 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 ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Nov 17, 2026 7:10p.m. Review ↗
JavaScript Nov 17, 2026 7:10p.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.

- phpunit.yml: the ubuntu-26.04 runner no longer ships MySQL, so
  /etc/init.d/mysql is missing. Run MySQL as a service container and point
  wp-tests-config at 127.0.0.1, matching Pro's workflow.
- js-unit-tests.yml: two tests import @babel/core, so install dev
  dependencies before running node --test (same steps as jscs.yml).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Crabcyborg Crabcyborg changed the title Fix mago, phpstan, php-cs-fixer and oxlint failures on master Fix failing analysis, PHPUnit and JS unit test CI Nov 17, 2026
@Crabcyborg Crabcyborg added this to the 7.1 milestone Nov 17, 2026
@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Nov 17, 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. Every change is test, stub, docblock or workflow config; the two runtime lines are type-only and behavior-neutral. One non-blocking note below.

Tests run (CI skipped every job at this head, so none of these ran there):

  • node --test tests/js/*.test.mjs after npm ci --include=dev --legacy-peer-deps at f107c9e → 64/64 pass (includes the two @babel/core tests the workflow change is for). oxlint tests/js → 0 warnings, 0 errors.
  • PHPUnit in the wordpress-develop harness (PHP 8.2, MariaDB) at f107c9e → test_FrmFieldAddress 52/52, test_FrmFieldCombo 5/5, test_FrmFieldsController 14/14.
  • mago analyze → 0 errors (32 warnings, all in files this PR does not touch); phpstan analyze ./ → [OK] No errors.
  • test_FrmAddon.php (docblock-only change) errors 25/25 in this harness with a PHPUnit mock-generation syntax error, identically with master's copy of the file, so it is the harness, not the PR. Not verified here.
  • Browser/visual check: not exercised (no UI surface in this diff).
  • Not run: php-cs-fixer (the harness vendor tree does not load on this PHP), phpcs (config scan unusable here), psalm, rector.

Non-blocking (workflow, cannot be run here): the PHPUnit and JS workflow edits have not run on this head. The MySQL service block matches formidable-pro's phpunit.yml (same image, env, ports, health options), which had a green run today, but Pro's matrix starts at PHP 8.1. Lite also runs PHP 7.4 and 8.0 against mysql:8.4 (caching_sha2_password only), so add the run tests label and confirm those two jobs connect before merging.

Checked: include_boosts() drops (string) safely ($cache_key is declared '' and set_cache_key() always assigns a string); (bool) on frm_builder_preview_in_browser only changes the return for a non-bool filter value, which the docblock already declares as bool. No suppressions or baseline entries added. Workflow diff does not add cost (no new matrix rows, one service container, npm ci is cache-gated).

@franky-the-going-merry franky-the-going-merry Bot removed franky-review franky-working Franky is actively reviewing this labels Nov 17, 2026
@Crabcyborg
Crabcyborg merged commit 9260981 into master Nov 18, 2026
35 checks passed
@Crabcyborg
Crabcyborg deleted the fix/lite-ci-green branch November 18, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant