Skip to content

Conversation

jimchamp
Copy link
Collaborator

@jimchamp jimchamp commented Aug 19, 2025

Supports #11009

Updates save_preferences() to write only to the store.

The preferences() method has been updated to first query the store for preferences, then the legacy thing tables if nothing was found in the store. If no preferences were found in either data source, the default preference object is returned.

It should be safe to deploy this before the preference migration script from #10943 is executed. However, we will need to update the query that populates the admin pd table to include the store tables (marking this as a draft until this is addressed). Also noting here that querying the store for this data takes a significantly longer time (minutes v. seconds). Edit: Query times for either data source are comparable.

Technical

Testing

Screenshot

Stakeholders

@jimchamp jimchamp marked this pull request as draft August 19, 2025 23:18
@jimchamp
Copy link
Collaborator Author

Failing tests have uncovered another patron settings API that needs to be wrangled.

@mekarpeles mekarpeles self-assigned this Aug 20, 2025
@mekarpeles
Copy link
Member

RSLGTM -- it looks like there's a test to fix and also @jimchamp mentions there may be another settings call that needs to be updated to use the store.

@jimchamp jimchamp force-pushed the preference-fetching branch from b558f90 to 713636f Compare August 20, 2025 23:27
@jimchamp
Copy link
Collaborator Author

Test was fixed. This requires a rebase and an update to the script added by #10943 to fix the failing workflows.

{"author": self.key, "limit": limit, "offset": offset}
)

def get_users_settings(self):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method, and get_safe_mode (another User method, several lines below), are called in various places throughout the codebase. get_safe_mode calls this method (get_users_settings) for preferences, so I think we need only to replace references to get_users_settings() with preferences() to establish a single source of truth for patron preferences.

I figure that this can handled in a separate PR, and is likely also a good first issue.

@jimchamp jimchamp added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Aug 21, 2025
Updates `save_preferences` method to write only to the store tables.

The `preferences` method has been updated to fetch preferences from
the store, then fall-back to the thing database.  If no preferences
were found in either data source, the default preference object is
returned.
@jimchamp jimchamp force-pushed the preference-fetching branch from 0cbf266 to ed35221 Compare August 23, 2025 00:02
@github-actions github-actions bot removed the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Aug 23, 2025
@jimchamp jimchamp marked this pull request as ready for review August 23, 2025 00:09
@mekarpeles mekarpeles added the Priority: 1 Do this week, receiving emails, time sensitive, . [managed] label Sep 8, 2025
@mekarpeles
Copy link
Member

We added this PR to testing, we logged in as mek+test3Archive.org, we checked https://testing.openlibrary.org/people/xxxtests3/preferences.json, we set the preference to private reading log, verified the page was private (and that the preferences.json did not reflect this, i.e. are not being used; the store is)

@mekarpeles mekarpeles merged commit b483a35 into internetarchive:master Sep 10, 2025
4 checks passed
@jimchamp jimchamp deleted the preference-fetching branch September 19, 2025 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: 1 Do this week, receiving emails, time sensitive, . [managed]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants