Module: Hecks::Adapters::PostgresEra::LineageManager

Extended by:
CoverageCheck, EraResolver, MergeCoordinator, Minter
Defined in:
lib/hecks/adapters/driven/postgres_era/lineage_manager.rb,
lib/hecks/adapters/driven/postgres_era/lineage_manager/minter.rb,
lib/hecks/adapters/driven/postgres_era/lineage_manager/era_resolver.rb,
lib/hecks/adapters/driven/postgres_era/lineage_manager/coverage_check.rb,
lib/hecks/adapters/driven/postgres_era/lineage_manager/merge_coordinator.rb

Overview

The PostgresEra side of the boot-time era gate. Where every other adapter's era check can only hold texts and refuse, this one ACTS: a drifted shape whose translation edge exists, matches by shape label, covers the whole diff, and passes the audit mints the next era — one transaction — and boots into it. Everything else refuses, as loudly and as specifically as the situation allows, naming both authoring tools.

Minting happens here, once: era identity (SHA-256 of the canonical storage-shape serialization; the short prefix is the label edges and refusals use) is computed at mint time and stored in hecks_eras. Everything else reads stored names and never hashes anything — an era name is a storage fact, minted on this path or absent, never reconstructed.

One concern per file under lineage_manager/: era_resolver (which era is this boot?), minter (the mint path and its refusals), merge_coordinator (bin/merge_tail's driver), coverage_check (what a mint must prove first). What stays here is what they share: the edge chain, and the shadow parse.

Defined Under Namespace

Modules: CoverageCheck, EraResolver, MergeCoordinator, Minter

Class Method Summary collapse

Methods included from EraResolver

check!

Methods included from Minter

ensure_named!, mint!, refuse_toward_the_scaffold!, scaffold!

Methods included from MergeCoordinator

merge!

Methods included from CoverageCheck

audit!, check_coverage!, check_identity_unchanged!

Class Method Details

.edge_chain(registry, bluebook, eras, current_label) ⇒ Object

The FULL chain, one edge per step in original mint order — never flattened. Each step is found by its stored labels; every mint required its own edge, so a break in the chain is a deleted file, and deserves its own refusal.



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/hecks/adapters/driven/postgres_era/lineage_manager.rb', line 45

def edge_chain(registry, bluebook, eras, current_label)
  labels = eras.map { |era| era[:label] } + [current_label]
  (0...(labels.size - 1)).map do |index|
    step = registry.translations.find do |t|
      t.domain == bluebook.name && t.from == labels[index] && t.to == labels[index + 1]
    end
    unless step
      raise Runtime::WiringError,
            "cannot boot #{bluebook.name}: the edge chain is broken at era #{index + 1} — no translation " \
            "leads #{labels[index]} to #{labels[index + 1]}; restore bluebook/translations/"
    end
    { translation: step }
  end
end

.shadow(source) ⇒ Object

Held texts live in rows, not files, but the predicate extractor reads source from disk at the eval path — so a shadow parse writes the text to a scratch file first.



63
64
65
66
67
68
69
70
# File 'lib/hecks/adapters/driven/postgres_era/lineage_manager.rb', line 63

def shadow(source)
  file = Tempfile.new(["hecks-era-", ".bluebook"])
  file.write(source)
  file.flush
  Runtime::EraGuard.shadow_parse(source, file.path)
ensure
  file&.close!
end