Class: Henitai::CheckpointReporter
- Inherits:
-
Object
- Object
- Henitai::CheckpointReporter
- Defined in:
- lib/henitai/checkpoint_reporter.rb,
sig/henitai.rbs
Overview
Progress observer that flushes the canonical report to disk periodically during a run, so a crash on a long run keeps partial results and the report grows visibly mid-run instead of appearing only at the end (Gate 5).
Each flush serialises only the mutants completed since the previous flush and folds them into the on-disk JSON report. When HTML reporting is active, the self-contained HTML report is regenerated from that merged JSON schema. Reuses Result#to_stryker_schema and CanonicalReportWriter.
On a full (authoritative) run the first flush replaces the report — wiping entries left by earlier runs, including deleted files — and later flushes merge their batch in. On a scoped/partial run every flush merges, matching the end-of-run reporter's behaviour.
Constant Summary collapse
- MONOTONIC =
-> { Process.clock_gettime(Process::CLOCK_MONOTONIC) }
Instance Method Summary collapse
-
#initialize(config:, source_provider:, authoritative:, started_at: Time.now, clock: MONOTONIC) ⇒ CheckpointReporter
constructor
A new instance of CheckpointReporter.
- #progress(mutant) ⇒ void
Constructor Details
#initialize(config:, source_provider:, authoritative:, started_at: Time.now, clock: MONOTONIC) ⇒ CheckpointReporter
Returns a new instance of CheckpointReporter.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/henitai/checkpoint_reporter.rb', line 20 def initialize(config:, source_provider:, authoritative:, started_at: Time.now, clock: MONOTONIC) @config = config @source_provider = source_provider @authoritative = @started_at = started_at @clock = clock @batch = [] @last_flush_at = clock.call @flushed = false end |
Instance Method Details
#progress(mutant) ⇒ void
This method returns an undefined value.
31 32 33 34 |
# File 'lib/henitai/checkpoint_reporter.rb', line 31 def progress(mutant, **) @batch << mutant flush! if due? end |