Skip to content

visibility-filtering: ignore expired safety labels when dropping posts - #10

Merged
Pitchfork-and-Torch merged 1 commit into
mainfrom
cursor/vf-expired-label-drops-1f6a
Sep 4, 2026
Merged

visibility-filtering: ignore expired safety labels when dropping posts#10
Pitchfork-and-Torch merged 1 commit into
mainfrom
cursor/vf-expired-label-drops-1f6a

Conversation

@Pitchfork-and-Torch

@Pitchfork-and-Torch Pitchfork-and-Torch commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Problem

Abuse-enforcement writes time-limited tweet labels (for example SpamHighRecall with a 30-day expiresAtMsec). Visibility filtering decodes that expiry onto the proto, then SafetyLabelMap::from_proto_label_types keeps only the type key and builds a default label with no expiry.

Drop rules (SpamHighRecallDropRule and the other tweet-label drops) call has_label, which is type presence only. After the TTL, the post can still be dropped from out-of-network recommendations.

Under the Hood already treats a past expires_at_msec as inactive when it reads the same label store snapshot. The live filter path did not.

Change

Filter proto rows whose expires_at_msec is at or before now before inserting them into the type set used by drop rules. A missing expiry stays permanent.

No change to write paths, TTLs, or which labels exist. GetSafetyLabels still returns the raw proto, including expired rows.

Tests

  • safety_labels.rs: permanent / future / past / exactly-now expiry, plus a mixed map that keeps the active sibling.
  • tweet_label_drops.rs: an expired SpamHighRecall proto row evaluates to Allow.

This crate depends on internal xai_* packages that are not in the repo, so the tests cannot be run here. Correctness is from the existing drop-rule path (has_label -> SafetyLabelDropRule::evaluate) plus the expiry fence above it.

Upstream

A straight cherry-pick onto xai-org/x-algorithm main does not apply. Upstream simplified SafetyLabelMap to a type-only HashSet and folded tweet_label_drops.rs into tweet_rules.rs. The same expiry filter is ported there: xai-org#106

Open in Web Open in Cursor 

Drop rules only look at label type presence. Hydration copied every proto
key into that set and threw away expires_at_msec, so a TTL-bound label
such as SpamHighRecall kept suppressing out-of-network posts after the
intended window.

Filter expired proto rows before building the type set. A missing expiry
stays permanent. Adds unit tests for the expiry fence and a drop-rule
case that an expired SpamHighRecall allows.

Co-authored-by: Jon Bailey <Pitchfork-and-Torch@users.noreply.github.com>
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