Class: IgniterLang::FragmentRegistryCompatibilityAdapter
- Inherits:
-
Object
- Object
- IgniterLang::FragmentRegistryCompatibilityAdapter
- Defined in:
- lib/igniter_lang/fragment_registry_compatibility_adapter.rb
Constant Summary collapse
- FORMAT_VERSION =
"0.1.0".freeze
- KIND_INPUT =
"fragment_registry_compatibility_adapter_helper_input".freeze
- KIND_RESULT =
"fragment_registry_compatibility_adapter_helper_result".freeze
- SELECTION_RULES =
R146 proof selection rules in priority order. Must match the proof helper_result_shape.json rules_in_order exactly.
[ { presence: "oof", selected: "oof" }, { presence: "temporal", selected: "temporal" }, { presence: "escape", selected: "escape" }, { presence: "stream", selected: "escape" }, # stream → escape (not a direct fragment) { presence: "epistemic", selected: "epistemic" } ].freeze
- DEFAULT_SELECTED =
"core".freeze
Class Method Summary collapse
-
.project(input_hash) ⇒ Hash
Project fragment registry compatibility from an internal input hash.
Class Method Details
.project(input_hash) ⇒ Hash
Project fragment registry compatibility from an internal input hash.
Input hash shape (kind: fragment_registry_compatibility_adapter_helper_input):
contracts[] — array of { contract_ref, declaration_fragment_presence,
current_selected_fragment }
guarded_non_fragments[] — array of { name, classification_kind, selected_fragment }
oof_projection_policy — { primary_semantics, blocked, loadable, capability }
classifier_wiring_authorized — false (must remain false)
source_r144 — { matrix_digest, ... }
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/igniter_lang/fragment_registry_compatibility_adapter.rb', line 60 def self.project(input_hash) contracts = Array(input_hash["contracts"]) guarded_non_fragments = Array(input_hash["guarded_non_fragments"]) oof_projection_policy = input_hash.fetch("oof_projection_policy", {}) r144_source_digest = input_hash.dig("source_r144", "matrix_digest") r144_source_status = input_hash.dig("source_r144", "source_status") || "PASS" rows = contracts.map do |contract| ref = contract["contract_ref"] presence = Array(contract["declaration_fragment_presence"]) current = contract["current_selected_fragment"] selected = select_fragment(presence) parity = selected == current ? "PASS" : "MISMATCH" { "contract_ref" => ref, "declaration_fragment_presence" => presence, "current_selected_fragment" => current, "selected_fragment" => selected, "parity" => parity } end mismatches = rows.select { |r| r["parity"] == "MISMATCH" } r144_preserved = mismatches.empty? { "kind" => KIND_RESULT, "format_version" => FORMAT_VERSION, "selected_fragment_projection" => { "rows" => rows, "mismatches" => mismatches, "rules_in_order" => rules_in_order_description }, "guarded_non_fragments" => guarded_non_fragments, "oof_projection_policy" => oof_projection_policy, "r144_parity" => { "preserved" => r144_preserved, "source_digest" => r144_source_digest, "source_status" => r144_source_status }, "held_live_dispatch" => true, "classifier_wiring_authorized" => false } end |