The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(documents): cover spreadsheet import refusal before module load
Steven Enamakel379671ae27f5
diff --git a/crates/openhuman-core/src/modules/documents/memory_converter_tests.rs b/crates/openhuman-core/src/modules/documents/memory_converter_tests.rsindex 658a3d517e..c7bef63a53 100644--- a/crates/openhuman-core/src/modules/documents/memory_converter_tests.rs+++ b/crates/openhuman-core/src/modules/documents/memory_converter_tests.rs@@ -173,10 +173,10 @@ async fn a_pdf_converts_to_its_text() {#[cfg(feature = "documents")]#[tokio::test]-async fn the_released_module_extracts_all_memory_office_formats() {+async fn the_released_module_extracts_pdf_word_and_presentation_formats() {if crate::util::module_test_process::run(module_path!(),- "the_released_module_extracts_all_memory_office_formats",+ "the_released_module_extracts_pdf_word_and_presentation_formats",) {return;}@@ -194,10 +194,6 @@ async fn the_released_module_extracts_all_memory_office_formats() {RawDocument::new(pptx_saying("slide text")).with_filename("deck.pptx"),"slide text",),- (- RawDocument::new(xlsx_saying("cell text")).with_filename("sheet.xlsx"),- "cell text",- ),];for (raw, expected) in cases {let converted = converter(&config)@@ -211,9 +207,6 @@ async fn the_released_module_extracts_all_memory_office_formats() {);assert_eq!(converted.source_bytes, raw.bytes.len());assert_eq!(converted.metadata["converter"], "office");- if raw.display_name() == "sheet.xlsx" {- assert_eq!(converted.markdown, "Sheet1 | cell text");- }}let large_docx = "complete paragraph ".repeat(12_500);@@ -264,6 +257,22 @@ async fn the_released_module_extracts_all_memory_office_formats() {assert_eq!(converted.markdown.matches('\u{c}').count(), 299);}+#[cfg(feature = "documents")]+#[tokio::test]+async fn spreadsheet_memory_import_is_refused_before_loading_tinydocs() {+ let raw = RawDocument::new(xlsx_saying("cell text")).with_filename("sheet.xlsx");+ let mut config = Config::default();+ config.modules.enabled = false;++ let error = converter(&config).convert(&raw).await.unwrap_err();+ assert!(+ matches!(error, Error::Converter { ref converter, ref message }+ if converter == "tinydocs"+ && message == "spreadsheet imports are temporarily unavailable pending a safe TinyMemory release"),+ "spreadsheet import should fail with the temporary typed-unavailable reason, got {error}"+ );+}+#[tokio::test]async fn markdown_still_goes_through_the_native_converter() {let raw = RawDocument::new(b"# Note\n\nPlain markdown.".to_vec()).with_filename("note.md");@@ -392,6 +401,8 @@ fn the_office_converter_names_itself_and_claims_only_office_formats() {assert!(office.supports(DocumentFormat::Pdf));assert!(office.supports(DocumentFormat::Docx));assert!(office.supports(DocumentFormat::Pptx));+ // Keep XLSX in the TinyDocs route so a refusal cannot fall through to a+ // native converter while spreadsheet parsing is temporarily disabled.assert!(office.supports(DocumentFormat::Xlsx));assert!(!office.supports(DocumentFormat::Markdown));}diff --git a/crates/openhuman-core/src/modules/documents_tests.rs b/crates/openhuman-core/src/modules/documents_tests.rsindex dd8dd4dc17..70c868f414 100644--- a/crates/openhuman-core/src/modules/documents_tests.rs+++ b/crates/openhuman-core/src/modules/documents_tests.rs@@ -153,6 +153,25 @@ async fn a_disabled_host_reports_unavailable_without_starting_a_broker() {));}+#[tokio::test]+async fn spreadsheet_import_is_unavailable_before_loading_the_document_module() {+ let mut config = offline_config();+ config.modules.enabled = false;+ let expected = "spreadsheet imports are temporarily unavailable pending a safe TinyMemory release";++ assert!(matches!(+ super::convert_markdown(&config, tinydocs_bus::DocumentFormat::Xlsx, b"workbook")+ .await,+ Err(DocumentCallError::Unavailable(message)) if message == expected+ ));++ let extraction = tinydocs_bus::ExtractDocumentSpec::new(tinydocs_bus::DocumentFormat::Xlsx);+ assert!(matches!(+ super::extract_document(&config, b"workbook", &extraction).await,+ Err(DocumentCallError::Unavailable(message)) if message == expected+ ));+}+#[tokio::test]#[ignore = "needs a built TinyDocs module and its own process; set OPENHUMAN_MODULE_PATH"]async fn held_outputs_are_released_after_success_read_failure_and_cancellation() {