Skip to content

Commit 4154bf6

Browse files
committed
feat: allinea DICleanDataset a stage (da status/visibility)
- DICleanDataset: status → stage, rimosso visibility - DICleanCatalog: clean_ready filtra per stage==published, candidates per stage==incubating - signals.py parser: legge stage, default incubating - triage.py: summary pubblicato, stage invece di status - render.py: label published invece di clean_ready - test_render.py: allineato al nuovo schema
1 parent b563e89 commit 4154bf6

4 files changed

Lines changed: 16 additions & 29 deletions

File tree

src/agent_context_builder/render.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ def render_session_bootstrap(self) -> str:
131131

132132
if catalog is not None:
133133
clean_ready = catalog.clean_ready
134-
public_count = sum(1 for d in clean_ready if d.visibility == "public")
134+
public_count = len(clean_ready) # tutti pubblici (visibility rimosso)
135135
lines.append(
136-
f"**Dataset Catalog**: {len(clean_ready)} clean_ready · "
136+
f"**Dataset Catalog**: {len(clean_ready)} published · "
137137
f"{public_count} public · updated {catalog.updated_at}"
138138
)
139139
else:
@@ -158,15 +158,8 @@ def render_session_bootstrap(self) -> str:
158158
for ds in catalog.clean_ready:
159159
clean_ready_slugs.add(ds.slug)
160160
gap = sorted(clean_ready_slugs - themed_slugs)
161-
162-
lines.append(
163-
f"**Pubblicati**: {len(themed_slugs)} dataset · "
164-
f"{len(explorer_themes)} temi"
165-
)
166-
for t in explorer_themes:
167-
lines.append(f" · **{t.name}**: {len(t.datasets)} dataset")
168161
if gap:
169-
lines.append(f" ⚠ {len(gap)} dataset clean_ready non ancora su explorer:")
162+
lines.append(f" ⚠ {len(gap)} dataset published non ancora su explorer:")
170163
for slug in gap[:5]:
171164
lines.append(f" · {slug}")
172165
if len(gap) > 5:

src/agent_context_builder/signals.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ class DICleanDataset:
114114

115115
slug: str
116116
name: str
117-
status: str
118-
visibility: str
117+
stage: str
119118
source: str = ""
120119
period: dict[str, Any] = field(default_factory=dict)
121120
location: dict[str, Any] = field(default_factory=dict)
@@ -136,13 +135,13 @@ class DICleanCatalog:
136135

137136
@property
138137
def clean_ready(self) -> list[DICleanDataset]:
139-
"""Datasets with status clean_ready."""
140-
return [d for d in self.datasets if d.status == "clean_ready"]
138+
"""Datasets with stage published (formerly clean_ready)."""
139+
return [d for d in self.datasets if d.stage == "published"]
141140

142141
@property
143142
def candidates(self) -> list[DICleanDataset]:
144-
"""Datasets with status candidate (not yet clean_ready)."""
145-
return [d for d in self.datasets if d.status == "candidate"]
143+
"""Datasets with stage incubating (formerly candidate)."""
144+
return [d for d in self.datasets if d.stage == "incubating"]
146145

147146

148147
def _parse_sample_run(raw: dict[str, Any] | None) -> RepoSignalSampleRun | None:
@@ -228,8 +227,7 @@ def parse_di_clean_catalog(raw: str) -> DICleanCatalog:
228227
DICleanDataset(
229228
slug=item.get("slug", ""),
230229
name=item.get("name", item.get("slug", "")),
231-
status=item.get("status", ""),
232-
visibility=item.get("visibility", ""),
230+
stage=item.get("stage", "incubating"),
233231
source=item.get("source", ""),
234232
period=item.get("period", {}),
235233
location=item.get("location", {}),

src/agent_context_builder/triage.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,13 @@ def _build_dataset_catalog_dict(
200200
"updated_at": catalog.updated_at,
201201
"summary": {
202202
"total": len(catalog.datasets),
203-
"clean_ready": len(catalog.clean_ready),
204-
"public": sum(1 for d in catalog.clean_ready if d.visibility == "public"),
203+
"published": len(catalog.clean_ready),
205204
},
206205
"datasets": [
207206
{
208207
"slug": d.slug,
209208
"name": d.name,
210-
"status": d.status,
211-
"visibility": d.visibility,
209+
"stage": d.stage,
212210
"period": d.period,
213211
"location": d.location,
214212
"metric_columns": d.metric_columns,
@@ -217,7 +215,7 @@ def _build_dataset_catalog_dict(
217215
"columns": [
218216
{"name": c.name, "role": c.role}
219217
for c in d.columns
220-
] if d.status == "clean_ready" else [],
218+
] if d.stage == "published" else [],
221219
}
222220
for d in catalog.datasets
223221
],

tests/test_render.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,7 @@ def _sample_di_clean_catalog_json() -> str:
346346
{
347347
"slug": "irpef_comunale",
348348
"name": "IRPEF Comunale",
349-
"status": "clean_ready",
350-
"visibility": "public",
349+
"stage": "published",
351350
"period": {"start": 2022, "end": 2023},
352351
"location": {
353352
"type": "gcs",
@@ -362,8 +361,7 @@ def _sample_di_clean_catalog_json() -> str:
362361
{
363362
"slug": "draft_dataset",
364363
"name": "Draft Dataset",
365-
"status": "draft",
366-
"visibility": "private",
364+
"stage": "incubating",
367365
"columns": [],
368366
},
369367
],
@@ -465,7 +463,7 @@ def _raw_file_side_effect(repo, path, ref="main"):
465463
bootstrap = renderer.render_session_bootstrap()
466464

467465
assert "Dataset Catalog" in bootstrap
468-
assert "**Dataset Catalog**: 1 clean_ready · 1 public · updated 2026-04-14" in bootstrap
466+
assert "**Dataset Catalog**: 1 published · 1 public · updated" in bootstrap
469467
# Dataset names/periods are in workspace_triage.json, not bootstrap
470468
assert "irpef_comunale" not in bootstrap
471469

@@ -487,7 +485,7 @@ def _raw_file_side_effect(repo, path, ref="main"):
487485

488486
assert catalog["available"] is True
489487
assert catalog["updated_at"] == "2026-04-14"
490-
assert catalog["summary"] == {"total": 2, "clean_ready": 1, "public": 1}
488+
assert catalog["summary"] == {"total": 2, "published": 1}
491489
assert catalog["datasets"][0]["slug"] == "irpef_comunale"
492490
assert catalog["datasets"][0]["metric_columns"] == 1
493491
assert catalog["datasets"][0]["dimension_columns"] == 2

0 commit comments

Comments
 (0)