Skip to content

fix: --fail-on-waste 0 no longer fails clean repos - #20

Merged
royalpinto007 merged 1 commit into
AgentPostmortem:mainfrom
wellparth:fix/fail-on-waste-0
Sep 8, 2026
Merged

fix: --fail-on-waste 0 no longer fails clean repos#20
royalpinto007 merged 1 commit into
AgentPostmortem:mainfrom
wellparth:fix/fail-on-waste-0

Conversation

@wellparth

Copy link
Copy Markdown
Contributor

Summary

Fixes #19. wastePct (0) >= 0 is always true, so --fail-on-waste 0 could 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:

if (o.failOnWaste != null && scan.totals.wastePct >= o.failOnWaste && scan.totals.wastePct > 0) return 1;
  • --fail-on-waste 0 on a clean repo → exit 0 (waste is 0, nothing to fail on)
  • --fail-on-waste 0 on a repo with any waste → still exit 1
  • All non-zero thresholds keep their existing >= semantics (verified: fixture at exactly 100% waste still fails --fail-on-waste 100)

Tests

Added three CLI tests (TDD — failing before the fix):

  1. clean repo + --fail-on-waste 0 exits 0
  2. dirty repo + --fail-on-waste 0 still exits 1
  3. threshold boundary: 100% waste fails at threshold 100, 1% threshold catches waste, clean repo passes 50% threshold

Housekeeping

  • Version bumped 0.1.40.1.5, CHANGELOG entry added (per CONTRIBUTING.md)

Verification

npm test → 14/14 passing.

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
@royalpinto007
royalpinto007 merged commit c668bac into AgentPostmortem:main Sep 8, 2026
1 check passed
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.

--fail-on-waste 0 always exits 1, even on a clean repo

2 participants