Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Feature Request] Improve comparison algorithm to handle frame offsets intelligently (GSoC Qualification)

Open
#1,079 0 comments 0 reactions 0 assignees View on GitHub

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:

  1. Identify the exact opcode (replace, delete, insert, equal) for block ranges.
  2. Gracefully handle offsets so the rest of the valid output remains marked as "Passed".
  3. 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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from CCExtractor/sample-platform

All issues in CCExtractor/sample-platform

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.