Skip to content

fix(memory): tighten initial similarity tresholds#18666

Open
nijel wants to merge 1 commit intoWeblateOrg:mainfrom
nijel:tm-thresholds
Open

fix(memory): tighten initial similarity tresholds#18666
nijel wants to merge 1 commit intoWeblateOrg:mainfrom
nijel:tm-thresholds

Conversation

@nijel
Copy link
Member

@nijel nijel commented Mar 26, 2026

With the fallback in place, we no longer need broad matches by default, we can get to them if no actual matches are there.

This might be actually the solution for #18611.

@nijel nijel added this to the 5.17 milestone Mar 26, 2026
@nijel nijel requested review from amCap1712 and Copilot March 26, 2026 14:36
@nijel nijel self-assigned this Mar 26, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e29999eb21

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Tightens Translation Memory pg_trgm similarity thresholds—especially for short/common strings—to reduce overly broad fuzzy scans and mitigate slow PostgreSQL queries/backlogs (related to #18611).

Changes:

  • Adjusts threshold_to_similarity() to be stricter for short strings and treats threshold >= 100 as exact (1.0).
  • Adds minimum_similarity() and updates lookup() to stop backoff earlier based on string length.
  • Updates/extends unit tests to cover the new similarity policy and lookup behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
weblate/memory/models.py Introduces stricter similarity thresholds for short strings and a new minimum backoff floor used by lookup().
weblate/memory/tests.py Updates expected similarity values and adds tests asserting the new minimum/backoff behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@argos-ci
Copy link

argos-ci bot commented Mar 26, 2026

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 21 changed Mar 26, 2026, 5:10 PM

With the fallback in place, we no longer need broad matches by default,
we can get to them if no actual matches are there.
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.

2 participants