Skip to content

chore(scripts): rimuovi 8 script morti, sostituisci audit-imports con test di layering - #508

Merged
Gabrymi93 merged 3 commits into
mainfrom
chore/drop-dead-scripts
Oct 13, 2026
Merged

Gabrymi93 merged 3 commits into
mainfrom
chore/drop-dead-scripts

Conversation

@Gabrymi93

Copy link
Copy Markdown
Member

Sintesi

Rimuove 8 script morti da scripts/ e sostituisce l'unico con valore residuo (audit-imports.py) con un test di layering automatico.

Contesto collegato

Analisi di scripts/: 8 su 10 file non referenziati da CI/Makefile/docs, o referenziano moduli/file eliminati (core.parquet, core.artifacts, dataset.test.yml).

Cosa cambia

  • Refactor / performance

Rimossi

Script Perché morto
audit-imports.py referenziava moduli eliminati (core.parquet, core.artifacts)
audit_test_markers.py sovrapposto a conftest + marker pytest
find-contract.sh equivale a rg
generate-contracts-map.py sostituito da toolkit contract CLI + MCP
quality/check_tests.py + 2 list mai wired nel CI, sovrapposto alla allow-list di conftest
usage_matrix.py referenzia file morti (dataset.test.yml, clean_ispra_test.sql)

Tenuti

  • smoke_install_cli.py — usato dalla CI, testa il packaging (venv pulita + pip install . + CLI entry point)
  • pre-commit — citato da CONTRIBUTING, hook manuale senza framework pre-commit

Aggiunto

tests/test_layering_guard.py (46 righe, marker policy): test AST che fallisce se un modulo toolkit.core.* importa un layer superiore (clean/mart/raw/domain/scout/scaffold/plugins/cli/mcp). Sostituisce il guard manuale che PR #504 ha ripristinato.

Verifica

pytest tests/ -q          # 1317 passed, 0 falli, 23s
ruff check .              # All checks passed
  • Suite completa verde
  • Nuovo test passa (verifica che core non importa layer superiori)
  • Nessun modulo/funzione pubblica rimossa (solo script non referenziati)

Metriche PR

Tipo: cleanup reale (rimuove 8 file morti, aggiunge 1 test)
Problema reale: scripts/ con 8/10 file morti, incluso audit-imports che referenziava moduli eliminati
Sostituzione: test_layering_guard.py rende meccanico il guard anti-inversioni
Diff: −8 script + 1 test (46 righe)
Test aggiunti: 1 (layering guard, marker policy)
Rischio residuo: basso — nessun riferimento agli script rimossi
Follow-up obbligatorio: none

Checklist PR

  • Perimetro stretto: una PR = pulizia scripts/ + guard di layering
  • Issue collegata o motivazione dell'assenza (analisi scripts/)
  • Nessun modulo/funzione pubblica rimossa

- test_clean_duckdb_read: i 3 test ODS usano importorskip("odf") —
  fallivano in env senza extra pandas (CI resta verde grazie a [dev,pandas])
- test_smoke_scout: i 4 test con URL reali (finanze.gov.it, consip.it)
  dietro RUN_NETWORK_SMOoke=1 come RUN_S3_SMOKE — lo step smoke CI
  (-m smoke) li includeva nonostante il docstring dicesse il contrario,
  creando dipendenza da endpoint esterni; il test puro infer_years
  resta smoke e gira sempre
L'audit markers richiede un marker per ogni test nei file toccati;
i 4 test di rete avevano solo skipif senza marker. Stesso pattern di
test_s3_parquet_smoke: @pytest.mark.smoke + skipif env var — restano
collezionabili da -m smoke ma saltano senza RUN_NETWORK_SMOKE=1.
… test di layering

Rimossi (nessun riferimento da CI/Makefile/docs, o referenziano
moduli/file eliminati):

- audit-imports.py (referenziava core.parquet/core.artifacts, eliminati)
- audit_test_markers.py (sovrapposto a conftest + marker pytest)
- find-contract.sh (equivale a rg)
- generate-contracts-map.py (sostituito da toolkit contract CLI + MCP)
- quality/check_tests.py + legacy/strict lists (mai wired nel CI,
  sovrapposto alla allow-list di conftest)
- usage_matrix.py (referenzia file morti: dataset.test.yml, ecc.)

Tenuti: smoke_install_cli.py (usato dalla CI, testa il packaging)
e pre-commit (citato da CONTRIBUTING, hook manuale senza framework).

Sostituto del valore residuo di audit-imports: tests/test_layering_guard.py
— test pytest che fallisce se un modulo toolkit.core.* importa un layer
superiore. Rende meccanico il guard che PR #504 ha ripristinato a mano.

Suite: 1317 passed, 0 falli, 23s.
@Gabrymi93
Gabrymi93 force-pushed the chore/drop-dead-scripts branch from 3337747 to 6be1f39 Compare October 13, 2026 21:54
@Gabrymi93
Gabrymi93 merged commit ae74ca6 into main Oct 13, 2026
3 checks passed
@Gabrymi93
Gabrymi93 deleted the chore/drop-dead-scripts branch October 13, 2026 22:01
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