Added the BeyondFacts Lab as a prototype (#1175)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-08 19:49:46 +01:00
1 parent db8dae1cf6
commit b6c3fbb5db
90 files changed
+5936 -209

No files matched your search

+17 -1
View File
@@ -52,7 +52,7 @@ const SETTINGS_FILE_NAME: &str = "settings.json";
/// (`DataBackupContents`) includes. The runtime refuses a plan which names anything else, so that
/// whatever goes wrong in the app, a restore never replaces the logs, the downloaded tools, or the
/// data folder as a whole.
const REPLACEABLE_ELEMENTS: [(Location, &str); 10] = [
const REPLACEABLE_ELEMENTS: [(Location, &str); 11] = [
(Location::ConfigDirectory, SETTINGS_FILE_NAME),
(Location::DataDirectory, "workspaces/"),
(Location::DataDirectory, "tempChats/"),
@@ -60,6 +60,7 @@ const REPLACEABLE_ELEMENTS: [(Location, &str); 10] = [
(Location::DataDirectory, "plugins/"),
(Location::DataDirectory, "tokenizers/"),
(Location::DataDirectory, "visualBriefings/"),
(Location::DataDirectory, "beyondFactsLab/"),
(Location::DataDirectory, "databases/sqlite/"),
(Location::DataDirectory, "databases/vector_database/stores/"),
(Location::DataDirectory, "mediaTranscripts/"),
@@ -811,6 +812,21 @@ mod tests {
assert!(!test.exists(Location::DataDirectory, "mediaTranscripts/current"));
}
#[test]
fn a_restore_replaces_the_preparations_of_the_beyondfacts_lab() {
let test = TestFolders::new();
test.write_current_data();
test.write(Location::DataDirectory, "beyondFactsLab/current/project.json", "current preparation");
test.prepare_restore(r#"{ "location": "DATA_DIRECTORY", "relative_path": "beyondFactsLab/", "keep": [] }"#);
test.write(Location::DataDirectory, ".restore-pending/beyondFactsLab/restored/project.json", "restored preparation");
let outcome = apply_pending_restore_in(&test.folders(), &[]);
assert_eq!(outcome, Some(RestoreOutcome::Applied));
assert_eq!(test.read(Location::DataDirectory, "beyondFactsLab/restored/project.json").as_deref(), Some("restored preparation"));
assert!(!test.exists(Location::DataDirectory, "beyondFactsLab/current"));
}
#[test]
fn a_plan_which_names_another_element_is_refused() {
for relative_path in ["", "events.log", "databases/", "../data/", "pandoc/"] {