BattINFO Validation Contract#
This document defines the validation behavior that consumers can rely on for the supported BattINFO scope.
Supported Entry Points#
Core validation entry points:
battinfo validatebattinfo save ... --validatebattinfo publish ... --validatebattinfo index build --validatebattinfo.validate.validate_json(...)battinfo.validate.validate_record(...)battinfo.validate.validate_publication(...)
Policy Names#
BattINFO currently exposes these named validation policies:
defaultstrictpublisheringest
Policy semantics:
default: schema and references are errors; semantic issues default to warnings.strict: schema, references, and semantic issues are errors.publisher: publisher-oriented validation with semantic and publication checks as errors.ingest: schema remains strict while semantic and reference issues can remain warnings during staged cleanup.
Issue Model#
Structured validation issues expose these fields:
codeseveritypathmessagehintvalidatorresource_typeprofile
Severity values:
errorwarning
Representative issue codes:
schema.requiredschema.format.urischema.format.date_timeschema.profile_unknownreference.missingreference.type_mismatchsemantic.short_id_mismatchsemantic.temporal_order_invalidsemantic.electrode_holders_mixed(withsemantic.electrode_role_expected/semantic.electrode_polarity_expected: the electrode holders disagree with the cell configuration — see Electrodes)publication.distribution_url_invalidpublication.jsonld_parse_error
CLI Contract#
battinfo validate supports:
--format text--format json
Text mode:
emits a human-readable pass/fail summary
includes warnings when validation succeeds with non-fatal issues
JSON mode emits a machine-readable payload with:
okmodepolicyprofilesource_rootissue_counterror_countwarning_counterrorsissues
Example issue object:
{
"code": "schema.format.uri",
"severity": "error",
"path": "dataset.url",
"message": "'not-a-uri' is not a 'uri'",
"hint": null,
"validator": "format",
"resource_type": "dataset",
"profile": null
}
Exit codes:
0when no error-severity issues are present1when one or more error-severity issues are present
Current Boundary#
Reference validation is supported against repository-style source trees through source_root.
Every *_id field on a record body resolves to a record of one expected type, and a reference that resolves to the wrong type is reference.type_mismatch rather than a pass. The distinctions the checks enforce are meaningful ones: cell_instance.cell_spec_id must be a cell-spec, while cell_instance.working_electrode_id / counter_electrode_id must be electrode records — the built batch, not the electrode-spec design, which the cell spec already links.
This is sufficient for the core scope, but it is not yet the long-term scalability model for larger external registries or snapshots.