chore: migrate duckdb.connect() → lab_connectors.duckdb.safe_connect()#226
Merged
Conversation
Member
Author
|
mergiare prima dataciviclab/toolkit#240 |
Gabrymi93
commented
May 12, 2026
Member
Author
Gabrymi93
left a comment
There was a problem hiding this comment.
Review: chore: migrate duckdb.connect() → lab_connectors.duckdb.safe_connect() #226
Modalità: lite
Verdict: REQUEST CHANGES (fix-required)
Tipo: fix-required — direzione buona ma bug critico
Blocker
1. import requests rimosso ma requests ancora usato nel codice
- Impatto:
NameError: name 'requests' is not defineda runtime in_download_public_to_temp()e_copy_gcs_to_temp(). - Evidenza:
mcp/so_server_core.py— il diff rimuoveimport requests(linea 23) ma:- Linea 400:
response = requests.get(_public_url(uri), timeout=120, stream=True) - Linea 416:
except requests.RequestException:
- Linea 400:
- Fix: ripristinare
import requestsnella sezione import. Non fa parte del perimetro della PR (che è duckdb → safe_connect) e la rimozione è accidentale.
Warning
2. Rimozione import requests fuori scope
- La rimozione di
import requestsnon è dichiarata né nel titolo né nella descrizione della PR. Il perimetro dichiarato è "migrate duckdb.connect() → safe_connect()". Modifiche collaterali non dichiarate vanno evitate o documentate.
Gate passati (tutto il resto è OK)
- Root-cause gate: la migrazione a
safe_connectè corretta e allinea al contratto condivisolab_connectors[duckdb]@v0.4.0 - 7 call site in
so_server_core.pymigrati correttamente (tutti contry/finally→with safe_connect()) - 1 call site in
build_catalog_inventory.pymigrato correttamente, fissa connection leak (mancavatry/finally) -
import duckdbresiduo giustificato (type annotationduckdb.DuckDBPyConnection) -
requirements.txt: bump alab-connectors[duckdb]@v0.4.0corretto e coerente -
requirements.txt: toolkit commit bump aa06005c(merge di toolkit #240 duckdb migration) corretto - −22 righe nette, riduzione complessità
- Test non-MCP (84) passano invariati
- Unico
duckdb.connect()residuo è intests/test_so_mcp.py(test, fuori scope)
Rischi residui (post-fix)
Nessuno. Una volta ripristinato import requests, la PR è pulita.
Verdetto
La migrazione duckdb → safe_connect è corretta in tutti gli 8 call site. C'è un errore accidentale (rimozione import requests ancora necessario) che va corretto prima del merge.
Next owner: author
Next action: ripristinare import requests in mcp/so_server_core.py, poi merge
Member
Author
|
fixato in 4fa3783 mentre facevo fare review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migra 8 call site in 2 file da
duckdb.connect()+try/finally+con.close()awith safe_connect() as con:.build_catalog_inventory.py(mancava try/finally)