Skip to content

Commit 2fe252e

Browse files
chore(detect): drop unused build_validation_skeleton helper
build_validation_skeleton has been dead since chunked validation moved skeleton construction inline into chunked_validate_row. No internal callers remain; its tests go with it. Made-with: Cursor
1 parent 841899f commit 2fe252e

2 files changed

Lines changed: 0 additions & 69 deletions

File tree

src/anonymizer/engine/detection/custom_columns.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
COL_VALIDATED_SEED_ENTITIES,
3535
COL_VALIDATION_CANDIDATES,
3636
COL_VALIDATION_DECISIONS,
37-
COL_VALIDATION_SKELETON,
3837
)
3938
from anonymizer.engine.detection.postprocess import (
4039
EntitySpan,
@@ -52,8 +51,6 @@
5251
ValidatedDecisionSchema,
5352
ValidatedDecisionsSchema,
5453
ValidationCandidatesSchema,
55-
ValidationSkeletonDecisionSchema,
56-
ValidationSkeletonSchema,
5754
)
5855

5956

@@ -135,19 +132,6 @@ def prepare_validation_inputs(row: dict[str, Any]) -> dict[str, Any]:
135132
return row
136133

137134

138-
@custom_column_generator(required_columns=[COL_SEED_VALIDATION_CANDIDATES])
139-
def build_validation_skeleton(row: dict[str, Any]) -> dict[str, Any]:
140-
"""Pre-populate the decisions template with candidate IDs so the LLM only fills in decision/reason."""
141-
candidates = ValidationCandidatesSchema.from_raw(row.get(COL_SEED_VALIDATION_CANDIDATES, {}))
142-
skeleton = ValidationSkeletonSchema(
143-
decisions=[
144-
ValidationSkeletonDecisionSchema(id=c.id, value=c.value, label=c.label) for c in candidates.candidates
145-
]
146-
)
147-
row[COL_VALIDATION_SKELETON] = skeleton.model_dump(mode="json")
148-
return row
149-
150-
151135
@custom_column_generator(
152136
required_columns=[COL_VALIDATION_DECISIONS, COL_SEED_VALIDATION_CANDIDATES],
153137
)

tests/engine/test_detection_custom_columns.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@
2626
COL_VALIDATED_SEED_ENTITIES,
2727
COL_VALIDATION_CANDIDATES,
2828
COL_VALIDATION_DECISIONS,
29-
COL_VALIDATION_SKELETON,
3029
)
3130
from anonymizer.engine.detection.custom_columns import (
3231
_parse_entity_spans,
3332
apply_validation_and_finalize,
34-
build_validation_skeleton,
3533
enrich_validation_decisions,
3634
merge_and_build_candidates,
3735
parse_detected_entities,
@@ -144,57 +142,6 @@ def test_enrich_validation_decisions_ignores_non_dict_validation_payload() -> No
144142
assert result[COL_VALIDATED_ENTITIES] == {"decisions": []}
145143

146144

147-
def test_build_validation_skeleton_produces_null_decisions() -> None:
148-
row: dict[str, Any] = {
149-
COL_SEED_VALIDATION_CANDIDATES: {
150-
"candidates": [
151-
{
152-
"id": "first_name_0_5",
153-
"value": "Alice",
154-
"label": "first_name",
155-
"context_before": "",
156-
"context_after": " works",
157-
},
158-
{
159-
"id": "org_15_19",
160-
"value": "Acme",
161-
"label": "organization",
162-
"context_before": "at ",
163-
"context_after": "",
164-
},
165-
]
166-
},
167-
}
168-
result = build_validation_skeleton(row)
169-
skeleton = result[COL_VALIDATION_SKELETON]
170-
assert len(skeleton["decisions"]) == 2
171-
assert skeleton["decisions"][0]["id"] == "first_name_0_5"
172-
assert skeleton["decisions"][0]["value"] == "Alice"
173-
assert skeleton["decisions"][0]["label"] == "first_name"
174-
assert skeleton["decisions"][0]["decision"] is None
175-
assert skeleton["decisions"][0]["proposed_label"] is None
176-
assert skeleton["decisions"][1]["id"] == "org_15_19"
177-
178-
179-
def test_build_validation_skeleton_handles_candidates_with_missing_keys() -> None:
180-
row: dict[str, Any] = {
181-
COL_SEED_VALIDATION_CANDIDATES: {
182-
"candidates": [
183-
{"id": "x"},
184-
{"value": "Alice"},
185-
{},
186-
]
187-
},
188-
}
189-
result = build_validation_skeleton(row)
190-
skeleton = result[COL_VALIDATION_SKELETON]
191-
assert len(skeleton["decisions"]) == 3
192-
assert skeleton["decisions"][0]["id"] == "x"
193-
assert skeleton["decisions"][0]["value"] == ""
194-
assert skeleton["decisions"][1]["id"] == ""
195-
assert skeleton["decisions"][1]["value"] == "Alice"
196-
197-
198145
def test_apply_validation_and_finalize_handles_malformed_merged_entities() -> None:
199146
row: dict[str, Any] = {
200147
COL_TEXT: "Alice works at Acme.",

0 commit comments

Comments
 (0)