Skip to content

view_count always NULL — view_counts_everywhere_api_enabled flag missing from GRAPHQL_FEATURES #144

@RealADemin

Description

@RealADemin

The bookmarks.view_count column is always NULL because the Bookmarks endpoint request omits the feature flag X requires to include views in the response. Schema, types, and parser are all already in place — only the flag is missing.

Evidence

1. Schema, type, and parser exist and are wired up correctly.

  • Column: view_count INTEGER at src/bookmarks-db.ts:257
  • Type: viewCount?: number on BookmarkEngagementSnapshot at src/types.ts:40
  • Parser: convertTweetToRecord reads tweet?.views?.count at src/graphql-bookmarks.ts:369:
    viewCount: tweet?.views?.count ? Number(tweet.views.count) : undefined,

2. The flag is in TWEET_RESULT_FEATURES but missing from GRAPHQL_FEATURES.

Feature object view_counts_everywhere_api_enabled
TWEET_RESULT_FEATURES (src/graphql-bookmarks.ts:1379, used by TweetResultByRestId) true
GRAPHQL_FEATURES (src/graphql-bookmarks.ts:39, used by the Bookmarks endpoint) absent ✗

X strips views from responses when the requesting client hasn't opted in via this flag. The Bookmarks endpoint never sets the flag → the response never contains views → the parser always reads undefined → SQLite stores NULL.

3. End-to-end confirmed against a real ~5200-bookmark corpus:

sqlite> SELECT COUNT(*), SUM(CASE WHEN view_count IS NULL THEN 1 ELSE 0 END) FROM bookmarks;
5222 | 5222   ← 100% NULL

4. Confirmed populated via TweetResultByRestId (which has the flag enabled).

Three sample tweets fetched via TweetResultByRestId all returned populated views.count: 6648, 31695, 1509310. Same parser path; only the request-side flag set differs.

Fix

One-line addition to GRAPHQL_FEATURES at src/graphql-bookmarks.ts:39:

view_counts_everywhere_api_enabled: true,

After the flag lands, new syncs populate view_count automatically — no parser, schema, or migration changes needed. Existing NULL rows will not be retroactively filled — they'd require a re-sync of those bookmarks to backfill.

Context

GRAPHQL_FEATURES is also missing 6 other flags enabled in TWEET_RESULT_FEATURES (responsive_web_twitter_article_tweet_consumption_enabled, profile_label_improvements_pcf_label_in_post_enabled, premium_content_api_read_enabled, rweb_cashtags_enabled, graphql_is_translatable_rweb_tweet_is_translatable_enabled, standardized_nudges_misinfo). view_counts_everywhere_api_enabled is the only one with a current parser dependency — the other six gate fields the parser doesn't read, so enabling them wouldn't change observable behavior today. Worth syncing the two feature sets eventually but each can be evaluated separately; this issue targets the one with concrete user-visible impact.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions