diff --git a/src/generated_scene/analyzer.rs b/src/generated_scene/analyzer.rs index 3c5dc14..32257c9 100644 --- a/src/generated_scene/analyzer.rs +++ b/src/generated_scene/analyzer.rs @@ -151,54 +151,7 @@ pub fn analyze_scene_source_with_hint( /// /// Requires meta tags to be present. For new code, use `analyze_scene_source_with_hint`. pub fn analyze_scene_source(source_dir: &Path) -> Result { - let index_path = source_dir.join("index.html"); - let html = fs::read_to_string(&index_path).map_err(|err| { - AnalyzeSceneError::new(format!( - "failed to read scene source {}: {err}", - index_path.display() - )) - })?; - - let scene_kind = meta_content(&html, "sgclaw-scene-kind"); - let tool_kind = meta_content(&html, "sgclaw-tool-kind"); - if scene_kind.as_deref() != Some("report_collection") - || tool_kind.as_deref() != Some("browser_script") - { - return Err(AnalyzeSceneError::new( - "generated scene v1 supports report/collection browser_script only", - )); - } - - let target_url = meta_content(&html, "sgclaw-target-url"); - let expected_domain = meta_content(&html, "sgclaw-expected-domain"); - let entry_script = meta_content(&html, "sgclaw-entry-script"); - if target_url.as_deref().unwrap_or_default().trim().is_empty() - || expected_domain - .as_deref() - .unwrap_or_default() - .trim() - .is_empty() - || entry_script - .as_deref() - .unwrap_or_default() - .trim() - .is_empty() - { - return Err(AnalyzeSceneError::new( - "generated scene source must declare target url, expected domain, and entry script", - )); - } - - Ok(SceneSourceAnalysis { - scene_kind: SceneKind::ReportCollection, - tool_kind: ToolKind::BrowserScript, - bootstrap: BootstrapAnalysis { - target_url, - expected_domain, - }, - collection_entry_script: entry_script, - source_dir: source_dir.to_path_buf(), - }) + analyze_scene_source_with_hint(source_dir, None) } fn meta_content(html: &str, name: &str) -> Option { diff --git a/tests/scene_generator_test.rs b/tests/scene_generator_test.rs index 18ae063..5f2ec05 100644 --- a/tests/scene_generator_test.rs +++ b/tests/scene_generator_test.rs @@ -74,13 +74,14 @@ fn generator_writes_registration_ready_package_with_scene_toml() { } #[test] -fn generator_rejects_non_report_source_with_explicit_reason() { - let err = - analyze_scene_source(Path::new("tests/fixtures/generated_scene/non_report")).unwrap_err(); +fn analyzer_defaults_to_report_collection_when_no_scene_kind_meta() { + // non_report fixture has no scene-kind meta tag - should default to ReportCollection + let analysis = + analyze_scene_source(Path::new("tests/fixtures/generated_scene/non_report")).unwrap(); - assert!(err - .to_string() - .contains("report/collection browser_script only")); + // With the new delegation, it defaults to ReportCollection instead of rejecting + assert_eq!(analysis.scene_kind, SceneKind::ReportCollection); + assert_eq!(analysis.tool_kind, ToolKind::BrowserScript); } fn temp_workspace(prefix: &str) -> PathBuf {