From aff2acfb753d6c7ca6ed87688160796bcccbcda5 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 19 Jun 2026 13:57:07 +0100 Subject: [PATCH] fix: align Photos crawler control contract --- CHANGELOG.md | 2 +- .../BuiltInCrawlApps+Photoscrawl.swift | 16 +++------------- Sources/CrawlBarSelfTest/SelfTestConfig.swift | 10 ++++++++-- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e07063f..a3fcd1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Changes -- Add Apple Photos as a coming-soon built-in crawler with read-only status, refresh, search, platform-native storage paths, and configurable library selection. +- Add Apple Photos as a coming-soon built-in crawler with read-only status, initialization, search, and platform-native storage paths. ### Fixes diff --git a/Sources/CrawlBarCore/BuiltInApps/BuiltInCrawlApps+Photoscrawl.swift b/Sources/CrawlBarCore/BuiltInApps/BuiltInCrawlApps+Photoscrawl.swift index 3cbff62..27f03ad 100644 --- a/Sources/CrawlBarCore/BuiltInApps/BuiltInCrawlApps+Photoscrawl.swift +++ b/Sources/CrawlBarCore/BuiltInApps/BuiltInCrawlApps+Photoscrawl.swift @@ -20,10 +20,10 @@ public extension BuiltInCrawlApps { commands: [ "metadata": ["metadata", "--json"], "status": ["status", "--json"], - "refresh": ["crawl", "--library", "{config:library_path}", "--json"], + "init": ["init", "--json"], "query": ["search", "--json", "--query"], ], - capabilities: [.status, .refresh, .search], + capabilities: [.status, .search], statusRequiresSecrets: false, privacy: .init( exportsSecrets: false, @@ -33,16 +33,6 @@ public extension BuiltInCrawlApps { "media-metadata", "location-observations", "local-model-observations", - ]), - configOptions: [ - .init( - id: "library_path", - label: "Photos library", - help: "Photos Library package read by refresh; photoscrawl expands a leading ~/ path.", - defaultValue: "~/Pictures/Photos Library.photoslibrary"), - ], - configSections: [ - .init(id: "photos", title: "Photos Library", optionIDs: ["library_path"]), - ]) + ])) .withSuggestion(Self.appSuggest("Photos", ["com.apple.Photos"])) } diff --git a/Sources/CrawlBarSelfTest/SelfTestConfig.swift b/Sources/CrawlBarSelfTest/SelfTestConfig.swift index 5ae6a1a..41d2803 100644 --- a/Sources/CrawlBarSelfTest/SelfTestConfig.swift +++ b/Sources/CrawlBarSelfTest/SelfTestConfig.swift @@ -17,8 +17,14 @@ extension CrawlBarSelfTest { try Self.expect(config.appConfig(for: BuiltInCrawlApps.photoscrawlID)?.enabled == false, "coming-soon Photos crawler normalizes disabled") try Self.expect(BuiltInCrawlApps.photoscrawl.availability == .comingSoon, "Photos crawler remains coming soon without an installer") try Self.expect( - BuiltInCrawlApps.photoscrawl.commands["refresh"] == ["crawl", "--library", "{config:library_path}", "--json"], - "Photos refresh uses the configured library path") + BuiltInCrawlApps.photoscrawl.commands["init"] == ["init", "--json"], + "Photos initialization matches the crawler control contract") + try Self.expect( + BuiltInCrawlApps.photoscrawl.commands["query"] == ["search", "--json", "--query"], + "Photos search matches the crawler control contract") + try Self.expect(BuiltInCrawlApps.photoscrawl.commands["refresh"] == nil, "Photos does not advertise an unsupported refresh action") + try Self.expect(BuiltInCrawlApps.photoscrawl.capabilities == [.status, .search], "Photos capabilities match CrawlBar-supported crawler metadata") + try Self.expect(BuiltInCrawlApps.photoscrawl.configOptions.isEmpty, "Photos does not expose settings absent from crawler metadata") let oldConfig = CrawlBarConfig( version: 1, apps: [CrawlBarAppConfig(id: BuiltInCrawlApps.wacliID, enabled: false, showInMenuBar: false)]).normalized()