Skip to content

fix: accept string-form version in posting_json_metadata - #386

Merged
kuny0707 merged 1 commit into
masterfrom
fix/profile-version-string-compat
Aug 14, 2026
Merged

fix: accept string-form version in posting_json_metadata#386
kuny0707 merged 1 commit into
masterfrom
fix/profile-version-string-compat

Conversation

@ety001

@ety001 ety001 commented Aug 13, 2026

Copy link
Copy Markdown
Member

Problem

The version field in posting_json_metadataprofile is serialized inconsistently across Steem clients:

Source version value Type
Official condenser (Settings.jsx:169) 2 JSON number
Some third-party clients "2" JSON string

The strict equality check at hive/utils/account.py:14 only accepted the numeric form:

assert 'version' in prof and prof['version'] == 2

A string "2" fails "2" == 2 in Python → assertion fails → falls through to json_metadata fallback → if that is also empty/invalid → prof = {}all profile fields (profile_image, cover_image, name, about, etc.) are stored as empty strings in hive_accounts.

Impact

Since safe_profile_metadata() runs during indexing and the result is persisted to the hive_accounts DB table, affected accounts have empty profile data in the database. The condenser frontend calls bridge.get_profile, reads these empty strings, and:

  • Avatar hidden: Userpic component hideIfDefault logic sees empty profile_image → hides the avatar entirely
  • Banner hidden: UserProfileHeader sees empty cover_image → no banner background rendered

Real-world example: user bijoy1 (version "2", empty json_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_accounts table (columns profile_image, cover_image, etc.). After this fix is deployed, affected accounts will be corrected on their next account refresh cycle.

Fix

Change prof['version'] == 2 to prof['version'] in (2, '2') — accepts both numeric and string forms.

Added a detailed comment explaining the inconsistency and a TODO to standardize on a single canonical type (JSON number) when a new version is introduced.

Test

Added test_string_version_account covering the string-form version case. All 3 tests pass:

tests/utils/test_utils_account.py::test_valid_account PASSED
tests/utils/test_utils_account.py::test_string_version_account PASSED
tests/utils/test_utils_account.py::test_invalid_account PASSED

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
kuny0707 merged commit 6d0f3e1 into master Aug 14, 2026
1 check passed
@ety001
ety001 deleted the fix/profile-version-string-compat branch August 14, 2026 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants