Fix savings-only handling in aggressive previews - #39
Conversation
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (9)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe CLI now propagates ChangesSavings-only aggressive preview
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 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)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation 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.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🟢 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-onlyinto aggressive preview command formatting and overall-summary aggressive bullets. - Suppresses aggressive previews during
--savings-onlyruns 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.1and 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.
Summary by CodeRabbit
Bug Fixes
--fix --aggressive --savings-onlypreviews to show the correct suggested command.Chores