Skip to content

fix : add priority validation in SLA prediction service #704

@tmdeveloper007

Description

@tmdeveloper007

Summary of What Needs to be Done:
The predict method in sla_prediction_service.py uses DEFAULT_SLA_HOURS.get(priority, 72) which silently accepts invalid priority values. An invalid priority like 'invalid' would use default 72 hours instead of raising an error.

Changes that Need to be Made:

  • Add validation at the start of predict method
  • Check that priority is in DEFAULT_SLA_HOURS keys
  • Raise ValueError for unknown priorities
  • Update _risk_level to also validate thresholds dict

Changes to be made in backend/services/sla_prediction_service.py:

  • Add priority validation before processing
  • Raise clear error message for invalid priority

Impact that it would Provide:

  • Fail fast for invalid priority values
  • Help catch configuration errors early
  • Make behavior explicit rather than silently using defaults
  • Improve debuggability

Please assign this issue to me so I can implement it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bountyCritical Bounty Task for high-scoring contributorsgssocGirlScript Summer of Codelevel:criticalCritical level difficultytype:bugBug fix

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions