The largest persisted root type, and the carrier of the 3.3.0 identity fields (tenant/principal/template/correlation). Exercises a nested `PermissionPolicy` (itself holding the persisted untagged `PermissionRule`), the `#[serde(alias = "todos")]` `tasks` field, and the `#[serde(skip)]` `hook_engine` (safe: skipped in both directions).
(rng: &mut Rng)
| 496 | /// the `#[serde(alias = "todos")]` `tasks` field, and the `#[serde(skip)]` |
| 497 | /// `hook_engine` (safe: skipped in both directions). |
| 498 | fn gen_session_data(rng: &mut Rng) -> SessionData { |
| 499 | let state = match rng.below(5) { |
| 500 | 0 => SessionState::Unknown, |
| 501 | 1 => SessionState::Active, |
| 502 | 2 => SessionState::Paused, |
| 503 | 3 => SessionState::Completed, |
| 504 | _ => SessionState::Error, |
| 505 | }; |
| 506 | let config = SessionConfig { |
| 507 | name: rng.string(), |
| 508 | workspace: rng.string(), |
| 509 | system_prompt: rng.opt_string(), |
| 510 | permission_policy: if rng.boolean() { |
| 511 | Some(gen_permission_policy(rng)) |
| 512 | } else { |
| 513 | None |
| 514 | }, |
| 515 | ..Default::default() |
| 516 | }; |
| 517 | SessionData { |
| 518 | id: rng.string(), |
| 519 | config, |
| 520 | state, |
| 521 | messages: (0..rng.below(3)).map(|_| gen_message(rng)).collect(), |
| 522 | context_usage: ContextUsage::default(), |
| 523 | total_usage: gen_token_usage(rng), |
| 524 | total_cost: rng.f64_finite(), |
| 525 | model_name: rng.opt_string(), |
| 526 | cost_records: Vec::new(), |
| 527 | tool_names: rng.string_vec(3), |
| 528 | thinking_enabled: rng.boolean(), |
| 529 | thinking_budget: rng.opt_usize(), |
| 530 | created_at: rng.u64_small() as i64, |
| 531 | updated_at: rng.u64_small() as i64, |
| 532 | llm_config: None, |
| 533 | tasks: (0..rng.below(3)) |
| 534 | .map(|i| Task::new(format!("t{i}"), rng.string())) |
| 535 | .collect(), |
| 536 | parent_id: rng.opt_string(), |
| 537 | tenant_id: rng.opt_string(), |
| 538 | principal: rng.opt_string(), |
| 539 | agent_template_id: rng.opt_string(), |
| 540 | correlation_id: rng.opt_string(), |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | // ───────────────────────────────────────────────────────────────────── |
| 545 | // Property helpers. |
no test coverage detected