CCExtractor / CCExtractor/sample-platform

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

Abierto
#1,079 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
30
Forks
85
Merge medio
6 d 21 h
PR fusionados (30 d)
12

Descripción

### 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](cci:7://file:///c:/Users/amn2k/Desktop/CCExtractor/GSoC-sample-platform/mod_test/nicediff/diff.py:0:0-0:0) (around line 144 to 157 in [get_html_diff](cci:1://file:///c:/Users/amn2k/Desktop/CCExtractor/GSoC-sample-platform/mod_test/nicediff/diff.py:123:0-217:15)), 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](cci:7://file:///c:/Users/amn2k/Desktop/CCExtractor/GSoC-sample-platform/mod_test/nicediff/diff.py:0:0-0:0) (specifically [get_html_diff](cci:1://file:///c:/Users/amn2k/Desktop/CCExtractor/GSoC-sample-platform/mod_test/nicediff/diff.py:123:0-217:15) 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!

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en mod_test/nicediff/diff.py, especialmente en get_html_diff alrededor de las líneas 123–217 y en su generación de eventos. Lee cómo la comparación actual línea por línea utiliza test_correct_lines y test_res_lines, y después define el comportamiento para los rangos de inserción, eliminación, reemplazo e igualdad. Se considera terminado cuando los frames descartados o desplazados quedan aislados, mientras que las líneas posteriores coincidentes siguen marcadas como superadas y el diff HTML es correcto.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
testing-qa
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.