Skip to content

Fail closed when the AI image validator returns an unhealthy response #18

Description

@rioredwards

Summary

uploadPhoto() currently allows uploads to continue when the validator returns a non-2xx HTTP response. That means a degraded validator can silently stop enforcing the dog-only and NSFW checks.

Why this matters

  • Invalid or inappropriate content can be accepted during partial outages
  • The app presents moderation as enforced when it is not
  • This is a production-safety issue, not just an availability issue

Evidence

  • app/db/actions.ts:64-74
  • app/db/actions.ts:95-100

Current behavior

  • Network or throwing fetch failures return AI validator check failed
  • Non-2xx validator responses only log and proceed without validation

Suggested fix

Treat any non-success validator response as a failed validation dependency and reject the upload with a clear retry message. If graceful degradation is desired, it should be an explicit feature flag with monitoring, not the default behavior.

Acceptance criteria

  • Any validator error path blocks the upload
  • User receives a clear retryable error message
  • Logging distinguishes timeout, transport, and validator-service failures
  • Add tests for network failure and non-2xx validator responses

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions