Skip to content

fix(cli): make qa duplicates --threshold work on Typer 0.29 (#1597) - #1607

Closed
swastiktawate wants to merge 1 commit into
pyrite-wiki:devfrom
swastiktawate:fix-1597-typer-029-threshold
Closed

swastiktawate wants to merge 1 commit into
pyrite-wiki:devfrom
swastiktawate:fix-1597-typer-029-threshold

Conversation

@swastiktawate

Copy link
Copy Markdown
Contributor

Fixes #1597.

Typer 0.29 removed the click_type parameter, so every pyrite command crashed at import because qa duplicates --threshold was declared with click_type=_UnitInterval(). This replaces the custom click type with a parser function that raises typer.BadParameter, keeping the same refusal behaviour: values outside 0 to 1, NaN, inf and non-numbers are still refused as usage errors (exit 2).

The fix also covers the boundaries: --threshold 0 and 1 are accepted end to end, pinned by a new CLI test. No other click_type= remains under pyrite/ or extensions/.

Changelog: changelog.d/1597-qa-duplicates-threshold.fixed.md

@markramm markramm left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Automated review by the maintainer's conductor agent, of head c7b58f25. Read from the whole diff; nothing was run on this head.

Thank you for this. The fix is right, and it is the same fix as two pull requests that were already open when this one arrived:

  • #1604 (the maintainer's loop; claimed on the issue at 11:36Z, pushed 11:37Z) and #1603 (opened 11:51Z). The maintainer decided today that #1604 lands, with #1603's author credited as co-author, because #1597 blocks Thursday's release and #1604 carries a test that is red on dev without the fix. #1604 is now in the merge queue. The decision is recorded on #1603.
  • So this pull request cannot land: when #1604 merges, #1597 closes and this is closed as superseded. That is no comment on the quality of the work.

What you did differently, and it is the better idea: test_cli_accepts_a_threshold_on_the_boundary checks the reply (payload["threshold"] and count == 1), where #1604's boundary test checks only the exit code. If you want that kept, open a small test-only pull request against dev after #1604 has merged, adding just that test to tests/test_qa_duplicates.py (prefix test:, no changelog fragment needed). It would be reviewed the same day.

Two notes for next time, so your work is not spent twice:

  1. Before starting an issue, look for an open pull request and a claim comment: gh pr list --state open --search "1597 in:body,title" showed #1603 and #1604, and the issue had a claim comment from 11:36Z. CONTRIBUTING, "Branches, hooks and pull requests", describes the claim rule.
  2. parser=_parse_unit_interval, min=0, max=1 declares the range twice. With a parser= function Typer hands click a function type, and I did not check whether min=/max= are then read or ignored on 0.27.3 and 0.29.1; one of the two should be the rule, not both.

Open work that is yours to pick and has nobody on it: the per-option range issues under #1541 that carry good first issue and have no pull request. Your own open pull requests #1408, #1410, #1415, #1422 and #1428 each have review items waiting, and #1390, #1391, #1411 and #1462 conflict with dev; finishing those would land more than a new one.

Recommendation: close as superseded by #1604 once it has merged.

@markramm markramm added the state: needs-review No review on the current head: the next move is ours label Nov 17, 2026
@markramm

Copy link
Copy Markdown
Collaborator

Closing as superseded, per the review on this head: #1604 merged to dev as 2c47e8c and closes #1597. One thing here is better than what landed: your boundary test checks the reply text, where #1604's checks only the exit code. A test-only pull request that adds that check on top of current dev would be welcome. Thank you.

@markramm markramm closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: needs-review No review on the current head: the next move is ours

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Every pyrite command crashes at import with Typer 0.29 (qa duplicates uses click_type=)

2 participants