| 456 | } |
| 457 | |
| 458 | fn resolve_with_session( |
| 459 | repo: &Repository, |
| 460 | args: &IncrementalArgs, |
| 461 | session_context: Option<&str>, |
| 462 | ) -> CliResult<IncrementalReport> { |
| 463 | if args.from.is_some() || args.to.is_some() { |
| 464 | return super::view_comparison::resolve(repo, args); |
| 465 | } |
| 466 | if [&args.turn, &args.intent, &args.change, &args.view] |
| 467 | .iter() |
| 468 | .filter(|s| s.is_some()) |
| 469 | .count() |
| 470 | > 1 |
| 471 | { |
| 472 | return Err(invalid( |
| 473 | "--turn, --intent, --change and --view are mutually exclusive", |
| 474 | )); |
| 475 | } |
| 476 | if args.view.is_some() { |
| 477 | return super::view_snapshot::resolve(repo, args); |
| 478 | } |
| 479 | let store = runtime_store(repo)?; |
| 480 | let mut selection = Selection { |
| 481 | kind: String::new(), |
| 482 | value: None, |
| 483 | reason: String::new(), |
| 484 | }; |
| 485 | let mut selected_intent = args |
| 486 | .intent |
| 487 | .as_deref() |
| 488 | .map(|id| intent_key(repo, id)) |
| 489 | .transpose()?; |
| 490 | if args.turn.is_none() && args.change.is_none() && selected_intent.is_none() { |
| 491 | if let Some(session) = session_context { |
| 492 | selected_intent = current_plan(repo, store.as_ref(), session)?; |
| 493 | if selected_intent.is_some() { |
| 494 | selection.reason = |
| 495 | format!("Unambiguous governing declaration for explicit session {session}"); |
| 496 | } |
| 497 | } |
| 498 | if selected_intent.is_none() && session_context.is_none() { |
| 499 | selected_intent = manifest_plan(repo)?; |
| 500 | if selected_intent.is_some() { |
| 501 | selection.reason = "Unambiguous governing declaration in active lifecycle manifest for this source root/view".into(); |
| 502 | } |
| 503 | } |
| 504 | } |
| 505 | let mut roots = BTreeMap::<String, Hash>::new(); |
| 506 | let mut turns = BTreeMap::<(String, u32), TurnInspection>::new(); |
| 507 | let mut related_intents = BTreeSet::new(); |
| 508 | let mut warnings = vec![ |
| 509 | "Inspection only: supplied criterion assessments are review observations, not independent signed approval or automatic acceptance/test-passing verdicts.".into(), |
| 510 | "Current intent documents are not authenticated historical snapshots; signature verification is not performed.".into(), |
| 511 | "Working-copy bytes are not part of the recorded selection. Active turns are pending; working-copy status is not inferred.".into(), |
| 512 | ]; |
| 513 | let ledgers = if let Some(input) = &args.turn { |
| 514 | let (session, _) = parse_turn(input)?; |
| 515 | repo.get_session_ledger(session) |