phenotypic.sdk_.record_rejection#
- phenotypic.sdk_.record_rejection(record: Mapping[str, object], *, work_id: str, dataset: str, image_stem: str) str | None[source]#
Return why
recordcannot certify this image, orNone.The single implementation of per-image record validity, and the one reason this function exists rather than the check being written twice.
_cli_completion.valid_image_successand_run_state’s deep path both ask it, exactly as they both askedmarker_rejection()of the marker this record replaces. Splitting them again – after gate finding IMPL-F3 spent a whole increment merging them – would look like progress in a diff and be the same defect returning.A sentence rather than a bool, because the sentence lands in
ImageState.reasonand is what makes “which images are missing, and why?” answerable without re-running anything.Two clauses are worth reading twice:
The ``work_id`` comparison is skipped for a migrated record (U-10). A pre-markers tree never had a
work_idto match, so comparing it unconditionally would reject every migrated image. The relaxation is per-record and read throughrecord_provenance(), so an absent or unrecognized value keeps the fence.A record with no artifacts certifies nothing (CAN-23), and after the collapse that is one missing check away from being wrong. A Stage-2 worker writes
stages.stage2and no artifacts into this same file; before the collapse the two facts lived in two trees and mistaking one for the other was impossible.
- Parameters:
- Returns:
A sentence naming the first failed clause, or
Nonewhen the record may certify this image. Artifact contents are not checked here – that isfenced_artifact_path’s half, kept separate so a caller asking “is this record even about my image?” pays no I/O.- Return type:
str | None