[Feature Request] Improve comparison algorithm to handle frame offsets intelligently (GSoC Qualification)
Maintainers usually reply within 6 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- python
- Domain
- testing-qa
Research direction
Start in mod_test/nicediff/diff.py, especially get_html_diff around lines 123–217 and its event generation. Read how the current line-by-line comparison uses test_correct_lines and test_res_lines, then define the behavior for insertion, deletion, replacement, and equal ranges. Done means dropped or offset frames are isolated while matching later lines remain passed and the HTML diff is accurate.
Written by the indexing model from the issue text.
Description
Context
According to the "Sample Platform NG" GSoC project brief, one of the major goals is to improve the comparison algorithm. Currently, the comparison system is quite rigid, evaluating results strictly line-by-line. If a single frame (subtitle frame) is missing or slightly offset in the output, it causes a chain reaction where all subsequent frames are treated as a mismatch, causing the entire test to fail unnecessarily.
Current Behavior
In mod_test/nicediff/diff.py (around line 144 to 157 in get_html_diff), the logic iterates through use length and compares test_correct_lines[line] == test_res_lines[line].
This naive 1-to-1 index matching means that if test_res_lines drops line index 5, then index 6 of the result is compared against index 5 of the expected output, index 7 vs index 6, leading to a 100% mismatch from that point onwards.
Expected Behavior
The comparison algorithm should be smart enough to detect insertions, deletions, and offsets. If a single frame is dropped, the diff should highlight only that specific dropped frame as an error, and successfully resync/align the remaining lines that match.
Proposed Solution
I propose rewriting the core logic in mod_test/nicediff/diff.py (specifically get_html_diff and the event generation) to leverage a Sequence Matching algorithm (such as Python's built-in difflib.SequenceMatcher or a similar longest-common-subsequence approach).
This will allow us to:
- Identify the exact opcode (
replace,delete,insert,equal) for block ranges. - Gracefully handle offsets so the rest of the valid output remains marked as "Passed".
- Render a much more accurate and readable HTML diff for the developers debugging the test suite.
Goal
I am applying for GSoC for this project under the mentorship of @carlos.fernandez and @canihavesomecoffee. I would love to take this up as my qualification task and submit a PR fixing this core comparison logic. Let me know if I have the green light to proceed with this!
- Dominant language
- Python
- Stars
- 30
- Forks
- 87
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 21
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from CCExtractor/sample-platform
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
CCExtractor/sample-platform#1194 · 1 comment ·
Maintainers usually reply within 6 days
-
Difficulty 3/5 1-2 days Newbie friendliness 84/100
CCExtractor/sample-platform#1192 · 1 comment ·
Maintainers usually reply within 6 days
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
CCExtractor/sample-platform#1082 ·
Maintainers usually reply within 6 days
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
CCExtractor/sample-platform#1062 · 2 comments ·
Maintainers usually reply within 6 days
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
CCExtractor/sample-platform#1057 ·
Maintainers usually reply within 6 days
All issues in CCExtractor/sample-platform
Similar issues
-
bug server
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sportsdataverse/sportsdataverse-py#641 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
googleapis/google-cloud-python#18532 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day