v0.2.0: semaphore timeouts, error logging, dead code removal, parallel exports

Critical:
- Replace DISPATCH_TIME_FOREVER with 120s/30s timeouts in ObjC
- Log failed asset IDs and error messages in cmdExport/backupTree
- Show failed count in export summaries

Cleanup:
- Remove legacy Bridge methods (ExportAlbumPreviews, ExportAlbumOriginals, BackupAll)
- Remove legacy ObjC functions and C stub equivalents
- Remove photos.go delegates (package-level pass-throughs)
- Remove InterpretExportResult (only used by legacy methods)
- Clean up mockBridge fields (rename Fn2 -> Fn)
- Fix rc race condition in main_main.go (atomic.Int32)
- Remove unused variables (_ = grandTotal, _ = sig)

Design:
- Fix resolveAlbumID: ListAlbums first (cheap), then direct ID
- Unify Cloud type: Asset.Cloud string (was bool)
- Extract shared export logic into exportAssets/exportOne
- Add worker pool for parallel exports (3 workers when assets >= 4)
- Fix backupTree progress bar counter and directory prefix

Robustness:
- Add nil checks for stringWithUTF8String: in ObjC
- Log directory creation errors in ensure_directory (ObjC)

Quality:
- Add go vet and -race flag to Makefile test target
- Add ADR for performSelector cloudIdentifier decision
- Add sync comments between Go/ObjC sanitizePathComponent
- Add package-level doc comment
- Add tests: partial failure, skipped album, album-not-found message
This commit is contained in:
Ein Anderssono
2026-06-11 21:12:47 +02:00
parent b460c68641
commit 85eaa3ea37
14 changed files with 274 additions and 651 deletions
+1 -27
View File
@@ -13,9 +13,6 @@ static int stub_access_rc = 0;
static const char *stub_albums_json = "{\"albums\":[]}";
static const char *stub_assets_json = "{\"assets\":[]}";
static const char *stub_tree_json = "{\"collections\":[]}";
static int stub_export_rc = 0;
static int stub_export_originals_rc = 0;
static int stub_backup_all_rc = 0;
static int stub_albums_null = 0;
static int stub_assets_null = 0;
static int stub_tree_null = 0;
@@ -32,9 +29,6 @@ void photos_test_set_access(int rc) { stub_access_rc = rc; }
void photos_test_set_albums(const char *json) { stub_albums_json = json; stub_albums_null = 0; }
void photos_test_set_assets(const char *json) { stub_assets_json = json; stub_assets_null = 0; }
void photos_test_set_tree(const char *json) { stub_tree_json = json; stub_tree_null = 0; }
void photos_test_set_export_rc(int rc) { stub_export_rc = rc; }
void photos_test_set_export_originals_rc(int rc) { stub_export_originals_rc = rc; }
void photos_test_set_backup_all_rc(int rc) { stub_backup_all_rc = rc; }
void photos_test_set_albums_null(void) { stub_albums_null = 1; }
void photos_test_set_assets_null(void) { stub_assets_null = 1; }
void photos_test_set_tree_null(void) { stub_tree_null = 1; }
@@ -72,26 +66,6 @@ char *photos_list_tree_json(void) {
return alloc_json(stub_tree_json);
}
int photos_export_album_previews(const char *album_id, const char *output_dir, int target_size) {
(void)album_id;
(void)output_dir;
(void)target_size;
return stub_export_rc;
}
int photos_export_album_originals(const char *album_id, const char *output_dir) {
(void)album_id;
(void)output_dir;
return stub_export_originals_rc;
}
int photos_backup_all(const char *output_dir, int target_size, int originals) {
(void)output_dir;
(void)target_size;
(void)originals;
return stub_backup_all_rc;
}
void photos_free_string(char *value) {
if (value) free(value);
}
@@ -106,4 +80,4 @@ void photos_test_set_export_preview_json(const char *json) {
void photos_test_set_export_original_json(const char *json) {
stub_export_original_json = json;
}
}