From 046f712d0cc721fb48b39fe87a1e6d0bcbea87f6 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Wed, 25 Nov 2026 14:41:54 -0800 Subject: [PATCH] Avoid failing the refresh when a single missing Miniflux entry returns HTTP error. --- .../Miniflux/MinifluxAccountDelegate.swift | 4 ++-- .../miniflux_entry_ids_missing_article.json | 4 ++++ .../MinifluxSyncRegressionTests.swift | 20 +++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 Modules/Account/Tests/AccountTests/JSON/miniflux_entry_ids_missing_article.json diff --git a/Modules/Account/Sources/Account/Miniflux/MinifluxAccountDelegate.swift b/Modules/Account/Sources/Account/Miniflux/MinifluxAccountDelegate.swift index 1627a395f..645a95c2e 100644 --- a/Modules/Account/Sources/Account/Miniflux/MinifluxAccountDelegate.swift +++ b/Modules/Account/Sources/Account/Miniflux/MinifluxAccountDelegate.swift @@ -910,12 +910,12 @@ private extension MinifluxAccountDelegate { serverDeletedArticleIDs.insert(String(entryID)) } } catch { - savedError = error Self.logger.error("Miniflux: Refresh missing articles error: \(error.localizedDescription)") - // An HTTP error is about this entry, so skip it. Anything else, such as no connection, would fail every remaining request. + // An HTTP error is about this entry, so skip it without failing the refresh. Anything else, such as no connection, would fail every remaining request. if case WebserviceError.httpError = error { continue } + savedError = error shouldStopFetching = true break } diff --git a/Modules/Account/Tests/AccountTests/JSON/miniflux_entry_ids_missing_article.json b/Modules/Account/Tests/AccountTests/JSON/miniflux_entry_ids_missing_article.json new file mode 100644 index 000000000..396563b4a --- /dev/null +++ b/Modules/Account/Tests/AccountTests/JSON/miniflux_entry_ids_missing_article.json @@ -0,0 +1,4 @@ +{ + "total": 1, + "entry_ids": [9001] +} diff --git a/Modules/Account/Tests/AccountTests/Miniflux/MinifluxSyncRegressionTests.swift b/Modules/Account/Tests/AccountTests/Miniflux/MinifluxSyncRegressionTests.swift index 1a98e1ea1..0b7a4ca94 100644 --- a/Modules/Account/Tests/AccountTests/Miniflux/MinifluxSyncRegressionTests.swift +++ b/Modules/Account/Tests/AccountTests/Miniflux/MinifluxSyncRegressionTests.swift @@ -99,6 +99,26 @@ import SyncDatabase XCTAssertGreaterThan(TestingURLProtocol.requestCount(forURLContaining: "changed_after"), 0) } + func testMissingArticleHTTPErrorDoesNotFailRefresh() async throws { + TestingURLProtocol.setResponse("/v1/version", file: "JSON/miniflux_version.json") + TestingURLProtocol.setResponse("/v1/categories", file: "JSON/miniflux_categories_initial.json") + TestingURLProtocol.setResponse("/v1/feeds", file: "JSON/miniflux_feeds_initial.json") + TestingURLProtocol.setResponse("/v1/entries?", file: "JSON/miniflux_entries_page1.json") + TestingURLProtocol.setResponse("/v1/entries/ids", file: "JSON/miniflux_entry_ids_missing_article.json") + TestingURLProtocol.setResponse(.init(statusCode: 500), forURLContaining: "/v1/entries/9001") + + let account = TestAccountManager.shared.createAccount(type: .miniflux) + defer { + TestAccountManager.shared.deleteAccount(account) + } + account.endpointURL = URL(string: "https://miniflux.test") + + try await account.refreshAll() + + XCTAssertGreaterThan(TestingURLProtocol.requestCount(forURLContaining: "/v1/entries/9001"), 0) + XCTAssertNotNil(account.lastRefreshCompletedDate) + } + func testInitialReconciliationPreservesPendingLocalStatus() async throws { let account = TestAccountManager.shared.createAccount(type: .miniflux) defer {