fix(build): anchor .distignore patterns and install no-dev composer deps#1310
Conversation
The previous .distignore relied on rsync's gitignore-style pattern matching but used unanchored entries like `src`, `tests`, `bin`, `docs`. These match at any depth, so they stripped vendor/*/src, vendor/*/tests etc. — including vendor/php-di/php-di/src/, which broke the Jetpack autoloader at activation time with: require_once(.../vendor/php-di/php-di/src/functions.php): Failed to open stream: No such file or directory A second activation fatal then surfaced because the bundled vendor/composer/jetpack_autoload_filemap.php was generated with dev deps included (e.g. myclabs/deep-copy via phpunit), but the distribution intentionally drops vendor/myclabs. Changes: - .distignore: anchor every top-level-only pattern with a leading slash (`/src`, `/tests`, `/bin`, `/docs`, `/.git`, etc.). Tree-wide patterns (`*.zip`, `**/.codex`, `vendor/sebastian`) are kept unanchored or with explicit `**/`. Adds documented preamble explaining the rules and the GH#1310 regression. - .distignore: add `vendor/**/.beads`, `vendor/**/.claude`, `vendor/**/.github` to drop additional vendor-internal dev dirs. - bin/build.sh: run `composer install --no-dev -o` before build_variant() so the bundled autoloader filemap matches what is actually shipped. Restore the dev install via an EXIT trap so the working tree is unchanged after the build. - bin/build.sh: trim the EXTRA exclude block to only safe tree-wide dotfile patterns (`**/.eslintrc*` etc.); the unanchored `tests`, `test`, `.phpunit*`, `phpunit*` patterns are removed because the same intent is now covered by anchored entries in .distignore. Verified: `bin/build.sh --target=both` produces a 2.2M zip whose filemap has no missing-file references; the WP.org-target zip activates cleanly on a fresh WordPress 7.0 install (HTTP 200, debug.log clean of fatals). Resolves the activation regression introduced in #1305 / #1307.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Fixes the activation fatal in the production zip introduced in #1305 / #1307. The published
superdav-ai-agent-1.11.1-wporg.zipcannot be activated because two distribution-build bugs combined to break the Jetpack autoloader filemap.Bug 1 — unanchored
.distignorepatternsbin/build.shfeeds.distignoretorsync --exclude-from. Per rsync semantics, unanchored patterns match at any depth. Entries likesrc,tests,bin,docswere intended to drop the plugin's own top-level directories but were also wipingvendor/*/src/,vendor/*/tests/,vendor/*/bin/,vendor/*/docs/. In particular,vendor/php-di/php-di/src/(the entire library) was being stripped, so activation hard-fatalled with:42 vendor
src/directories were affected.Bug 2 — autoloader filemap referenced dev-only packages
After the rsync fix exposed the next layer: the bundled
vendor/composer/jetpack_autoload_filemap.phpwas generated with dev deps installed (e.g.myclabs/deep-copyvia phpunit), but the zip intentionally excludesvendor/myclabs. Same fatal class, different file:Changes
.distignore— Anchor every top-level-only pattern with a leading slash (/src,/tests,/bin,/docs,/.git,/.github,/.beads,/.claude,/.husky, all top-level config files, top-level READMEs etc.). Tree-wide patterns that should match anywhere (*.zip,*.log,*.map,**/.codex,**/.editorconfig,vendor/sebastian, etc.) are kept unanchored or use explicit**/. Adds a documented preamble explaining the rules and pointing at this regression..distignore— Addsvendor/**/.beads,vendor/**/.claude,vendor/**/.githubto drop vendor-internal dev directories that don't belong in a production zip.bin/build.sh— Runscomposer install --no-dev -obeforebuild_variant()so the bundled autoloader filemap matches what is actually shipped. Restores the dev install via anEXITtrap, so the working tree is unchanged after the build.bin/build.sh— Trims the inlineEXTRAexclude block to only safe tree-wide dotfile patterns (**/.eslintrc*etc.). The unanchoredtests,test,.phpunit*,phpunit*entries are removed because the intent is now covered by anchored entries in.distignore.Verification
bin/build.sh --target=bothproduces:superdav-ai-agent-1.11.1.zip— 2.2 MB / 904 filessuperdav-ai-agent-1.11.1-wporg.zip— 2.1 MB / fewer filesvendor/php-di/php-di/src/functions.phpis present in the zip.vendor/sebastian/,vendor/phpunit/,vendor/myclabs/,vendor/x-wp/di/.beads/,vendor/x-wp/di/.claude/, top-levelsrc/, top-leveltests/,.playwright-mcp/, and.codexfiles are all absent.wp plugin install /path/to/superdav-ai-agent-1.11.1-wporg.zip --activateon a fresh WordPress 7.0 install succeeds with HTTP 200 on the homepage and a cleandebug.log(no fatals related to this plugin).Out of scope
RestControllerTest::test_tool_result_409_*PHPUnit failures pre-existing onmain.vendor/x-wp/di/.beads/etc. only matter for the source tree; they are now also stripped from the zip via the newvendor/**/.beadspattern.