Skip to content

Preserve role-specific VF results for primary and ancillary posts - #90

Open
yinkev wants to merge 1 commit into
xai-org:mainfrom
yinkev:fix/vf-role-specific-results
Open

Preserve role-specific VF results for primary and ancillary posts#90
yinkev wants to merge 1 commit into
xai-org:mainfrom
yinkev:fix/vf-role-specific-results

Conversation

@yinkev

@yinkev yinkev commented Sep 2, 2026

Copy link
Copy Markdown

Follow-up to #55 by @Pitchfork-and-Torch. This keeps the role-specific lookup proposed there and adapts it to the current TweetVisibility API and the newer Following hydrator call site.

Bug

The exported implementation now inserts TimelineHome results after TimelineHomeRecommendations, which correctly stops a Recommendations verdict from overwriting an in-network primary. The two result sets are still collapsed into one map keyed only by post ID, however, and that same map is reused for ancestor and quote checks.

A post can occupy both roles in one selected batch:

  • P is an in-network primary.
  • Q is an out-of-network quote of P.
  • TimelineHome(P) is Interstitial.
  • TimelineHomeRecommendations(P) is Drop.
  • TimelineHomeRecommendations(Q) is Allow.

The current merge keeps the correct primary verdict for P, but Q also sees that TimelineHome verdict when checking its quoted post. Q.drop_ancillary_posts is therefore false even though the quoted-post check was requested at TimelineHomeRecommendations.

Fix

Keep the two safety-level result maps separate until the candidate role is known:

  • in-network primaries use TimelineHome;
  • out-of-network primaries use TimelineHomeRecommendations;
  • ancestors and quoted posts use TimelineHomeRecommendations;
  • retweeted posts use TimelineHome.

The existing one-map should_drop_ancillary signature remains intact for VFFollowingCandidateHydrator, which only fetches TimelineHome; it delegates with the same map for both arguments.

Tests

  • Added an end-to-end hydrator regression proving that P retains its Home interstitial while Q receives the Recommendations ancillary drop.
  • Added direct coverage for ancestor, quote, and retweet map selection.
  • The regression fails against unmodified main with Some(false) instead of Some(true) for Q.drop_ancillary_posts.
  • The patched source and the unchanged Following caller compile in a focused harness: 2 tests passed.
  • cargo clippy --all-targets -- -D warnings, rustfmt --check, and git show --check pass.

The public export does not include a Home Mixer Cargo manifest, so the full internal target still needs to run in X's build environment.

Keep TimelineHome and TimelineHomeRecommendations results separate until the candidate role is known. Primary posts use their lane, ancestors and quotes use Recommendations, and retweets use TimelineHome.

Preserve the one-map helper used by the Following pipeline and add regression coverage for a post that is both an in-network primary and an out-of-network quote target.

Co-authored-by: Jon Bailey <Pitchfork-and-Torch@users.noreply.github.com>
@Pitchfork-and-Torch

Copy link
Copy Markdown

Thanks for carrying the residual after #55. xAI's integrate in 6384ca7 reversed the HashMap fill so TimelineHome wins on collision, then still used one map for primary and ancillary. This two-map restore is the leftover class. Not opening a third copy from this account.

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