pub struct Candidate {
pub candidate_id: CandidateId,
pub content: CandidateContent,
pub distilled_by: ProvenanceAuthor,
pub evidence: EvidenceSpan,
pub created_at: DateTime<Utc>,
}Expand description
A proposed change: immutable, versioned, content-addressed.
The address covers the content — the change itself — and nothing
else: two distillations of the same change converge on one id even
when different distillers read different evidence to reach it (the
design’s identity-is-integrity rule). Attribution is not identity, so
the distiller, the evidence span, and the learning instant travel
beside the address rather than inside it — the inverse of
MemoryRecord’s provenance-in-identity rule, deliberate: a memory
record answers “who claims this,” a candidate answers “what would
change.”
Immutable by construction: a changed candidate is a new id, and there is no in-place update anywhere in the pipeline.
Fields§
§candidate_id: CandidateIdThe content address (derive_candidate_id).
content: CandidateContentThe change, per kind.
distilled_by: ProvenanceAuthorThe distiller’s identity. Mandatory — journaled with creation
(CandidateCreated), because a candidate that cannot name its
distiller is indistinguishable from a config edit.
evidence: EvidenceSpanThe evidence span the distiller read. Absent from the wire when empty.
created_at: DateTime<Utc>When the distiller minted the candidate.
Implementations§
Source§impl Candidate
impl Candidate
Sourcepub fn new(
content: CandidateContent,
distilled_by: ProvenanceAuthor,
evidence: EvidenceSpan,
created_at: DateTime<Utc>,
) -> Result<Self>
pub fn new( content: CandidateContent, distilled_by: ProvenanceAuthor, evidence: EvidenceSpan, created_at: DateTime<Utc>, ) -> Result<Self>
Build a candidate, deriving its content address from content.
Sourcepub fn kind(&self) -> CandidateKind
pub fn kind(&self) -> CandidateKind
The candidate’s kind.
Sourcepub fn surface(&self) -> SurfaceKey
pub fn surface(&self) -> SurfaceKey
The production surface this candidate would change — the pointer
key: prompt:{name} / policy:{family} / memory:{scope} /
tool:{tool} / tool_contract:{tool} / model_settings:{name} /
memory_config:{name} / middleware:{name}. One surface admits
one active version, which is what makes promotion a pointer move
and rollback a re-pointing.
Sourcepub fn verify_address(&self) -> Result<(), LearnError>
pub fn verify_address(&self) -> Result<(), LearnError>
Re-derive the content address and compare: Ok when the candidate
is the one its id names. Identity is integrity — the gate runs
this before any promotion, so a tampered candidate fails closed at
the boundary, not after a pointer moved.
Sourcepub fn apply_to_manifest(&self, manifest: &mut RunManifest) -> Result<()>
pub fn apply_to_manifest(&self, manifest: &mut RunManifest) -> Result<()>
Apply a prompt candidate to a manifest: substitute the named
prompt’s pin with the candidate’s — the same digest
RunManifest::pin_prompt records, so the evaluation’s manifest
speaks the production surface’s content address. Every other kind
fails: a candidate applies only to the surface its kind declares.