SWE-Rebench v2 hard task
harbor run -t ibragim-badertdinov/ludo-technologies__pyscn-548harbor download ibragim-badertdinov/ludo-technologies__pyscn-548[BUG][auto] duplicate-overlapping-clone-groups: same duplication emitted as two separate near-identical clone groups
pyscn's clone detector emits two separate clone groups that describe the same duplication relationship between the same two code fragments, with member windows shifted by exactly one line (the enclosing with/header line). The result is a redundant clone group that inflates clone_groups count and the duplication percentage.
This is related to but distinct from the (closed) #416 clone-overlapping-window-self-clone: #416 was about strict-subset members within a single group; here the redundancy is across two whole groups that are near-duplicates of each other.
Repo: Instagram/Fixit @ bf8e1f55f8a606eae0f0c64bab575e84a2a608b3
pyscn: v1.22.9
curl -fsSL "https://codeload.github.com/Instagram/Fixit/tar.gz/HEAD" | tar -xz
pyscn analyze --json --no-open Fixit-*/
In the resulting analyze.json, clone.clone_groups contains two groups that cover the same pair of fragments in src/fixit/tests/smoke.py:
{
"id": 6, "type": 2, "similarity": 0.9692,
"clones": [
{"location": {"file_path": ".../smoke.py", "start_line": 299, "end_line": 315}},
{"location": {"file_path": ".../smoke.py", "start_line": 318, "end_line": 334}}
]
},
{
"id": 14, "type": 2, "similarity": 0.9613,
"clones": [
{"location": {"file_path": ".../smoke.py", "start_line": 298, "end_line": 315}},
{"location": {"file_path": ".../smoke.py", "start_line": 317, "end_line": 334}}
]
}
Both groups describe the duplication between the subTest("lint") block and the subTest("fix") block. Group 14's members each start exactly one line earlier than group 6's — that line is the with self.subTest("lint"): / with self.subTest("fix"): header:
with self.subTest("lint"): # line 298 (grp14 member start)
with TemporaryDirectory() as td: # line 299 (grp6 member start)
...
with self.subTest("fix"): # line 317 (grp14 member start)
with TemporaryDirectory() as td: # line 318 (grp6 member start)
Both groups end on the same lines (315 / 334). The two groups are the same logical clone reported twice at slightly different window boundaries.
The clone-grouping/dedup stage should merge (or suppress) clone groups whose members are overlapping windows of the same underlying fragments, so each duplication relationship is reported once. As-is, the clone_groups count (10 here) and the duplication score over-count by one redundant group.
Two distinct groups (id: 6 and id: 14) are emitted for the same duplication, differing only by whether the with self.subTest(...) header line is included in each member window.
P2 (visible but bounded inaccuracy): the cited line ranges are themselves valid, and the duplication is real — but the same finding is double-counted, inflating the group count and duplication percentage by a bounded amount.
Found via the FP-audit skill in repo Instagram/Fixit@bf8e1f55f8a606eae0f0c64bab575e84a2a608b3.
No new interfaces are introduced.