Class: RobotLab::To::Verifier

Inherits:
Object
  • Object
show all
Defined in:
lib/robot_lab/to/verifier.rb

Overview

Runs an independent verification command (e.g. the test suite) to confirm a robot's self-reported success before the orchestrator commits.

This is the single-robot translation of separation-of-duties: the deciding authority is a real command run by the orchestrator, not the robot, so the robot cannot self-certify a passing verdict. A non-zero exit -- or a timeout -- fails the gate.

Defined Under Namespace

Classes: Result

Constant Summary collapse

MAX_OUTPUT =
4_000

Instance Method Summary collapse

Constructor Details

#initialize(command, work_dir: Dir.pwd, timeout: 600) ⇒ Verifier

Returns a new instance of Verifier.



22
23
24
25
26
# File 'lib/robot_lab/to/verifier.rb', line 22

def initialize(command, work_dir: Dir.pwd, timeout: 600)
  @command  = command
  @work_dir = work_dir
  @timeout  = timeout
end

Instance Method Details

#runObject



28
29
30
31
# File 'lib/robot_lab/to/verifier.rb', line 28

def run
  output, ok = capture
  Result.new(passed: ok, output: clamp(output))
end