Repository navigation
fix(feed): import valid OPML feeds when some links are invalid - #291
Merged
Merged
Conversation
A single link failing URL validation (typically a dead domain whose DNS lookup fails) made POST /api/feeds/batch return 400 "invalid link", so nothing was imported and the user could not tell which link or why. - Batch create validates each link independently. Invalid links are skipped and reported in `errors` as `invalid URL <link>: <reason>`, next to the existing `duplicate feed: <link>`; the rest is imported. Only a malformed body (including items missing required fields) is 400. - Validation runs with bounded concurrency and a 20s overall budget, so many stalled DNS lookups cannot push the request past the server write timeout while the valid feeds still get committed. - Create, update and validate report the reason too: `invalid URL: <reason>`. - The OPML import dialog ends on a result view with a status icon, the counts and every failed link with its reason, instead of toasts. It cannot be closed while the import is in flight. BREAKING CHANGE: POST /api/feeds/batch no longer returns 400 when some links are invalid; it returns 200 and lists them in `errors`. Closes #261 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
One dead link in an OPML file (usually a domain whose DNS lookup fails) made
POST /api/feeds/batchreject the whole import with400 "invalid link". Now every link is checked on its own, so the valid feeds get imported and each failed link is listed with the reason.invalid URL: <reason>.httpc.ValidateRequestURLno longer adds its owninvalid url:prefix, so the reason is not repeated.docs/api-conventions.mdexplains why the batch endpoint imports what it can and reports the rest.Evidence
Before: importing an OPML that contained
https://blog.long-gone.invalid/feed.xml→400 {"error":"invalid link"}, 0 feeds imported.After: the same import →
200, the valid feeds are imported, and the dialog lists:New tests in
feed_batch_test.go, all offline (TEST-NET IPs and.invaliddomains):Also ran
-raceand a no-network run (unshare -rn).Stalled DNS, tested with a resolver that never answers (130 stalled domains + 1 valid feed):
200in 20s,created=1 failed=130, every stalled link reported asi/o timeout.Checked in the browser (light and dark mode):
./scripts.sh test-backendand./scripts.sh test-frontendpass.Merge Danger
Door: two-way
Revert restores the old behavior. Nothing is migrated or stored differently.
Blast Radius: API
POST /api/feeds/batchused to get400when any link was invalid. Now they get200and the invalid links are inerrors.group_id,nameorlinkused to slip through. Now the whole request returns 400.invalid link/invalid urltoinvalid URL: <reason>.Closes #261 (same root cause as #285).
🤖 Generated with Claude Code