{"record":{"id":"121cf9e46bc0d021","repo":"Hmbown/CodeWhale","slug":"goal-read-fixture","errorCode":null,"errorMessage":"goal read fixture","messagePattern":"goal read fixture","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/subagent/tests.rs","lineNumber":8107,"sourceCode":"    let byte_warm = (0..3)\n        .map(|index| format!(\"bytes_{index}\"))\n        .collect::<Vec<_>>();\n    let mut byte_surface = SubAgentToolSurface::new(byte_catalog, &byte_warm);\n    let byte_names = model_tool_names(model_request_tools(&mut byte_surface));\n    assert!(!byte_names.contains(\"bytes_0\"));\n    assert!(byte_names.contains(\"bytes_1\") && byte_names.contains(\"bytes_2\"));\n}\n\n#[tokio::test]\nasync fn small_surface_successful_cached_use_touches_lru() {\n    let registry = small_surface_registry(FleetRole::Builder);\n    let mut catalog = registry.deferred_catalog_for_model(&FleetRole::Builder);\n    // Exercise the LRU with a deliberately deferred read-only fixture tool;\n    // production goal controls are eager and must not consume cache slots.\n    catalog\n        .iter_mut()\n        .find(|tool| tool.name == \"get_goal\")\n        .expect(\"goal read fixture\")\n        .defer_loading = Some(true);\n    let mut others = catalog\n        .iter()\n        .filter(|tool| tool.defer_loading == Some(true) && tool.name != \"get_goal\")\n        .map(|tool| tool.name.clone());\n    let mut warm = vec![\"get_goal\".to_string()];\n    warm.extend(others.by_ref().take(7));\n    let ninth = others.next().expect(\"ninth deferred child tool\");\n    let mut surface = SubAgentToolSurface::new(catalog, &warm);\n    model_request_tools(&mut surface);\n    execute_surface_tool(&registry, &mut surface, \"get_goal\", json!({}))\n        .await\n        .expect(\"cached read tool executes\");\n    surface.hydrate(&ninth).expect(\"ninth activation\");\n    assert!(model_tool_names(model_request_tools(&mut surface)).contains(\"get_goal\"));\n}\n\n#[test]","sourceCodeStart":8089,"sourceCodeEnd":8125,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/subagent/tests.rs#L8089-L8125","documentation":"A `.expect(\"goal read fixture\")` panic on Option: catalog.iter_mut().find(|tool| tool.name == \"get_goal\") returned None. The test needs a read-only goal tool fixture to exercise the deferred LRU, and the model catalog for FleetRole::Builder no longer contains a tool named get_goal.","triggerScenarios":"registry.deferred_catalog_for_model(&FleetRole::Builder) in crates/tui/src/tools/subagent/tests.rs:8107 yields a catalog without \"get_goal\" — the goal tool was renamed, made eager (defer_loading removed), or filtered out of the Builder role's catalog.","commonSituations":"Renaming get_goal in the goal tool module; changing FleetRole catalogs so Builder no longer exposes the read-only goal tool; a fixture setup change that excludes goal tools.","solutions":["Print/inspect the catalog names to confirm the tool's current name (e.g. debug-list all tool.name values).","Update the test fixture to the tool's new name, or restore \"get_goal\" to the Builder catalog.","Check whether the goal tool moved from deferred to eager; if it is now eager this test needs a different read-only fixture.","Verify deferred_catalog_for_model(&FleetRole::Builder) is the right role for this fixture."],"exampleFix":"// before\n.find(|tool| tool.name == \"get_goal\")\n.expect(\"goal read fixture\")\n// after\n.find(|tool| tool.name == \"get_goal\" || tool.name == \"goal_read\")\n.expect(\"goal read fixture (catalog: {:?})\")","handlingStrategy":"type-guard","validationCode":"let goal = catalog.iter_mut().find(|t| t.name == \"get_goal\");\nassert!(goal.is_some(), \"get_goal absent from Builder catalog: {:?}\", catalog.iter().map(|t| &t.name).collect::<Vec<_>>());","typeGuard":"fn find_tool<'a>(catalog: &'a mut [Tool], name: &str) -> Option<&'a mut Tool> {\n    catalog.iter_mut().find(|t| t.name == name)\n}","tryCatchPattern":"let Some(tool) = find_tool(&mut catalog, \"get_goal\") else {\n    panic!(\"goal read fixture missing; available: {:?}\", names(&catalog));\n};","preventionTips":["Reference fixture tools by exported constants, not inline string literals.","When renaming a tool, grep the test suite for its old name.","Assert on the catalog's name list in the panic message to speed diagnosis.","Keep at least one known read-only fixture per role's catalog."],"tags":["rust","test-panic","fixture-missing","catalog"],"backgroundTag":"entity-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T11:17:16.035Z"}