Expand description
Typed failure surface shared by every boundary in this crate. The typed failure surface for the contrastive data protocol.
§Contract: contrastive-pair-protocol-v1.yaml (OBLIG-CPP-ERROR-TAXONOMY)
Every fallible path in this crate returns ContrastiveDataError. There is no
unwrap(), no panic! on caller input, and no sentinel return value: a caller that
feeds this crate untrusted bytes from object storage must be able to distinguish
“malformed row 12 of train” from “this dataset does not have enough examples left in
class 2 to supply 64 shots”, and both from an internal arithmetic overflow.
Messages follow the data_tweeteval.rs house style — they name the split, the index,
and BOTH the expected and the observed value, because a message that says only
“validation failed” turns a five-second fix into a bisect.
§This enum is an exhaustive INITIAL design, not a permanently closed one
Every variant below was derived up-front from DATA-02’s failure classes plus the degenerate-case, version-mismatch, arithmetic, and untrusted-input classes that plans 02-05, 02-07 and 02-09 need, so that a downstream plan does not have to widen the error surface mid-wave and force its siblings to rebase. That is a design review, not a freeze.
A downstream plan MAY add a variant. When it does, two things are mandatory:
- the addition and its reason are recorded in that plan’s
SUMMARY.md, and OBLIG-CPP-ERROR-TAXONOMYincontracts/contrastive-pair-protocol-v1.yamlis extended to list it.
The enum is #[non_exhaustive] so that adding a variant is not a breaking change for
an external consumer, and so that a match in apr-cli cannot silently go stale.
Enums§
- Contrastive
Data Error - Every way the contrastive data protocol can refuse to proceed.