Skip to content

Ambient Time.now used instead of the injected clock in terminal/delegation paths #59

@nficano

Description

@nficano

Category: side-effects Severity: minor
Location: lib/arcp/runtime/job_context.rb:115-124

What

The runtime threads an injectable clock (SystemClock/FakeClock) through nearly every component, but JobContext#finish (completed_at) and Lease::Subsetting.bound (issued_at) call Time.now.utc directly. This ambient dependency makes those timestamps non-deterministic and untestable under FakeClock.

Evidence

@sink.publish_result(
  @job_id,
  Arcp::Job::Result.new(
    job_id: @job_id, final_status: 'success',
    result: result,
    result_id: @chunked ? @result_id : nil,
    result_size: @chunked ? totals && totals[:bytes] : nil,
    completed_at: Time.now.utc.iso8601
  )
)

Proposed fix

Inject the clock into JobContext and Subsetting and use clock.now instead of Time.now.

Acceptance criteria

  • Terminal result completed_at and delegated lease issued_at derive from the injected clock.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions