Repository navigation
Keep saving papers when an unmigrated Bucket cannot be set up - #1160
Merged
Merged
Conversation
Some accounts approve saved-papers Bucket access but Hugging Face refuses to create or write the Bucket. Save then returned 400 and /saved kept offering the same approval, because the listing silently fell back to the database bookmarks. Until an account has migrated, save and unsave now write the database bookmarks (the source listings already read) and succeed. The listing returns the Bucket error so /saved explains the failure, and the underlying Hub error is logged. Migrated accounts still fail on Bucket errors so the Bucket and the database mirror cannot diverge. Fixes huggingface/paperswithcode-feedback#58 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.
Fixes huggingface/paperswithcode-feedback#58.
Problem
Some accounts approve saved-papers Bucket access, but Hugging Face refuses to create or write
<user>/pwc-saved-papers(the reporter gets a non-HTTP write failure; production logs today show three other accounts getting 403s). Then:400 Hugging Face could not write the saved-papers Bucket.135 accounts migrated fine, so this only affects accounts the Hub refuses.
Change
saved_papers_bucket_migrated_atis null), save and unsave fall back to the database bookmarks when Bucket setup fails. Listings already read those bookmarks for unmigrated accounts. A later successful migration copies all of them, including saves made during the fallback.GET /me/bookmarksgets an additivebucket_errorfield. /saved shows the error and a retry button instead of the same migrate prompt.Validation
pytest backend/tests/test_bookmarks_router.py backend/tests/paper/test_saved_papers_bucket.py: 20 passed, including new tests for the unmigrated fallback, the migrated failure and the listing error.ruff check/ruff format --check,scripts/backend_comments.py check,eslintandtsc --noEmitall pass.🤖 Generated with Claude Code
Note
Medium Risk
Changes bookmark write and read paths for accounts blocked by the Hub; migrated users still fail closed, but unmigrated users now persist only in the database until migration succeeds.
Overview
When Hugging Face refuses to create or write the saved-papers Bucket after OAuth, unmigrated accounts no longer fail on save/unsave:
BookmarkService._require_bucketreturnsNoneinstead of raising, and add/remove still update the database mirror. Migrated accounts continue to surface Bucket errors so the HF store and DB cannot diverge.GET /me/bookmarks (and grouped listings) now expose an optional
bucket_errorwhen an authorized Bucket could not be used and legacy DB bookmarks were returned. Fallback logging includes the underlying Hub exception (__cause__).The /saved UI shows that error with a “Try the Bucket migration again” action instead of repeating the generic approve prompt. Types and ADR 0018 document the behavior. New router tests cover unmigrated DB fallback, migrated failure, and listing error propagation.
Reviewed by Cursor Bugbot for commit 67c2b51. Bugbot is set up for automated code reviews on this repo. Configure here.