Skip to content

Fix Preview site and Push size validation to exclude archived-out directories - #2598

Merged
epeicher merged 1 commit into
trunkfrom
stu-1303-investigate-preview-size-limit-and-node_modules-exclusion
Feb 18, 2026
Merged

Fix Preview site and Push size validation to exclude archived-out directories#2598
epeicher merged 1 commit into
trunkfrom
stu-1303-investigate-preview-size-limit-and-node_modules-exclusion

Conversation

@epeicher

@epeicher epeicher commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

Related issues

Proposed Changes

  • Extract archive exclusion logic (.git, node_modules) into a shared isExcludedFromArchive function in common/lib/fs-utils.ts
  • Apply exclusions in calculateDirectorySizeForArchive (renamed from calculateDirectorySize) so size validation matches what actually gets archived
  • Use the shared function in cli/lib/archive.ts instead of inline string checks
  • Add post-change verification instructions to AGENTS.md

Testing Instructions

  • Create a local WordPress site with a plugin that contains a large node_modules directory inside wp-content/plugins/. For example, you can clone the Gutenberg repo into wp-content/plugins and run nvm use && npm install there
  • Ensure the total wp-content size exceeds 2GB but the size without node_modules/.git is under 2GB
  • Attempt to create a preview site — it should no longer be rejected by the size validation
  • Connect the site to a WordPress.com site
  • Push the local site, and check the size reported is the expected one (without node_modules)
  • Check that if the site contains large files, the validation still applies as expected

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
The size validation was rejecting sites that included large .git or
node_modules directories inside wp-content, even though those directories
are filtered out during archive creation. This extracts the exclusion
logic into a shared isExcludedFromArchive function and applies it
consistently in both the size calculation and the archive step.
@epeicher epeicher changed the title Fix preview site size validation to exclude archived-out directories Feb 17, 2026
@epeicher epeicher self-assigned this Feb 17, 2026
@epeicher
epeicher requested a review from a team February 17, 2026 10:54
Comment thread AGENTS.md
**Dev/Build**: `npm start` | `npm run cli:build` | `node dist/cli/main.js`
**Test**: `npm test [-- path/to/test.test.ts]` | `npm run e2e`
**Quality**: `npm run lint` | `npx prettier --write <files>` (format ONLY modified files)
**IMPORTANT - Post-Change Verification**: After applying code changes, always run the linter (`npm run lint`), format modified files (`npx prettier --write <files>`), and run relevant tests (`npm test [-- path/to/test]`) before considering the work complete.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added this as the coding agent was including changes with linting errors

Comment thread common/lib/fs-utils.ts
* @returns A promise that resolves to the total size in bytes
*/
export function calculateDirectorySize( directoryPath: string ): Promise< number > {
export function calculateDirectorySizeForArchive( directoryPath: string ): Promise< number > {

@epeicher epeicher Feb 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renaming this was not strictly required, but I think it better resembles that the directory size has some excluded folders

@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing ff8b180 vs trunk

site-editor

Metric trunk ff8b180 Diff Change
load 2703.00 ms 2717.00 ms +14.00 ms ⚪ 0.0%

site-startup

Metric trunk ff8b180 Diff Change
siteCreation 7049.00 ms 7080.00 ms +31.00 ms ⚪ 0.0%
siteStartup 3926.00 ms 3931.00 ms +5.00 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@ivan-ottinger ivan-ottinger 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.

Nice fix! The proposed changes look good to me and work as expected:

Before:

Preview site:
Image

Push:
Image

After:

Preview site:
Image

Push:
Image

Thank you for clear testing instructions.

@epeicher

Copy link
Copy Markdown
Contributor Author

Thanks for your review and thorough testing, including before/after screenshots @ivan-ottinger!

@epeicher
epeicher merged commit 5af403f into trunk Feb 18, 2026
14 checks passed
@epeicher
epeicher deleted the stu-1303-investigate-preview-size-limit-and-node_modules-exclusion branch February 18, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants