Skip to content

Fix savings-only handling in aggressive previews - #39

Merged
j9t merged 1 commit into
mainfrom
fix/aggressive-preview-gate
Sep 8, 2026
Merged

j9t merged 1 commit into
mainfrom
fix/aggressive-preview-gate

Conversation

@j9t

@j9t j9t commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes

    • Improved --fix --aggressive --savings-only previews to show the correct suggested command.
    • Suppressed aggressive previews when the suggested rerun would provide fewer savings than the completed run.
    • Updated per-file and overall summaries to consistently reflect savings-only mode.
  • Chores

    • Updated the application version to 1.13.1.
    • Added changelog documentation for the preview behavior improvements.

Ensure that `--savings-only` runs properly suppress aggressive mode previews when aggressive re-runs would save less than the current run. Also, update suggested commands to include the `--savings-only` flag where applicable.

(This commit message was AI-generated.)

Signed-off-by: Jens Oliver Meiert <jens@meiert.com>
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 97a438ea-c63a-4044-b852-64981b0db8fb

📥 Commits

Reviewing files that changed from the base of the PR and between 109454b and 3701039.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • CHANGELOG.md
  • bin/css-dedup.js
  • package.json
  • src/cli/file-pass.js
  • src/cli/format.js
  • src/cli/render.js
  • test/cli.test.js
  • test/format.test.js
  • test/helpers.js

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


Walkthrough

The CLI now propagates --savings-only through aggressive preview calculation and rendering. It suppresses previews for costlier aggressive reruns and includes the active flag in per-file and aggregate command suggestions.

Changes

Savings-only aggressive preview

Layer / File(s) Summary
Aggressive preview evaluation
src/cli/file-pass.js, src/cli/format.js
The fix pass omits an aggressive preview when the savings-only rerun saves fewer bytes. Preview commands now include --savings-only when active.
Preview option propagation
src/cli/render.js, bin/css-dedup.js
Savings-only state now flows through per-file rendering and aggregate summaries.
Regression coverage and release metadata
test/cli.test.js, test/format.test.js, test/helpers.js, CHANGELOG.md, package.json
Tests cover suppression and command formatting. The fixture, changelog, and package version record the release.Estimated code review effort: 3 (Moderate)

Priority: ⬇️ Low — Defer this CLI preview fix because it narrowly adjusts savings-only handling and output formatting without broader product-surface impact.

Merge Risk: ⚪ Minimal · up to 37010

Aggressive previews now omit costlier savings-only reruns and show commands that preserve the active flag. The covered behavior is ready to merge with no identified current-head risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 76.92% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 7 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: correcting savings-only behavior in aggressive previews.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 76.92% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 7 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/aggressive-preview-gate

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The behavior change is narrowly scoped, consistently threaded through the CLI rendering paths, and is backed by targeted unit and CLI integration tests.

Pull request overview

This PR fixes how --savings-only interacts with --aggressive “preview” output in --fix runs, ensuring the suggested re-run command matches the measurement mode and suppressing aggressive previews that would be strictly worse under the savings-only gate.

Changes:

  • Propagates --savings-only into aggressive preview command formatting and overall-summary aggressive bullets.
  • Suppresses aggressive previews during --savings-only runs when the gated aggressive re-run would save fewer bytes than the completed run.
  • Adds/updates tests and fixtures to cover the corrected preview behavior; bumps version to 1.13.1 and documents the fix in the changelog.
File summaries
File Description
test/helpers.js Adds a fixture CSS case where aggressive becomes costlier under savings-only gating.
test/format.test.js Adds unit coverage ensuring aggressive preview text includes --savings-only when applicable.
test/cli.test.js Adds CLI-level tests for suppressing aggressive previews and for gated-command suggestion behavior in per-file and overall summaries.
src/cli/render.js Threads savingsOnly through rendering paths and uses it when producing aggressive preview/summaries.
src/cli/format.js Introduces aggressiveFixCommand() and updates preview formatting to include --savings-only when relevant.
src/cli/file-pass.js Updates aggressive-preview computation to account for savings-only mode and suppress “worse” gated reruns.
bin/css-dedup.js Passes savingsOnly into rendering and overall-summary printing.
package.json Bumps package version to 1.13.1.
package-lock.json Updates lockfile package version fields to 1.13.1.
CHANGELOG.md Documents the --savings-only aggressive-preview fixes under 1.13.1.
Review details
  • Files reviewed: 8/10 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@j9t
j9t merged commit 2af2a08 into main Sep 8, 2026
7 checks passed
@j9t
j9t deleted the fix/aggressive-preview-gate branch September 8, 2026 13:27
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.

2 participants