Skip to content

Readiness endpoint can report ready for corrupt runtime artifacts #2

Description

@Ayushdevo

Problem

GET /ready currently checks only whether the model and health-report paths exist.

A zero-byte/corrupt baseline_model.joblib or malformed model_health_report.json still makes the endpoint return 200 {"status":"ready"}, while /predict or /health can fail immediately afterward.

Why it matters

For orchestration/readiness probes, file existence is weaker than actual service readiness and can route traffic to an unhealthy instance.

Suggested fix

Validate that:

  • the model artifact can be loaded successfully, and
  • the health report can be parsed as JSON with the expected top-level fields.

Keep the check lightweight; caching or mtime-based validation is fine if repeated deserialization is a concern.

Acceptance criteria

  • corrupt model artifact => /ready returns 503
  • malformed health JSON => /ready returns 503
  • valid artifacts => /ready returns 200
  • regression tests cover all three cases

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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