Why
Canonical source repair for the accepted user-filed delivery issue stranske/Ready#561. At main 9a16cbf, scripts/langchain/issue_dedup.py:219 clamps and rounds scores without validating finiteness. Reproduction confirms NaN raises ValueError and positive infinity misleadingly renders 100%. The script is copy-delivered to Ready by .github/sync-manifest.yml:618; Ready AGENTS.md requires the correction to land in Workflows first.
Scope
Implement Ready #561's existing non-finite similarity contract in its canonical Workflows source and focused test suite. This issue routes already accepted work to the owning repository. Ready #561 stays open for downstream sync and consumer acceptance.
Non-Goals
- Do not change FAISS construction, score selection, similarity thresholds or finite-score semantics.
- Do not edit consumer copies directly or manage generated sync PRs in this implementation.
- Scaffold-only completion does NOT count: catching ValueError without a math.isfinite guard and meaningful regression tests does not deliver this issue.
Tasks
Acceptance Criteria
Implementation Notes
The existing manifest delivery is copy, directly from the canonical script; no duplicate template or new mapping is needed. Existing focused suite is tests/scripts/test_issue_dedup.py rather than the consumer tests/test_main.py. Before fix with new regression cases: 2 failed (NaN and positive infinity), 12 passed. Delivery owner for the consumer sync is Maint 71 after the source PR merges; Ready #561 remains open until its named consumer gate passes.
Why
Canonical source repair for the accepted user-filed delivery issue stranske/Ready#561. At main 9a16cbf,
scripts/langchain/issue_dedup.py:219clamps and rounds scores without validating finiteness. Reproduction confirms NaN raises ValueError and positive infinity misleadingly renders 100%. The script is copy-delivered to Ready by.github/sync-manifest.yml:618; Ready AGENTS.md requires the correction to land in Workflows first.Scope
Implement Ready #561's existing non-finite similarity contract in its canonical Workflows source and focused test suite. This issue routes already accepted work to the owning repository. Ready #561 stays open for downstream sync and consumer acceptance.
Non-Goals
Tasks
_format_similarityinscripts/langchain/issue_dedup.pywithmath.isfiniteand return0%for NaN and either infinity.tests/scripts/test_issue_dedup.pywith non-finite helper and comment rendering cases and finite clamping and rounding regressions.scripts/langchain/issue_dedup.pyin.github/sync-manifest.ymland record Ready [Follow-up] Unmet criteria from PR #560 #561's remaining consumer sync in the PR.Acceptance Criteria
python3 -m pytest tests/scripts/test_issue_dedup.py tests/scripts/test_issue_dedup_smoke.py -q -o addopts=''exits 0; tests prove NaN and both infinities render 0%, public comments retain issue links, and finite scores preserve clamping and rounding. Capture command and results in the PR body.python3 -c "from scripts.langchain.issue_dedup import _format_similarity; assert _format_similarity(float('nan')) == '0%'"exits 0; capture result in the PR body.math.isfiniteguard inscripts/langchain/issue_dedup.py, runpython3 -m pytest tests/scripts/test_issue_dedup.py -k nonfinite -q -o addopts=''and confirm NaN and infinity failures; restore exact source and rerun the full focused suite successfully. Capture both outcomes in the PR body.Implementation Notes
The existing manifest delivery is
copy, directly from the canonical script; no duplicate template or new mapping is needed. Existing focused suite is tests/scripts/test_issue_dedup.py rather than the consumer tests/test_main.py. Before fix with new regression cases: 2 failed (NaN and positive infinity), 12 passed. Delivery owner for the consumer sync is Maint 71 after the source PR merges; Ready #561 remains open until its named consumer gate passes.