Skip to main content

Module ruby_instrumenter

Module ruby_instrumenter 

Source
Expand description

Supercov-owned Ruby obligation discovery.

Prism (Ruby’s own parser) supplies syntax and exact byte ranges. Supercov owns the denominator: every statement, method, decision and branch obligation is decided here, ahead of the run, from source alone.

Alongside the shared CoverageManifest this module emits a probe plan for the stdlib-only Ruby runtime. Ruby’s Coverage module already reports lines, if/unless/case/&. branches and method entry with byte columns, so those obligations are proven by matching its keys (shifted for the text the runtime inserts). What Coverage cannot see — the operands of &&/|| for MC/DC, ||=, loop entry, rescue flow and a second statement on a line — is proven by probe calls the runtime splices into the source in memory at load time. No insertion contains a newline, so line numbers, backtraces and the stdlib line table stay exact.

Structs§

BranchKeyPlan
CaseClausePlan
CaseNoMatchPlan
CasePlan
case clauses are tested in order, so a clause was missed exactly when a later clause (or the implicit else) was selected. The runtime derives that per phase from the selected counts.
DerivedLogical
Edit
One text insertion the runtime applies to the original source before compiling it. Offsets are bytes into the original file; the runtime applies insertions from the end of the file backwards, so offsets stay valid.
HandlerTarget
LoopTarget
MethodKeyPlan
PlanSpan
RubyFileObligations
RubyFilePlan
RubyProbePlan
StdlibDecision
StdlibKey
A Coverage branch key: the group type (if, case, &., while), the branch type (then, else, when, in, body) and the branch span in post-insertion coordinates.

Enums§

ConditionTree
Short-circuit structure of a decision. Leaves are condition indexes.
KeyKind
A source span in one-based lines and zero-based byte columns, the units Ruby’s Coverage module reports. Serialized as [[line, col], [line, col]]. What a stdlib key’s span names.
ProbeTarget
What a probe call reports. The runtime looks the key up and records the obligations named here.
RubyInstrumenterError

Constants§

BEGIN_BODY_LIMITATION
RUBY_PROBE_PLAN_VERSION
RUBY_PROBE_RECEIVER
Global the runtime binds its probe receiver to. Chosen to be unpronounceable in application code.

Functions§

apply_edits
Apply a plan’s edits to the original source the way the runtime does.
build_ruby_obligations
Build the complete obligation manifest and probe plan for one Ruby file. next_probe numbers probes uniquely across the whole project.