Stackable icon indicating copy to clipboard operation
Stackable copied to clipboard

fix compressed-diff workflow

Open bfintal opened this issue 3 months ago • 4 comments

Summary by CodeRabbit

  • New Features
    • Added a Build Size Comparison check that builds PR and base artifacts, generates a per-file size delta report, posts a summary to the PR, and uploads build artifacts for inspection.
  • Chores
    • Replaced the previous compressed-size workflow with the enhanced comparison workflow.
    • Updated CI to support multi-repo builds, reliable dependency installs, artifact zipping/unzipping, and automated PR reporting.

bfintal avatar Sep 10 '25 08:09 bfintal

[!WARNING]

Rate limit exceeded

@bfintal has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 2 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 061a4e932dc4e013f23732eb94bb5eee5581b58b and 61a69d0ae4a4d7942814dd4a994a3dc5a8b8e214.

📒 Files selected for processing (1)
  • .github/workflows/build-size-comparison.yml (1 hunks)

Walkthrough

Replaces a removed compressed-size workflow with a new "Build Size Comparison" GitHub Actions workflow that builds PR and base artifacts (including premium repo copies), computes per-file and total size diffs, posts a PR comment with a Markdown report, uploads both build zips, and adds two local debug side-effect logs in project files.

Changes

Cohort / File(s) Summary
Removed workflow
.github/workflows/compressed-diff.yml
Deleted the previous "Compressed Size" workflow that ran on pull_request for master/develop, used Composer, Node 14 setup, dual checkout of a premium repo, and invoked preactjs/compressed-size-action@v2.
New workflow
.github/workflows/build-size-comparison.yml
Adds "Build Size Comparison" workflow (pull_request on master/develop) that checks out PR repo (full history) and base branch, checks out bfintal/Stackable-Premium for PR and base into pro__premium_only paths, runs npm ci in root and premium dirs, builds (npm run build:no-translate) for PR and base, zips builds (excluding .map and node_modules), unzips and compares file sizes via a generated Python script, produces comparison_report.json and a Markdown PR comment (upserted via GitHub API), and uploads both zips as a build-comparison artifact.
Added runtime log (PHP)
plugin.php
Inserts an error_log('test'); statement after requiring deprecated v2 files, introducing a log-side effect at load time.
Added runtime log (JS)
src/disabled-blocks.js
Adds a top-level console.log('test') after the addFilter call, producing console output on module load.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant GH as GitHub
  participant Runner as Actions Runner
  participant Premium as bfintal/Stackable-Premium
  participant npm as npm Registry
  participant Artifact as Artifact Store

  Dev->>GH: Open PR (target master/develop)
  GH->>Runner: Trigger "Build Size Comparison" workflow

  rect rgb(250,250,255)
    note over Runner: Checkouts
    Runner->>Runner: checkout PR repo (fetch-depth: 0)
    Runner->>Runner: checkout base branch → `base-branch`
    Runner->>Premium: checkout premium repo → `pro__premium_only` (PR)
    Runner->>Premium: checkout premium repo → `base-branch/pro__premium_only` (base)
  end

  rect rgb(245,255,245)
    note over Runner: Install & Build
    Runner->>npm: npm ci (repo root) [PR]
    Runner->>npm: npm ci (pro__premium_only) [PR]
    Runner->>Runner: npm run build:no-translate [PR]
    Runner->>npm: npm ci (base-branch root)
    Runner->>npm: npm ci (base-branch/pro__premium_only)
    Runner->>Runner: npm run build:no-translate (base)
  end

  rect rgb(255,250,240)
    note over Runner: Package & Compare
    Runner->>Runner: zip builds (exclude .map/node_modules)
    Runner->>Runner: unzip into `current-files` and `base-files`
    Runner->>Runner: run compare_files.py → generate JSON & summary
    Runner->>GH: Upsert PR comment with Markdown report
    Runner->>Artifact: upload build zips (artifact)
  end

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Pre-merge checks (2 passed, 1 warning)

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The current title “fix compressed-diff workflow” only references one aspect of this pull request and does not convey the primary changes, which include deleting the old compressed-diff workflow, introducing a comprehensive build-size-comparison workflow, and adding test logging statements in both plugin.php and disabled-blocks.js. This mismatch could mislead reviewers about the scope of the modifications. A good title should reflect the main purpose of the PR in a concise way. Please update the title to clearly summarize the primary change, for example “Replace compressed-diff workflow with build-size-comparison workflow and add test logs” so that the overall intent of the pull request is immediately evident.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

I hopped through branches, zipped each nest,
Counted crumbs of bytes to see which's best,
I logged a whisper in PHP and JS,
Built two gardens, compared their dress,
Rabbit done — the diff laid to rest 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch fix/compressed-diff-workflow

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

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

coderabbitai[bot] avatar Sep 10 '25 08:09 coderabbitai[bot]

🤖 Pull request artifacts

file commit
pr3589-stackable-3589-merge.zip 61a69d0ae4a4d7942814dd4a994a3dc5a8b8e214

github-actions[bot] avatar Sep 10 '25 08:09 github-actions[bot]

Try this Pull Request in the WordPress playground: https://playground.wordpress.net/?mode=seamless#{"landingPage":"/wp-admin/post-new.php?post_type=page","preferredVersions":{"php":"latest","wp":"latest"},"steps":[{"step":"login","username":"admin","password":"password"},{"step":"installPlugin","pluginZipFile":{"resource":"url","url":"https://raw.githubusercontent.com/gambitph/Stackable/artifacts/pr3589-stackable-3589-merge.zip"}}]}

github-actions[bot] avatar Sep 10 '25 08:09 github-actions[bot]

📦 Build Size Comparison

Build Size
Current PR 8.8MB
Base Branch 8.8MB

📈 Total size increased by 38.0B (+0.0%)

Files changed: 2 Large changes flagged: 0

📋 All File Changes

File Current Base Change % Status
991.2KB 991.2KB +20.0B +0.0% 📝
15.8KB 15.8KB +18.0B +0.1% 📝

github-actions[bot] avatar Sep 10 '25 09:09 github-actions[bot]