fix: only exclude confirmed jargon from candidate statistics - #246
Conversation
The statistics pre-filter exclusion query did not distinguish confirmation state, so unconfirmed candidates (is_jargon IS NULL) were excluded as well and their occurrence count never accumulated toward the inference threshold, leaving collected jargon unexplained. - pass only_confirmed=True in jargon_learning and the V2 batch path - document that _get_existing_jargon_terms returns confirmed terms - add unit tests covering both learning paths Fixes #245
Reviewer's GuideFix jargon candidate statistics by excluding only confirmed jargon entries in both legacy and V2 learning flows, allowing pending candidates to accumulate occurrences and reach meaning-inference thresholds; add regression coverage and release the changes as 3.6.4. Sequence diagram for confirmed-only jargon candidate statisticssequenceDiagram
participant Learning as JargonLearning
participant DB as Database
participant Candidate as PendingCandidate
participant Inference as MeaningInference
Learning->>DB: get_recent_jargon_list(chat_id, limit, only_confirmed=True)
DB-->>Learning: confirmed jargon terms
Learning->>Candidate: accumulate repeated occurrences
Candidate-->>Learning: count reaches threshold
Learning->>Inference: infer meaning
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. If the confirmation filter is wrong, pending terms could be promoted and their inferred meanings persisted as jargon records. Reverting would stop further processing but would not remove records already written; those records are bounded and can be corrected or recomputed.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. If the filtering change is wrong, pending terms may be inferred and written as confirmed jargon or have their counts updated in the database. Reverting stops the new behavior, but records created or modified before the revert outlive it and would need manual cleanup or recomputation.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
问题
修复 #245「黑话被收录后长时间无法解释」:候选统计的排除查询未区分确认状态,把
is_jargon IS NULL的待确认词条一并排除,导致候选出现次数始终无法累加到推断阈值,黑话词条被收录后长期停留在待确认状态、无法触发含义推断。修复
services/learning/jargon_learning.py:统计排除查询显式传入only_confirmed=True,只排除已确认黑话;待确认候选继续参与统计,重复出现时正常累加 count,达到 3 次后触发含义推断。同步更新_get_existing_jargon_terms()方法说明。services/core_learning/v2_learning_integration.py:V2 批处理路径应用相同过滤,避免启用 V2 学习时出现相同问题。测试
tests/unit/test_jargon_learning.py,覆盖:查询正确传递only_confirmed=True;旧版学习流程不再排除待确认候选;V2 黑话批处理流程使用相同的确认状态过滤。Fixes #245
Summary by Sourcery
Fix jargon candidate tracking so pending entries remain eligible for repeated-occurrence counting and meaning inference.
Bug Fixes:
Documentation:
Tests:
Chores: