fix: reject lossy metadata column collisions in Prodigy CSV export
AF
9h ago+84+84+01234567890123456789-3-3-0123456789
Summary
Prodigy CSV export lowercases metadata keys after validation. This creates collisions that the existing case-sensitive id check does not catch:
IDbecomes a secondidcolumn, and the metadata value is replaced with the element ID.Textcollides with the element text and raises an incidentalTypeError.Tagandtagin one record collapse to one field, silently discarding a value.
Validate each record's normalized CSV column names before constructing its row. Raise a descriptive ValueError with the metadata index for reserved names, and reject two keys that normalize to the same name. Matching column names in different records remain valid. The JSON export path remains case-sensitive.
Validation
- The 12 new cases produce 9 failures and 3 passing controls on the original source.
- Covers reserved names in several cases, duplicate normalized keys in either order, unchanged input metadata, shared column names across records, JSON metadata and metadata-free CSV export.
- A combined fork validation branch runs both changes' regressions against the pinned original source: 27 failures, 12 passing controls. With the final source restored, the regressions plus the existing Prodigy, CSV and TSV suites report 192 passed on Python 3.12.
- Repository-configured Ruff check, format check and source-integrity checks pass.
- Validation run, exact commands and JUnit artifacts.
Checklist
- User-facing conventional-commit title.
- Maintainer: please apply the
bugcategory label.