Module: Bulldogger

Defined in:
lib/bulldogger.rb,
lib/bulldogger/run.rb,
lib/bulldogger/probe.rb,
lib/bulldogger/skill.rb,
lib/bulldogger/config.rb,
lib/bulldogger/record.rb,
lib/bulldogger/replay.rb,
lib/bulldogger/capture.rb,
lib/bulldogger/pending.rb,
lib/bulldogger/version.rb,
lib/bulldogger/evidence.rb,
lib/bulldogger/instance.rb,
lib/bulldogger/redactor.rb,
lib/bulldogger/formatter.rb,
lib/bulldogger/frame_source.rb,
lib/bulldogger/probe/bucket.rb,
lib/bulldogger/probe/target.rb,
lib/bulldogger/probe/writer.rb,
lib/bulldogger/probe/session.rb,
lib/bulldogger/record/writer.rb,
lib/bulldogger/failure_output.rb,
lib/bulldogger/probe/registry.rb,
lib/bulldogger/record/session.rb,
lib/bulldogger/probe/comparator.rb,
lib/bulldogger/application_frames.rb,
lib/bulldogger/integrations/rspec.rb,
lib/bulldogger/probe/method_stats.rb,
lib/bulldogger/probe/raise_tracker.rb,
lib/bulldogger/integrations/minitest.rb,
lib/bulldogger/probe/target_resolver.rb,
lib/bulldogger/record/sqlite_converter.rb

Overview

Ruby execution evidence for coding agents, as files: a failing test writes a structured snapshot of its own failure, so an agent can read runtime values instead of guessing them from source.

This module is a thin facade over a default Instance. Separate instances let a tool observe a suite that resets the default instance during test setup. This module does not own capture, formatting, or redaction logic.

Defined Under Namespace

Modules: ApplicationFrames, FailureOutput, Minitest, Probe, RSpec, Record, Skill Classes: Capture, Config, Evidence, Formatter, FrameSource, Instance, Pending, Redactor, Replay, Run

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.configObject



33
34
35
# File 'lib/bulldogger.rb', line 33

def config
  default.config
end

.configureObject



37
38
39
40
# File 'lib/bulldogger.rb', line 37

def configure
  default.configure { |config| yield config }
  self
end

.defaultObject

Test setup can replace this default for isolation. An explicitly created Instance keeps an outer observer alive when the default is replaced.



29
30
31
# File 'lib/bulldogger.rb', line 29

def default
  @default ||= Instance.new
end

.finishObject



68
69
70
# File 'lib/bulldogger.rb', line 68

def finish
  default.finish
end

.probe(*target_strings, &block) ⇒ Object

Watches target_strings (each "Klass#method" or "Klass.method") for the life of the block and writes one evidence file summarizing every call's argument/return shape. See lib/bulldogger/probe.rb. Returns the written path, or nil if the switch is off -- the block still runs either way, only the observing and writing are skipped.



78
79
80
# File 'lib/bulldogger.rb', line 78

def probe(*target_strings, &block)
  default.probe(*target_strings, &block)
end

.probe_compare(path_a, path_b) ⇒ Object



90
91
92
# File 'lib/bulldogger.rb', line 90

def probe_compare(path_a, path_b)
  default.probe_compare(path_a, path_b)
end

.probe_start(*target_strings) ⇒ Object

Explicit-session counterpart to #probe: call session.finish to stop watching and write the evidence file. Returns nil, not a session, when the switch is off -- callers must guard the same way every other disabled-switch return value here is guarded.



86
87
88
# File 'lib/bulldogger.rb', line 86

def probe_start(*target_strings)
  default.probe_start(*target_strings)
end

.record(&block) ⇒ Object

Traces every call, return, and raise in the block to a JSONL file. See lib/bulldogger/record.rb. Returns the written path, or nil if the switch is off. This is the expensive verb, which is why it is a verb: it costs roughly 4500ns per traced call, on every call rather than on a named few.



99
100
101
# File 'lib/bulldogger.rb', line 99

def record(&block)
  default.record(&block)
end

.record_failure(exception:, test:) ⇒ Object



60
61
62
# File 'lib/bulldogger.rb', line 60

def record_failure(exception:, test:)
  default.record_failure(exception: exception, test: test)
end

.record_startObject

Explicit-session counterpart to #record: call session.stop to finish the trace and get its path.



105
106
107
# File 'lib/bulldogger.rb', line 105

def record_start
  default.record_start
end

.run_dirObject



64
65
66
# File 'lib/bulldogger.rb', line 64

def run_dir
  default.run_dir
end

.running?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/bulldogger.rb', line 52

def running?
  default.running?
end

.skill_pathObject



23
24
25
# File 'lib/bulldogger/skill.rb', line 23

def self.skill_path
  Skill.path
end

.snapshot_for(exception) ⇒ Object



56
57
58
# File 'lib/bulldogger.rb', line 56

def snapshot_for(exception)
  default.snapshot_for(exception)
end

.startObject



42
43
44
45
# File 'lib/bulldogger.rb', line 42

def start
  default.start
  self
end

.stopObject



47
48
49
50
# File 'lib/bulldogger.rb', line 47

def stop
  default.stop
  self
end

.trace_to_sqlite(jsonl_path, db_path) ⇒ Object

Converts a written trace into SQLite for indexed querying. Returns nil when the sqlite3 gem is absent, which is the normal case -- JSONL is the canonical format and this is an adapter over it, so bulldogger never depends on sqlite3 at runtime.



113
114
115
# File 'lib/bulldogger.rb', line 113

def trace_to_sqlite(jsonl_path, db_path)
  default.trace_to_sqlite(jsonl_path, db_path)
end