Skip to main content

drift

Function drift 

Source
pub fn drift(view: &IntentView, plan: &Plan) -> Vec<IntentFinding>
Expand description

The drift of one intent: the plan’s closure against the evidence’s verdict.

  • closed_work_contradicted — every milestone is DONE and a criterion’s recorded evidence says no: stale (a pass that is no longer current evidence at the checkout), or failing. A satisfied intent whose reality regresses lands here.
  • closed_work_unproven — every milestone is DONE and a criterion has never had evidence.
  • criterion_closed_unmet — every issue declaring it serves a criterion is DONE, and the criterion is not met, while the intent is still being executed.

And the stage against the verdict, once per intent (ADR 0107):

  • evidence_ahead_of_plan (EVIDENCE_AHEAD_OF_PLAN) — the verdict is satisfied while the stage is planned or executing: the evidence settles the intent before the plan closes it.
  • closed_work_not_satisfied (CLOSED_WORK_NOT_SATISFIED) — every milestone is DONE (the stage is verifying) and the verdict is unsatisfied or unknown, naming the criteria that hold it back.
use majordomus_cli::intent::{
    verdict, IntentCriterion, IntentEvidenceState, IntentStage, IntentView,
};
use majordomus_cli::intent_realization::drift;
let satisfaction = vec![IntentCriterion {
    id: "c".into(), criterion: "c".into(), evidence: "test".into(),
    reference: "t".into(), state: IntentEvidenceState::Failing, met: false,
    proof: None, reproduce: None }];
let view = IntentView {
    id: "x".into(), title: "X".into(), statement: String::new(), invariants: vec![],
    stage: IntentStage::Verifying, milestones: vec![], met: 0,
    verdict: verdict(&satisfaction), satisfaction,
    governance: vec![], non_goals: vec![], superseded_by: None, source: String::new(),
};
let found = drift(&view, &plan);
assert_eq!(found[0].code, "closed_work_contradicted");
assert_eq!(found[1].code, "closed_work_not_satisfied");