Uh oh!
There was an error while loading. Please reload this page.
Preserve reco fields through to_dict and from_dict round trips - #3383
Open
adamtheturtle wants to merge 1 commit into
Open
Preserve reco fields through to_dict and from_dict round trips#3383adamtheturtle wants to merge 1 commit into
adamtheturtle wants to merge 1 commit into
Conversation
adamtheturtletemporarily deployed
to
development
August 9, 2026 17:20 — with
GitHub Actions
Inactive
``CloudDatabase.to_dict`` omitted ``reco_threshold``, ``total_recos``, ``current_month_recos`` and ``previous_month_recos``, and ``ImageTarget.to_dict`` omitted the three reco counts plus ``reco_rating``, so ``from_dict`` restored those fields to their class defaults. Add round trip tests which assert that every field of both dataclasses survives, so that a new field cannot quietly fall out of the serialisation. Fixes#3374. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
adamtheturtleforce-pushed
the
adamtheturtle/vws-python-mock-issue-3374
branch
from
August 9, 2026 21:24
5108c77 to
597b989Compareadamtheturtletemporarily deployed
to
development
August 9, 2026 21:24 — with
GitHub Actions
Inactive
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 freeto 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.
CloudDatabase.to_dictomittedreco_threshold,total_recos,current_month_recosandprevious_month_recos, andImageTarget.to_dictomitted the three reco counts plusreco_rating, sofrom_dictrestored those fields to their class defaults. This is invisible today because those fields are always at their defaults, but it would silently reset seeded reco counts in the Docker backend, which round-trips every database throughto_dict/from_dicton every request.These fields are now added to
CloudDatabaseDict,ImageTargetDictand bothto_dict/from_dictpairs, asNotRequiredkeys with the dataclass defaults so existing dictionaries still load. New round-trip tests build aCloudDatabaseand anImageTargetwith every field set to a non-default value, assertfrom_dict(to_dict(x)) == x, and assert the dataclass field names against an explicit set so that a newly added field cannot quietly fall out of the serialisation.The
ImageTargetrater identity is still deliberately not preserved; the test asserts the computedtracking_ratingsurvives instead.Fixes#3374.
🤖 Generated with Claude Code