Class: Rigor::Effects::Origin

Inherits:
Object
  • Object
show all
Defined in:
lib/rigor/effects/origin.rb

Overview

Where one bundle of labels in a summary came from (ADR-103 WD14).

An origin is the pair of what coloured the labels and which source did the colouring, and it is deliberately line-free: two puts calls in one method share one origin, so a summary is stable under a line move and a snapshot diff shows a change of behaviour rather than a change of formatting. Call sites are kept separately, per run, for the report only.

name is the callee key (Kernel#puts, Time.now) for a catalogued row, and the construct's name (xstring, gvar-write) for a language construct. source says which of the two it is, because the two namespaces overlap in principle and a later slice discharges policy per origin.

Constant Summary collapse

CONSTRUCT =

A Ruby language construct — backticks, a $gvar write, an @ivar write (§ 5.1 of the design note).

:construct
CATALOGUE =

A row of the built-in effect catalogue (Catalog; data/effects/core.yml from #380).

:catalogue
ATTRIBUTION =

A row of the project's own effects.attribution: table — a claim about code Rigor did not analyse. Its labels land in the summary's DECLARED lane and never in the proven one, and the site keeps its plugin-attribution taint (ADR-103 WD6: "declared this, and possibly more").

:attribution
ENVELOPE =

An Envelope the callee's own declaration carries — a project annotation, an effects.envelopes: convention, or an accepted signature's %a{…} (#386). Its labels land in the DECLARED lane, like an attribution's, but unlike an attribution the bound is checked (or trusted at the type tier), so the site is exhaustive rather than tainted: ADR-103 WD6's discharging strata. name is the callee key the bound was resolved for.

:envelope
PLUGIN =

A row of a loaded plugin's effect_attributions: — what the plugin that models a framework says a call into it does (#387; ADR-103 WD6 / WD10). Its labels land in the DECLARED lane, like an attribution's and an envelope's, and which of those two it behaves like is decided by the plugin's standing: a first-party bundled plugin's row discharges, so the site is exhaustive, exactly as an accepted signature's %a{…} is; a third-party plugin's does not, and the site keeps its plugin-attribution taint. One origin source for both, because the label came from the same place either way and explain should say so.

:plugin

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.attribution(name) ⇒ Object



47
48
49
# File 'lib/rigor/effects/origin.rb', line 47

def self.attribution(name)
  new(name: name.to_s, source: ATTRIBUTION)
end

.catalogue(name) ⇒ Object



43
44
45
# File 'lib/rigor/effects/origin.rb', line 43

def self.catalogue(name)
  new(name: name.to_s, source: CATALOGUE)
end

.construct(name) ⇒ Object



39
40
41
# File 'lib/rigor/effects/origin.rb', line 39

def self.construct(name)
  new(name: name.to_s, source: CONSTRUCT)
end

.envelope(name) ⇒ Object



51
52
53
# File 'lib/rigor/effects/origin.rb', line 51

def self.envelope(name)
  new(name: name.to_s, source: ENVELOPE)
end

.plugin(name) ⇒ Object



55
56
57
# File 'lib/rigor/effects/origin.rb', line 55

def self.plugin(name)
  new(name: name.to_s, source: PLUGIN)
end

Instance Method Details

#to_sObject

The rendering the report and the JSON payload key on. Sorted lexicographically, so catalogue: rows group before construct: ones and the output is deterministic.



61
62
63
# File 'lib/rigor/effects/origin.rb', line 61

def to_s
  "#{source}:#{name}"
end