fix(dedupe): gitea_issue_duplicates misses an exact-title duplicate when the existing body is long #30
Labels
No labels
area/dsh
area/forgejo
experiment
priority/later
priority/next
priority/now
type/bug
type/task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
dsh-plugins/dsh-gitea#30
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
gitea_issue_duplicatesmisses an exact-title duplicate when the existing issue has a long body. Searching for the literal title of #5 returns zero candidates, whilegitea_issue_searchwith the same query returns #5.Repro
A short probe title on the lab repo did match (
score 0.44), so the search itself works.Observed vs expected
candidates: []for a 100%-title match because the candidate body dominates the Jaccard score.Root cause
lib/dup-detect.jscomparescombined = title + body(query) withissue.title + issue.body(candidate) using one Jaccard score over the concatenated text. A long existing body adds many tokens to the union and pulls the score belowthreshold.Proposed fix
Score separately and combine, e.g.
max(similarity(queryTitle, issueTitle), 0.5*bodySim + 0.5*titleSim); weight title more than body. Add a regression fixture with an exact title and a long body asserting a candidate at/above threshold. Keep the no-write guarantee.Acceptance: the Repro returns #5 as a candidate; genuinely unrelated titles still score below threshold.
Duplicate check
Searched
duplicate(state all) — no existing issue. #6/#8 touched label/issue generation, not duplicate detection.Layer
dsh-gitea plugin/tool.
Fixed in
281eade(PR #40).Duplicate scoring now computes title and body similarity separately:
max(titleSim, 0.7*titleSim + 0.3*bodySim), so an exact-title match is not diluted by a long existing body. Added a readable formatter.Live: searching the exact title of #5 →
Likely duplicates (2 issue(s) searched, threshold 0.3): - #5 "…" (score 1.00; title 1.00, body 0.00).Tests:
test/qa-defaults.test.mjs.