Module: Hecks::Translation::Audit
- Extended by:
- ApprovalDigest, LayerOne, LayerTwo, UnfedReport
- Defined in:
- lib/hecks/translation/audit.rb,
lib/hecks/translation/audit/layer_one.rb,
lib/hecks/translation/audit/layer_two.rb,
lib/hecks/translation/audit/unfed_report.rb,
lib/hecks/translation/audit/approval_digest.rb
Overview
The audit derives its assertions; nobody hand-lists them. One file
per layer beside this one: audit/layer_one.rb (the bluebook's own
rules), audit/layer_two.rb (the edge against the reference
transform), audit/unfed_report.rb (what nothing feeds), and
audit/approval_digest.rb (the human gate's binding). Layer 3 — the
before/after sample a HUMAN approves, intent not being derivable —
is assembled right here in check.
Defined Under Namespace
Modules: ApprovalDigest, LayerOne, LayerTwo, UnfedReport Classes: Verdict
Constant Summary collapse
- SAMPLE_SIZE =
5
Class Method Summary collapse
-
.check(aggregate:, declared:, before:, after:) ⇒ Object
aggregate — the CURRENT era's IR; declared — this edge's rules for it (may be nil); before/after — => state hash, source era's latest vs translated.
-
.rekeyed_samples(before, after) ⇒ Object
A rekey changes the id itself, so
before's andafter's keyspaces share nothing — pairing by matching id (the ordinary path above) would show everyafteras nil, telling a human nothing. - .samples_for(declared, before, after) ⇒ Object
Methods included from LayerOne
Methods included from LayerTwo
Methods included from UnfedReport
Methods included from ApprovalDigest
Class Method Details
.check(aggregate:, declared:, before:, after:) ⇒ Object
aggregate — the CURRENT era's IR; declared — this edge's rules for it (may be nil); before/after — => state hash, source era's latest vs translated.
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/hecks/translation/audit.rb', line 34 def check(aggregate:, declared:, before:, after:) violations = [] layer_one!(violations, aggregate, after) layer_two!(violations, aggregate, declared, before, after) Verdict.new( violations: violations, dropped: declared ? declared.drops.map(&:to_s) : [], unfed: unfed(aggregate, declared, after), samples: samples_for(declared, before, after) ) end |
.rekeyed_samples(before, after) ⇒ Object
A rekey changes the id itself, so before's and after's
keyspaces share nothing — pairing by matching id (the ordinary
path above) would show every after as nil, telling a human
nothing. Nothing in-process can compute the old→new
correspondence either (the rekey's SQL is its only
implementation, same as compute's own). Shown side by side
instead, each labelled by its OWN id: real records going in,
real records coming out — not claimed to correspond one-to-one,
but enough for the human this rule's only verification depends
on to actually see real shapes and values, not a wall of null.
64 65 66 67 |
# File 'lib/hecks/translation/audit.rb', line 64 def rekeyed_samples(before, after) before.keys.sort.first(SAMPLE_SIZE).map { |id| { id: "#{id} (before)", before: before[id], after: nil } } + after.keys.sort.first(SAMPLE_SIZE).map { |id| { id: "#{id} (after)", before: nil, after: after[id] } } end |
.samples_for(declared, before, after) ⇒ Object
48 49 50 51 52 |
# File 'lib/hecks/translation/audit.rb', line 48 def samples_for(declared, before, after) return rekeyed_samples(before, after) if declared && !declared.rekeys.empty? before.keys.sort.first(SAMPLE_SIZE).map { |id| { id: id, before: before[id], after: after[id] } } end |