fix(registry): mart multi-anno pubblicati flat (issue #463) - #464
Merged
Conversation
Il runner scrive i mart con years esplicite flat (data/mart/{dataset}/
{table}.parquet, no dir anno) ma il builder li pubblicava con path anno
inesistente (year=max) → consumer (registry_show, graph) puntavano a
file GCS assenti.
Fix (opzione A — builder):
- layout.py: load_manifest include years esplicite in mart_tables
(prima scartate, il builder non poteva distinguere multi-anno)
- builders.py: tabella con years → location flat (year=None); per-anno
resta year
- paths.py: mart_parquet_url con year=None → flat anche con
mart_layout='year' (era ValueError)
Verificato sull'evidenza reale (open-conto-annuale anzianita):
mart_trend → gs://.../anzianita/mart_trend.parquet (flat) ✅
mart_sintesi → gs://.../anzianita/2024/mart_sintesi.parquet (year) ✅
Test: +1 (mart multi-anno flat, per-anno year). 1346 verdi,
mypy+ruff puliti. Closes #463.
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.
Tipo
root fix — chiusura issue #463: i mart multi-anno venivano pubblicati nel registry con path anno inesistente.
Problema reale
Incoerenza tra 3 moduli:
mart/run.py:115,179): mart conyearsesplicite → scritti flat (data/mart/{dataset}/{table}.parquet, no dir anno)gs://.../{slug}/{table}.parquetregistry/builders.py:259): location conyear = max(manifest.years)→gs://.../{slug}/{year}/{table}.parquet— path inesistenteEvidenza in produzione: open-conto-annuale pubblica 14
mart_trendcon path.../anzianita/2024/mart_trend.parquetma il file reale sta in.../anzianita/mart_trend.parquet.Causa root
load_manifestscartava leyearsesplicite delle mart tables ({name, sql}soltanto) → il builder non poteva distinguere multi-anno da per-anno.Contratto riusato/sostituito
MartTableConfig.years(config model, già presente); il comportamento del runner (t.get("years")presenza = multi-anno).PathContract.mart_parquet_urlconyear=None→ flat (eraValueErrorconmart_layout="year").Implementazione (opzione A — builder)
toolkit/registry/layout.pyload_manifestincludeyearsesplicite inmart_tablestoolkit/registry/builders.pyyear=None); per-anno resta yeartoolkit/registry/paths.pymart_parquet_url(year=None)→ flat anche conmart_layout="year"tests/test_registry_builder.pyVerifica
mart_trend(years [2020..2024]) →gs://.../anzianita/mart_trend.parquetflat ✅mart_sintesi(no years) →gs://.../anzianita/2024/mart_sintesi.parquetyear ✅Rischio residuo
Follow-up
Nessuno obbligatorio. Closes #463.