Skip to main content

Module error

Module error 

Source
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:

  1. the addition and its reason are recorded in that plan’s SUMMARY.md, and
  2. OBLIG-CPP-ERROR-TAXONOMY in contracts/contrastive-pair-protocol-v1.yaml is 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§

ContrastiveDataError
Every way the contrastive data protocol can refuse to proceed.