Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions internal/push/parity_golden_test.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,15 +23,16 @@ import (
// silent.

type parityCase struct {
Name string `json:"name"`
Category string `json:"category"`
CSV string `json:"csv"`
LabelColumn string `json:"label_column"`
Extension string `json:"extension"`
TargetSize []int `json:"target_size"`
CLIVerdict string `json:"cli_verdict"`
IngestorVerdict string `json:"ingestor_verdict"`
Note string `json:"note"`
Name string `json:"name"`
Category string `json:"category"`
CSV string `json:"csv"`
LabelColumn string `json:"label_column"`
Extension string `json:"extension"`
TargetSize []int `json:"target_size"`
Schema map[string]string `json:"schema"`
CLIVerdict string `json:"cli_verdict"`
IngestorVerdict string `json:"ingestor_verdict"`
Note string `json:"note"`
}

func TestValidatorParity(t *testing.T) {
Expand DownExpand Up@@ -85,9 +86,12 @@ func runGoPreflight(t *testing.T, c parityCase) string {
TargetSize: c.TargetSize,
}
if IsTabular(c.Category) {
// Mirror runDataIngest: the schema is inferred from the CSV before
// the preflight runs (the schema-columns preview needs it).
if sch, _, _, err := InferSchema(layout.LabelsCSV); err == nil {
// Mirror runDataIngest: an explicit schema (the --schema flow) wins,
// else it is inferred from the CSV — the golden generator derives the
// schema the same way, so dtype-sensitive verdicts stay comparable.
if len(c.Schema) > 0 {
spec.Schema = c.Schema
} else if sch, _, _, err := InferSchema(layout.LabelsCSV); err == nil {
spec.Schema = sch
}
}
Expand Down
26 changes: 26 additions & 0 deletions internal/push/testdata/parity/cases.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -281,6 +281,32 @@
"cli_verdict": "accept",
"ingestor_verdict": "accept",
"note": "pins the text-family dispatch"
},
{
"name": "tabular-varchar-numeric-labels",
"category": "tabular_classification",
"csv": "data.csv",
"label_column": "label",
"schema": {
"age": "INT",
"label": "VARCHAR(255)"
},
"cli_verdict": "accept",
"ingestor_verdict": "accept",
"note": "labels '1' vs '1.0' under a VARCHAR label: the ingestor pins dtype=str (no numeric collapse) so they are 2 classes \u2014 pins #152's schema-type-aware collapse (the earlier blanket collapse falsely rejected this)"
},
{
"name": "tabular-float-numeric-labels",
"category": "tabular_classification",
"csv": "data.csv",
"label_column": "label",
"schema": {
"age": "INT",
"label": "FLOAT"
},
"cli_verdict": "reject",
"ingestor_verdict": "reject",
"note": "same values under a FLOAT label: numeric read collapses 1/1.0 into one class \u2014 both sides reject (the counterpart pin)"
}
]
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
age,label
30,1
40,1.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
age,label
30,1
40,1.0
10 changes: 10 additions & 0 deletions internal/push/testdata/parity/goldens.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -90,6 +90,12 @@
],
"verdict": "reject"
},
"tabular-float-numeric-labels": {
"errors": [
"LabelDiversityValidator: Classification category requires at least 2 distinct label values in column 'label' (after whitespace stripping); this dataset has 1 distinct value(s): [np.float64(1.0)]. Raw value counts: {1.0: 2}. If this is intentional (e.g. you have a continuous target), pick a regression-family category like tabular_regression or time_series_forecasting instead."
],
"verdict": "reject"
},
"tabular-header-only": {
"errors": [
"IngestableRecordsValidator: No data rows found in CSV 'data.csv': the file has a header but no data rows (0 ingestable records). Add at least one data row and re-ingest.",
Expand DownExpand Up@@ -119,6 +125,10 @@
"errors": [],
"verdict": "accept"
},
"tabular-varchar-numeric-labels": {
"errors": [],
"verdict": "accept"
},
"text-clf-ok": {
"errors": [],
"verdict": "accept"
Expand Down
13 changes: 9 additions & 4 deletions scripts/gen-validator-goldens.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -72,10 +72,15 @@ def run_case(case):
if case.get("target_size"):
options["target_size"] = case["target_size"]
if case["category"].startswith(("tabular", "time_")):
try:
schema = infer_schema(csv_path)
except Exception:
schema = {}
# An explicit per-case schema (mirroring --schema) wins; else
# infer — BOTH sides of the harness use the same source so
# dtype-sensitive cases (label diversity) stay comparable.
schema = case.get("schema")
if not schema:
try:
schema = infer_schema(csv_path)
except Exception:
schema = {}
options["schema"] = schema
options["full_schema"] = schema

Expand Down
Loading