Add FunctionalVerificationRunService

What does this MR do and why?

  • Adds Ai::DuoAgentPlatform::FunctionalVerificationRunService for reading and mutating the current functional verification run for a check type
  • Adds Ai::DuoAgentPlatformFunctionVerificationCheck module with agentic_chat_verification_check_enabled? method to check availability for GQL entry points and FE.

References

Closes #618769 (closed)

How to set up and validate locally

In the Rails console:

service = Ai::DuoAgentPlatform::FunctionalVerificationRunService.new(check_type: :agentic_chat)

# 1. nothing run yet
p service.read # => { state: "not_run" }

# 2. start a run
service.mark_running(workflow_id: 1)
p service.read # => { state: "running", workflow_id: 1, ... }

# 3. complete it (pass)
service.mark_completed(workflow_id: 1, status: :passed)
p service.read # => { state: "passed", ... }

# 4. start a new run, let it go stale, confirm read self-heals it to failed
service.mark_running(workflow_id: 2)
Ai::DuoAgentPlatform::FunctionalVerificationRun.current_for(:agentic_chat)
  .update_column(:updated_at, 200.seconds.ago) # simulate stale
p service.read # => { state: "failed", message: "Verification check timed out." }

# 5. race guard: mark_completed on a stale run after timeout already fired should be a no-op
result = Ai::DuoAgentPlatform::FunctionalVerificationRun.complete_run(
  check_type: :agentic_chat, workflow_id: 2, status: :passed, message: nil
)
p result # => false, since status is no longer :running... wait check scope

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Cindy Halim

Merge request reports

Loading
Loading