Translation detection cache mixes string and confidence-tuple results for conf:-prefixed text
The shared detection_cache in translation_language.py uses raw text as the key for detect_language(), but "conf:" + text for detect_language_with_confidence(). These namespaces overlap: ordinary text beginning with conf: can return the wrong result type from the other API. The source blob I checked is 6f662c3fb95801ace32122d9bfc5d1d02d7298b6, unchanged at the final check.
With deterministic detector responses 'en' and ('en', 0.99), and text = 'The weather forecast predicts sunshine tomorrow':
- Call
detect_language('conf:' + text, hint_language='en')first, thendetect_language_with_confidence(text): the second function returns'en', not a tuple. - Reverse the calls: plain
detect_language('conf:' + text, hint_language='en')returns the cached tuple, not a language string. - Populate the plain result first, then call
classify_translation_need(text, 'en', is_stable=True): unpacking the two-character string produces'e'and'n', then the confidence comparison raisesTypeError: '>=' not supported between instances of 'str' and 'float'.
This is a cache-boundary reproduction, not a claim of an observed production incident or language-detection accuracy. Both APIs are imported by translation_cache.py; its confidence consumer also unpacks the result.
A small local candidate uses structural keys ('language', text) and ('confidence', text), preserving the shared capacity and LRU behavior. It does not change detectors, thresholds, or translation-provider selection.
Validation: loaded the complete production module with scoped substitutes for the two imported dependencies; detector outputs were deterministic and the sentence regex was not exercised. Six checks cover both collision orders, classifier behavior, normal cached return types, empty/short text, and LRU recency/capacity. Unchanged source: 3 pass / 3 fail. Candidate: 6 pass / 0 fail. Ran with Python 3.12; the repository requires Python 3.11, which is unavailable here. Real langdetect, backend unit suite, hermetic merge gate, preflight, and live/device translation were not run. No PR is open.
I checked issues and PRs for the detector names, cache collision, confidence tuples, and translation-language caching, including the #6155 discussion; I found no matching report. Would @josancamon19 or @kodjima33 approve a US$15 PayPal bounty for this focused correction and repository regression coverage? Your contribution guide documents private PayPal claims after merge; please confirm this scope and reward before integration. This is an AI-assisted funding proposal, not an agreed or earned award.
Thanks @kodjima33 for resolving this in #13270. I checked that it is merged and that its description records the repository regression test. My contribution here was the original report, reproduction and tested local candidate; the repository integration and merge were yours.
Could you adjudicate bounty eligibility for @PlayerBC's three proposals that now have merged fixes: this issue #13267 (US$15 proposed), #13249 (US$10 proposed, implemented in #13262 by @Aj2280), and #13206 (US$10 proposed, implemented in #13224 by @ghzhost)? I am not claiming authorship of their integration work or assuming that closing the issues approved those amounts.
Do the original reports and tested candidates qualify for any reward, or are cash bounties limited to the contributors who submit the merged PRs? If a reward is approved, please confirm the amount attributable to @PlayerBC and whether the documented private PayPal claim process applies. Payment details will stay off GitHub. This single follow-up covers the three merged items; I won't post the same request on each issue.