Skip to content

fix(sparql): fallback GET anche su timeout/rete + errore GET 5xx - #448

Merged
Gabrymi93 merged 1 commit into
mainfrom
fix/sparql-get-fallback-completo
Aug 4, 2026
Merged

fix(sparql): fallback GET anche su timeout/rete + errore GET 5xx#448
Gabrymi93 merged 1 commit into
mainfrom
fix/sparql-get-fallback-completo

Conversation

@Gabrymi93

Copy link
Copy Markdown
Member

Sintesi

Completa il fix SPARQL del POST 403 (#447) con i casi che il docstring prometteva ma il codice non copriva: timeout/errore di rete e GET fallback con 5xx.

Contesto collegato

Cosa cambia

  • Bug fix
  • Nuova funzionalità del motore
  • Nuovo plugin sorgente
  • Modifica contratto pubblico
  • Refactor / performance
  • Documentazione
  • Dipendenze o CI

Impatto su contratti pubblici

Nessuno — comportamento interno del fetch.

Dettaglio

Prima (gap del #447):

  • POST con errore di rete/timeout (post_status is None) → raise DownloadError("POST → unknown") senza provare il GET — nonostante il docstring dicesse "Se POST fallisce (403, timeout), prova GET"
  • GET fallback che restituisce 5xx → messaggio generico senza lo status

Dopo:

Verifica

pytest tests/test_sparql_plugin.py  # 26 passed (4 casi: 403→GET, timeout→GET, GET 5xx→err, POST 5xx→err)
mypy toolkit/plugins/sparql.py      # no issues
ruff check .                        # ok

Verifica end-to-end sul Senato reale: SparqlSource.fetch(dati.senato.it, ...) → POST fallisce → GET fallback → dati CSV restituiti.

Note

… GET 5xx

Completa il fix #447 (POST 403 → GET fallback) con i casi che il docstring
prometteva ma il codice non copriva:
- POST con errore di rete/timeout (post_status None) → prova GET fallback
- GET fallback che restituisce 5xx → DownloadError esplicito con status

Test: 4 casi coperti (403→GET, timeout→GET, GET 500→errore, POST 500→errore).
26/26 pass, mypy ok, ruff ok. End-to-end sul Senato reale: OK.
@Gabrymi93
Gabrymi93 merged commit 674cec9 into main Aug 4, 2026
3 checks passed
@Gabrymi93
Gabrymi93 deleted the fix/sparql-get-fallback-completo branch August 4, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant