Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#1,079 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
python
Ambito
testing-qa

Direzione di ricerca

Inizia in mod_test/nicediff/diff.py, in particolare in get_html_diff intorno alle righe 123–217 e nella relativa generazione degli eventi. Leggi come l’attuale confronto riga per riga utilizza test_correct_lines e test_res_lines, quindi definisci il comportamento per gli intervalli di inserimento, eliminazione, sostituzione e uguaglianza. Il lavoro è completato quando i frame eliminati o spostati sono isolati, mentre le righe successive corrispondenti restano contrassegnate come superate e l’HTML diff è corretto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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!

Lingua principale
Python
Stelle
30
Fork
85
Merge medio
6g 8h
PR unite (30g)
22

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di CCExtractor/sample-platform

Tutte le issue di CCExtractor/sample-platform

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.