Skip to content

fix: template - collection block render, pattern headers and PHP checks in check:generation (BPS-10) - #61

Merged
krugazul merged 1 commit into
feat/bps-10-generated-lockfilesfrom
fix/bps-10-generated-php-checks
Oct 28, 2026
Merged

krugazul merged 1 commit into
feat/bps-10-generated-lockfilesfrom
fix/bps-10-generated-php-checks

Conversation

@krugazul

@krugazul krugazul commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Part of BPS-10 (#55). Stacked on #60: merge that first, and GitHub then retargets this PR to develop.

This adds the generated plugin's Composer checks to check:generation and fixes what they found. ls-test never caught these because it is functional-only and has no post types.

Changes

  1. Collection block render. src/blocks/collection/block.json set "render" to a PHP function name. WordPress reads render as a file path, so every generated collection block rendered nothing. It now uses file:./render.php, and render.php echoes its documented render function, as the slider block does. The build now ships render.php in build/blocks/<post-type>-collection/.
  2. Pattern headers and alignment. The seven pattern templates said "ExamplePlugin" in their header comment; they now use {{name}}. Their array arrows are aligned with phpcbf. Alignment depends only on the key names, so it holds for every slug.
  3. PHP checks in check:generation. After composer validate (feat: generator - ship package-lock.json and composer.lock in generated plugins (BPS-10) #60), it now runs composer install, composer run lint (PHPCS), composer run phpstan and composer run test (PHPUnit) in each generated plugin. The CI job sets up PHP 8.4 with Composer, using the same pinned setup-php as ls-test CI.
  4. Tests. The output test checks that the pattern headers name the plugin and that the collection blocks render from render.php. The functional-only test now expects file:./render.php.

Testing

  • node scripts/toolchain/check-generation.js: both fixtures pass every step, including all four new Composer steps. On develop, PHPCS fails the default fixture with 1 error and 59 warnings in 8 files.
  • Jest: the changed suites pass, apart from fills plugin_slug placeholders from slug. That test already fails on develop, because phpunit.xml doesn't contain the slug.
  • Not run locally: the --e2e run. CI runs it for both fixtures.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Generated collection blocks now render through their dedicated render file and display clearer output.
    • Generated pattern headers now use the configured plugin name instead of a fixed example name.
  • Quality Improvements
    • Generated plugins are checked for coding standards, static analysis, and test results during validation.

…ks in check:generation

PHPCS failed on generated plugins with post types, and the collection blocks
never rendered:

- collection/block.json named a PHP function as "render", which WordPress
  reads as a file path. It now uses file:./render.php, which echoes the
  documented render function, as the slider block does.
- The seven patterns said "ExamplePlugin" in their header and had unaligned
  array arrows (phpcbf).
- check:generation now runs composer install, PHPCS, PHPStan and PHPUnit in
  each generated plugin; the CI job sets up PHP 8.4 as ls-test CI does.

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

linear-code Bot commented Oct 28, 2026

Copy link
Copy Markdown

BPS-10

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Note

Some coding-guideline sources were skipped; the reason is listed next to each one. Other guidelines were applied as usual. On a public repository, sources from your configuration are listed without their names.

Skipped guideline sources: 1
a configured source — couldn't be fetched
Walkthrough

Generated plugins now reference collection render files, use configured plugin names in pattern headers, and invoke the collection callback from the included PHP file. Generation checks install Composer dependencies and run PHPCS, PHPStan, and PHPUnit, with PHP 8.4 and Composer configured in CI.

Changes: Generated plugin output and validation

Layer / File(s) Summary
Pattern headers and collection rendering
plugin-template/patterns/*, plugin-template/src/blocks/collection/*, scripts/__tests__/generate-plugin.functional-only.test.js, scripts/__tests__/generate-plugin.output.test.js, CHANGELOG.md
Pattern headers use the configured plugin name. Collection block metadata points to file:./render.php, and the included PHP file calls the generated post-type-specific render function and echoes its HTML. Tests check the generated headers and render references.
Composer checks in generation validation
scripts/toolchain/check-generation.js, .github/workflows/ci-cd.yml, CHANGELOG.md
The generation checker adds Composer installation, PHPCS, PHPStan, and PHPUnit after validation. CI sets up PHP 8.4 and Composer for the generation-check job.

Priority: Not assessed

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

Change: Bug fix

Possibly related issues

  • Issue 45: The generation checks add Composer lint, PHPStan, and test commands, but do not record whether PHPStan is blocking or advisory or address the issue’s E2E and lockfile questions.
  • Issue 55: The PR adds Composer installation, PHPCS, PHPStan, and PHPUnit checks and fixes collection rendering. It does not address the issue’s full list of required files and tooling.
Merge Risk: Minimal · up to 63c84

This PR fixes generated collection blocks that previously rendered nothing, adds the plugin name to pattern headers, and adds PHPCS, PHPStan and PHPUnit checks to generation validation. Collection blocks now output a scaffold placeholder paragraph, which developers are expected to replace with a real query. No concrete merge-blocking risk was found.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.

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

@krugazul
krugazul added this pull request to stack #62 October 28, 2026 21:02
@krugazul
krugazul merged commit a333afc into develop Oct 28, 2026
4 of 19 checks passed
@krugazul
krugazul deleted the fix/bps-10-generated-php-checks branch October 28, 2026 21:06
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