Skip to content

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

Open
Pitchfork-and-Torch wants to merge 1 commit into
xai-org:mainfrom
Pitchfork-and-Torch:cursor/vf-expired-label-drops-upstream-1f6a
Open

visibility-filtering: ignore expired safety labels when dropping posts#106
Pitchfork-and-Torch wants to merge 1 commit into
xai-org:mainfrom
Pitchfork-and-Torch:cursor/vf-expired-label-drops-upstream-1f6a

Conversation

@Pitchfork-and-Torch

Copy link
Copy Markdown

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.

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.

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 -> tweet-label drop specs) plus the expiry fence above it.

Fork

Same fix on the Pitchfork-and-Torch fork: Pitchfork-and-Torch#10

The fork still has the older SafetyLabelMap (HashMap plus type set) and tweet_label_drops.rs, so this is a port of that patch onto current xai-org/x-algorithm main rather than a clean cherry-pick.

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.

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