-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Summary
During the config-rs migration (PR #469), several pre-existing issues were identified that are out of scope for that PR but should be addressed.
Issues Found
1. main.rs unwraps config loading (potential panic)
Location: zainod/src/main.rs:35
match start_indexer(load_config(&config_path).unwrap()).await {Config failures should be handled gracefully with proper error messages instead of panicking.
Suggested fix: Replace .unwrap() with proper error handling that logs the config error and exits gracefully.
2. ZainodConfig::default() unwraps HOME-derived path (potential panic)
Location: zainod/src/config.rs:183
zebra_db_path: default_zebra_db_path().unwrap(),If HOME environment variable is not set, this will panic when creating default config.
Suggested fix: Either:
- Use a fallback path (like
/tmp/zebra/.cache) - Make
zebra_db_pathanOption<PathBuf>with runtime validation - Align with
default_zaino_db_path()which already has a/tmpfallback
3. Documentation mentions no_db option that doesn't exist
Location: docs/use_cases.md:19
Unless the
no_dboption is set to true in the config file...
The code actually uses DatabaseSize::Gb(0) to indicate no database (zaino-state/src/local_cache/non_finalised_state.rs:375-378):
let no_db = match self.config.storage.database.size {
zaino_common::DatabaseSize::Gb(0) => true,
zaino_common::DatabaseSize::Gb(_) => false,
};Suggested fix: Update documentation to reflect actual configuration method, e.g.:
Set
storage.database.size = { gb = 0 }to disable local database caching...