fix: accept string-form version in posting_json_metadata - #386
Merged
Conversation
The version field in posting_json_metadata profile is serialized inconsistently across Steem clients: the official condenser writes a JSON number (version: 2), but some third-party clients write a JSON string (version: "2"). The strict equality check prof['version'] == 2 failed for string-form versions, causing hivemind to fall through to an empty fallback -- profile_image, cover_image, and all other profile fields were returned as empty strings. Real-world example: user "bijoy1" (version "2") had empty profile data in hivemind's DB, so the condenser frontend hid both avatar and banner. Fix: change prof['version'] == 2 to prof['version'] in (2, '2') to accept both numeric and string forms. Added comment + TODO explaining the inconsistency and the plan to standardize on a single type when a new version is introduced.
kuny0707
approved these changes
Aug 14, 2026
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.
Problem
The
versionfield inposting_json_metadata→profileis serialized inconsistently across Steem clients:versionvalueSettings.jsx:169)2"2"The strict equality check at
hive/utils/account.py:14only accepted the numeric form:A string
"2"fails"2" == 2in Python → assertion fails → falls through tojson_metadatafallback → if that is also empty/invalid →prof = {}→ all profile fields (profile_image,cover_image,name,about, etc.) are stored as empty strings inhive_accounts.Impact
Since
safe_profile_metadata()runs during indexing and the result is persisted to thehive_accountsDB table, affected accounts have empty profile data in the database. The condenser frontend callsbridge.get_profile, reads these empty strings, and:UserpiccomponenthideIfDefaultlogic sees emptyprofile_image→ hides the avatar entirelyUserProfileHeadersees emptycover_image→ no banner background renderedReal-world example: user
bijoy1(version"2", emptyjson_metadata) — both avatar and banner invisible on steemit.com.Note on data flow
This function executes once during indexer account sync. The parsed result is written to the
hive_accountstable (columnsprofile_image,cover_image, etc.). After this fix is deployed, affected accounts will be corrected on their next account refresh cycle.Fix
Change
prof['version'] == 2toprof['version'] in (2, '2')— accepts both numeric and string forms.Added a detailed comment explaining the inconsistency and a
TODOto standardize on a single canonical type (JSON number) when a new version is introduced.Test
Added
test_string_version_accountcovering the string-formversioncase. All 3 tests pass: