Skip to content

Fail closed when safety hydration fails - #7

Open
navigotechsolutions-labs wants to merge 4 commits into
xai-org:mainfrom
navigotechsolutions-labs:fix/visibility-hydration-fail-closed
Open

navigotechsolutions-labs wants to merge 4 commits into
xai-org:mainfrom
navigotechsolutions-labs:fix/visibility-hydration-fail-closed

Conversation

@navigotechsolutions-labs

Copy link
Copy Markdown

Summary

The visibility-filtering hydration layer converts author and viewer-relationship backend failures into default or empty metadata. Downstream rules can then evaluate the candidate as ordinary content and return Allow, even though safety-critical metadata was unavailable.

Fix

  • Track failed author and social-graph hydration per candidate.
  • Preserve the candidate while marking safety-critical hydration failure.
  • Add a first-position visibility rule that drops marked candidates before content-specific rules can allow or interstitial them.

Tests

  • Add hydration assembly coverage for failed author hydration.
  • Add policy coverage proving failed hydration drops on both home surfaces.
  • Add coverage proving healthy candidates remain eligible.
  • git diff --check passes.

The repository checkout does not expose a Cargo manifest for visibility-filtering, and the environment lacks cargo, rustc, and rustfmt, so native Rust tests and formatting could not be run locally. Source-level call-site and struct-literal audits were completed.

@Pitchfork-and-Torch Pitchfork-and-Torch left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review (COMMENT, not approve)

The fail-closed rule on failed author or social-graph hydration is the right serving default. Empty/default features on those paths currently look like a healthy user with no blocks, which is fail-open.

Gap still open after this PR: safety_labels still default to an empty map when hydration misses (unwrap_or_default in assemble). That remains fail-open for restriction labels. Pair with PR 12 (expiry at serve) rather than treating empty labels as no restrictions.

FilteredReason::UnspecifiedReason will be opaque in Under the Hood / debug. A dedicated reason would make the drop inspectable.

Tests for both home surfaces and the healthy-candidate still-Allow case are the right shape. Public dump still has no standalone Cargo target for this crate, so I did not rerun rustc.

Verdict: support-with-gap. I would take this, then fail-close or explicitly metric safety-label hydration misses.

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.

3 participants