Skip to content

fix(cli): reject --fail-under outside 0 to 100 with exit 2 (#1037) - #1053

Merged
yakew7 merged 1 commit into
yakew7:mainfrom
minutechreview:fix/fail-under-range-1037
Oct 17, 2026
Merged

yakew7 merged 1 commit into
yakew7:mainfrom
minutechreview:fix/fail-under-range-1037

Conversation

@minutechreview

Copy link
Copy Markdown
Contributor

Summary

faircode profile --fail-under N accepted any number. The score is 0 to 100, so --fail-under 150 failed every run and --fail-under -5 could never fail, which turns a CI gate off without a warning.

Now a value outside 0 to 100 (also nan and inf) exits 2 with:

error: --fail-under must be between 0 and 100, got 150

The check runs at the start of profile, next to the existing --proxy-alpha range check, before the dataset is read. 0 and 100 stay valid.

  • faircode/cli.py: the range check
  • faircode/SPEC.md: a paragraph in section 5 about the gate and its range
  • README.md: one sentence in the CI paragraph
  • tests/test_cli.py: six bad values exit 2 with the message and print nothing to stdout; 0 and 100 still work

Type

  • Audit
  • Explainer
  • Bug fix
  • Other

Linked issue

Closes #1037

Checks: pytest tests --ignore=tests/browser gives 818 passed, 21 skipped. ruff check faircode tests scripts, scripts/check_em_dash.py and scripts/check_broken_links.py pass.

Signed-off-by: minutechreview <141821420+minutechreview@users.noreply.github.com>
@vercel

vercel Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

@minutechreview is attempting to deploy a commit to the yashkewlani2020-gmailcom's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown

@yakew7 @Shreyash0712 @ahmdkaml - new PR touching a path you own, please review.

@yakew7
yakew7 merged commit d603405 into yakew7:main Oct 17, 2026
19 of 20 checks 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-under accepts values outside 0-100, so --fail-under 150 always fails and a negative value never does

2 participants