Skip to content

Limit Brazil 2026 election filter to BR request country - #20

Closed
Pitchfork-and-Torch wants to merge 19 commits into
mainfrom
cursor/brazil-election-geo-scope-0257
Closed

Limit Brazil 2026 election filter to BR request country#20
Pitchfork-and-Torch wants to merge 19 commits into
mainfrom
cursor/brazil-election-geo-scope-0257

Conversation

@Pitchfork-and-Torch

Copy link
Copy Markdown
Owner

Bug

Brazil2026ElectionFilter runs for every For You viewer. It has no country check.

The list is the TSE 2026 Electoral Court set (Art. 28 § 1º-A of Resolution 23.610). That rule is for recommendation in Brazil. query.country_code is already on the request. The filter ignored it, so about 2554 listed accounts were dropped from For You worldwide.

Not the listed-viewer self-id hole (#53). is_excluded_author and the follow exception are unchanged.

OON SimClusters NSFW gate (survey)

OONNsfwSimclustersFilter was checked after the gizmoduck origin NSFW change (xai-org#125).

No remaining correctness bug in that filter after xai-org#125.

Fix

One file, home-mixer/filters/brazil_2026_election_filter.rs.

  • Apply the list when country_code is BR / br.
  • Apply the list when country is empty or missing (fail closed on unknown geo).
  • Skip when country is present and not Brazil.

Tests

  • Known US viewer keeps a listed author.
  • BR viewer still drops a listed author.
  • br is in scope.
  • Empty / default country still drops a listed author.

home-mixer has no public Cargo manifest. The geo gate was compiled and run as a rustc model: passed.

Lane: home-mixer/filters/brazil_2026_election_filter.rs only. Based on xai-org/x-algorithm main.

Open in Web Open in Cursor 

CI agent and others added 19 commits August 14, 2026 20:55
in_network_ids is passed to the VF client without deduplication, while
oon_ids is deduped four lines below. retweeted_tweet_id is pushed for
every candidate that has one, so the same ID repeats once per retweet of
a given post — most often when that post is going viral.

Neither VfClient implementation dedupes its input: StratoVfClient builds
one call per element, and XaiVfClient chunks by XAI_VF_MAX_BATCH_SIZE, so
duplicates consume batch slots and can force an extra round trip.

Not a correctness issue — results collapse into a HashMap keyed by tweet
ID — but redundant work on the For You serving path.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Deduplicate in_network_ids before VF lookup
Art. 28 § 1º-A is a Brazil recommendation rule. The filter applied the
Electoral Court list to every viewer. Known non-BR country_code now
skips it. Empty or missing country still applies so a geo miss cannot
turn the list off.

Co-authored-by: Jon Bailey <Pitchfork-and-Torch@users.noreply.github.com>
@Pitchfork-and-Torch
Pitchfork-and-Torch marked this pull request as ready for review September 7, 2026 04:31
@Pitchfork-and-Torch

Copy link
Copy Markdown
Owner Author

Wrong base (fork PR). Ship vehicle is upstream xai-org#130. Per submit law: never PR Pitchfork-and-Torch/x-algorithm. Do not merge this.

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.

4 participants