fix: --fail-on-waste 0 no longer fails clean repos - #20
Merged
Conversation
wastePct (0) >= 0 is always true, so a clean repo could never pass a 0% threshold and CI wiring --fail-on-waste 0 failed every build. Require actual waste (> 0%) to trip the threshold; all non-zero thresholds keep their existing >= semantics and boundary behaviour. Closes AgentPostmortem#19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #19.
wastePct (0) >= 0is always true, so--fail-on-waste 0could never pass — a clean repo (0% waste) exited 1, breaking CI that wires a 0% gate.Fix
In
src/cli.js, the fail check now also requires actual waste:--fail-on-waste 0on a clean repo → exit 0 (waste is 0, nothing to fail on)--fail-on-waste 0on a repo with any waste → still exit 1>=semantics (verified: fixture at exactly 100% waste still fails--fail-on-waste 100)Tests
Added three CLI tests (TDD — failing before the fix):
--fail-on-waste 0exits 0--fail-on-waste 0still exits 1Housekeeping
0.1.4→0.1.5, CHANGELOG entry added (per CONTRIBUTING.md)Verification
npm test→ 14/14 passing.