From 377c69bee8a1cab7ed5e64a0d855e11f6278f32b Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 19:26:26 +0000 Subject: [PATCH 1/2] proof(actions-lock): ledger rows for the closure model; strict binding Review findings on #1026 after it merged: * Codex: the model was recorded only in a hand-written PROOF-STATUS section, not in verification/proof-ledger.jsonl, which is canonical. Two rows now carry it: actions-lock-closure (idris2 lane, proven) and actions-lock-closure-corpus (exunit lane, tested-only, 5 locks, 6 refs). CI derives both statuses from receipts as for any other row. The rendered table and the four quoted censuses are regenerated (34 proven of 55; 12 tested-only). * Codex: the ref numbering accepted two refs sharing a number, so a transcription that merged build and setup into one record passed all 17 tests. The numbering now raises on a reused number or a repeated ref; that mutant fails 10 tests. * CodeRabbit: the fixture parser skipped any line it did not recognise, so a fixture in another style could drop an edge silently. Every line must now match a shape the corpus uses, and a nested ref counts only under its record's uses: key; a double-quoted nested ref fails 2 tests. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01TbbnKqskQA5mj5gfMniPzi --- AFFIRMATION.adoc | 4 +- EXPLAINME.adoc | 6 +- README.adoc | 4 +- .../actions_lock_closure_corpus_test.exs | 65 ++++++++++++++----- verification/PROOF-STATUS.adoc | 19 +++++- verification/proof-ledger.jsonl | 2 + 6 files changed, 76 insertions(+), 24 deletions(-) diff --git a/AFFIRMATION.adoc b/AFFIRMATION.adoc index 7e7e64c4..bfb0a6bd 100644 --- a/AFFIRMATION.adoc +++ b/AFFIRMATION.adoc @@ -27,8 +27,8 @@ state and commitments. Companion detail: model checking, which is `tested-only`, not a proof). What each artefact proves, and how strongly, is the proof ledger (`verification/proof-ledger.jsonl`, rendered in - `verification/PROOF-STATUS.adoc#proof-ledger`): 33 proven of 53; - 0 proven-with-postulates, 11 tested-only, 2 argued, 7 open. Four of the + `verification/PROOF-STATUS.adoc#proof-ledger`): 34 proven of 55; + 0 proven-with-postulates, 12 tested-only, 2 argued, 7 open. Four of the Lean proofs rested on the Lean kernel axioms `propext` and `Quot.sound`, which a source scan does not see and `Lean.collectAxioms` does; they moved to Idris2 on 2026-11-09, which has no such axioms. *Zero escape hatches outside diff --git a/EXPLAINME.adoc b/EXPLAINME.adoc index d7241a9f..6ee2b396 100644 --- a/EXPLAINME.adoc +++ b/EXPLAINME.adoc @@ -97,8 +97,8 @@ ____ safety-triangle routing, dispatch thresholds, quarantine, rollback, the Bayesian update and rate limiting), one Agda model of the Logtalk-to-Elixir migration, and a TLA+ model of the Kin gate that is model-checked on a bounded instance. The proofs are about models of - the code, not the Elixir runtime itself. Proof ledger: 33 proven of 53; 0 proven-with-postulates, - 11 tested-only, 2 argued, 7 open + the code, not the Elixir runtime itself. Proof ledger: 34 proven of 55; 0 proven-with-postulates, + 12 tested-only, 2 argued, 7 open ____ How this is implemented:: @@ -292,7 +292,7 @@ Census, from `scripts/proof-ledger.sh check`: [source,text] ---- -33 proven of 53; 0 proven-with-postulates, 11 tested-only, 2 argued, 7 open. +34 proven of 55; 0 proven-with-postulates, 12 tested-only, 2 argued, 7 open. ---- Of the three theory rows, `logtalk-migration` is `PWG-3`; diff --git a/README.adoc b/README.adoc index 31854362..1d20b949 100644 --- a/README.adoc +++ b/README.adoc @@ -29,8 +29,8 @@ It combines: safety-triangle routing, dispatch thresholds, quarantine, rollback, the Bayesian update and rate limiting), one Agda model of the Logtalk-to-Elixir migration, and a TLA+ model of the Kin gate that is model-checked on a bounded instance. The proofs are about models of - the code, not the Elixir runtime itself. Proof ledger: 33 proven of 53; 0 proven-with-postulates, - 11 tested-only, 2 argued, 7 open (link:EXPLAINME.adoc#proof-ledger[details]) + the code, not the Elixir runtime itself. Proof ledger: 34 proven of 55; 0 proven-with-postulates, + 12 tested-only, 2 argued, 7 open (link:EXPLAINME.adoc#proof-ledger[details]) === Core philosophy diff --git a/test/rules/actions_lock_closure_corpus_test.exs b/test/rules/actions_lock_closure_corpus_test.exs index 0ff7f1ea..f111262a 100644 --- a/test/rules/actions_lock_closure_corpus_test.exs +++ b/test/rules/actions_lock_closure_corpus_test.exs @@ -92,9 +92,20 @@ defmodule Hypatia.Rules.ActionsLockClosureCorpusTest do end # `-- N owner/repo@ref`: the model's ref numbering, keyed after the fold. + # Two refs sharing a number, or one ref listed twice, would let the model + # merge distinct records while every equation still held, so both raise. defp model_numbering(src) do - Regex.scan(~r/^--\s+(\d+)\s+(\S+@\S+)\s*$/m, src) - |> Map.new(fn [_, n, ref] -> {ActionsLock.normalise_ref(ref), String.to_integer(n)} end) + pairs = + Regex.scan(~r/^--\s+(\d+)\s+(\S+@\S+)\s*$/m, src) + |> Enum.map(fn [_, n, ref] -> {ActionsLock.normalise_ref(ref), String.to_integer(n)} end) + + {refs, numbers} = Enum.unzip(pairs) + if refs != Enum.uniq(refs), do: raise("model numbering lists a ref twice: #{inspect(refs)}") + + if numbers != Enum.uniq(numbers), + do: raise("model numbering reuses a number: #{inspect(numbers)}") + + Map.new(pairs) end # `-- corpus: ` @@ -125,34 +136,58 @@ defmodule Hypatia.Rules.ActionsLockClosureCorpusTest do # The edges a fixture names: every quoted ref under workflows:, and each # dependency record with its nested uses:, mapped through the numbering. + # The corpus has one layout, and every line must match one of its shapes; + # any other line raises, so a fixture written in another style cannot drop + # an edge from this comparison without failing it. A nested ref counts only + # under its record's `uses:` key. defp lock_edges(content, numbering) do id = &Map.fetch!(numbering, ActionsLock.normalise_ref(&1)) + field = ~r/^ (ref|commit|hostname): '[^']*'$|^ (owner_id|repo_id): \d+$/ - {_section, _key, refs, records} = + {_state, refs, records} = content |> String.split("\n") - |> Enum.reduce({nil, nil, [], %{}}, fn line, {section, key, refs, records} -> + |> Enum.reduce({:top, [], %{}}, fn line, {state, refs, records} -> cond do + line == "" or String.starts_with?(line, "#") -> + {state, refs, records} + + Regex.match?(~r/^version: '[^']+'$/, line) -> + {:top, refs, records} + line == "workflows:" -> - {:workflows, nil, refs, records} + {:workflows, refs, records} line == "dependencies:" -> - {:dependencies, nil, refs, records} + {:dependencies, refs, records} - section == :workflows and Regex.match?(~r/^\s+- '/, line) -> - [_, ref] = Regex.run(~r/^\s+- '([^']+)'$/, line) - {section, key, [id.(ref) | refs], records} + state == :workflows and Regex.match?(~r/^ '[^']+':( \[\])?$/, line) -> + {state, refs, records} - section == :dependencies and Regex.match?(~r/^ '[^']+':$/, line) -> + state == :workflows and Regex.match?(~r/^ - '[^']+'$/, line) -> + [_, ref] = Regex.run(~r/^ - '([^']+)'$/, line) + {state, [id.(ref) | refs], records} + + state != :workflows and state != :top and Regex.match?(~r/^ '[^']+':$/, line) -> [_, ref] = Regex.run(~r/^ '([^']+)':$/, line) - {section, id.(ref), refs, Map.put(records, id.(ref), [])} + {{:record, id.(ref)}, refs, Map.put(records, id.(ref), [])} + + match?({:record, _}, state) and Regex.match?(field, line) -> + {state, refs, records} + + match?({:record, _}, state) and line == " uses:" -> + {{:uses, elem(state, 1)}, refs, records} + + match?({:uses, _}, state) and Regex.match?(~r/^ - '[^']+'$/, line) -> + {:uses, key} = state + [_, ref] = Regex.run(~r/^ - '([^']+)'$/, line) + {state, refs, Map.update!(records, key, &Enum.sort([id.(ref) | &1]))} - section == :dependencies and Regex.match?(~r/^\s{12}- '/, line) -> - [_, ref] = Regex.run(~r/^\s+- '([^']+)'$/, line) - {section, key, refs, Map.update!(records, key, &Enum.sort([id.(ref) | &1]))} + match?({:uses, _}, state) and Regex.match?(field, line) -> + {{:record, elem(state, 1)}, refs, records} true -> - {section, key, refs, records} + raise "unrecognised line in a closure fixture (state #{inspect(state)}): #{inspect(line)}" end end) diff --git a/verification/PROOF-STATUS.adoc b/verification/PROOF-STATUS.adoc index 0e8b5b6e..8fa4de14 100644 --- a/verification/PROOF-STATUS.adoc +++ b/verification/PROOF-STATUS.adoc @@ -60,7 +60,7 @@ receipts (`+scripts/proof-ledger.sh derive+`) and fails on an overclaim or a stale underclaim. Checked against PROOF-POLICY as pinned by `+metadatastician/standards 3-practice/PROOF-POLICY.adoc b8f60511e76c9015d86990317162dce653c92fe1+`. -*Census:* 33 proven of 53; 0 proven-with-postulates, 11 tested-only, 2 argued, 7 open. Theory rows: 3 (PWG-1 0, PWG-2ii 0, PWG-2i 0, PWG-3 1, ungraded 2). +*Census:* 34 proven of 55; 0 proven-with-postulates, 12 tested-only, 2 argued, 7 open. Theory rows: 3 (PWG-1 0, PWG-2ii 0, PWG-2i 0, PWG-3 1, ungraded 2). [cols="3,1,2,2,2",options="header"] |=== @@ -132,6 +132,12 @@ Checked against PROOF-POLICY as pinned by `+metadatastician/standards 3-practice |`+verification/proofs/idris2/VerisimdbConnector.idr+`: `+cleanFindingCompleteness+`, `+cleanFindingSoundness+`, `+factPreservesData+`, `+parseSeverityTotal+` |Over the Idris2 records; lib/verisim_connector.ex is not shown to follow them +|An actions.lock is closed exactly when its dangling list is empty; that list is sound and complete, closure is decidable, and each shared closure-corpus row has the verdict and dangling refs expected.tsv gives it (standards#963) +|proven +|Idris2 0.7.0, idris2 --check (--total) +|`+verification/proofs/idris2/ActionsLockClosure.idr+`: `+closedIffNoDangling+`, `+danglingSound+`, `+danglingComplete+`, `+decClosed+`, `+rowClosedV00x+`, `+rowClosedCaseVariant+`, `+rowDanglingNested+`, `+rowDanglingWorkflowRef+` +|Over the Idris2 model; lib/rules/actions_lock.ex and standards scripts/close-lock.sh agree with it on the corpus only (row actions-lock-closure-corpus), and the owner/repo fold happens before the model + |Quarantine triggers, release and routing blockage behave as specified (P5) |proven |Idris2 0.7.0, idris2 --check (--total) @@ -294,6 +300,12 @@ Checked against PROOF-POLICY as pinned by `+metadatastician/standards 3-practice |`+test/security_errors_test.exs+`: `+SecurityErrors+` |Example-based; the transcription into the Agda table is not itself checked. Bounds: ExUnit cases over the migrated alert types +|ActionsLock.parse/1 reproduces every expected.tsv row of the shared closure corpus, and the Idris2 model transcribes every fixture and states every row +|tested-only +|ExUnit (mix test) +|`+test/rules/actions_lock_closure_corpus_test.exs+`: `+ActionsLockClosureCorpusTest+` +|The corpus only; standards close-lock-test.sh replays the same byte-identical corpus against close-lock.sh. Bounds: 5 corpus locks, 6 refs, lockfile versions v0.0.2 and v0.0.3 + |Damped PageRank iteration converges to a unique stationary vector |open, ungraded |- @@ -509,7 +521,10 @@ standards#963). `+scripts/close-lock.sh --check+` in hyperpolymath/standards is a second implementation. The two share a five-row corpus, `+test/fixtures/actions_lock/closure/+`, which is byte-identical to standards' `+scripts/tests/fixtures/actions-lock-closure/+`. This is an engineering -proof, so it carries §5 tokens only and no PWG. +proof, so it carries §5 tokens only and no PWG. The canonical record is +two rows of <>: `actions-lock-closure` (the model, proven) and +`actions-lock-closure-corpus` (the corpus test, tested-only). This section +explains them; where it and the ledger differ, the ledger wins. [width="100%",cols="28%,14%,42%,16%",options="header",] |=== diff --git a/verification/proof-ledger.jsonl b/verification/proof-ledger.jsonl index 7b070bca..40564076 100644 --- a/verification/proof-ledger.jsonl +++ b/verification/proof-ledger.jsonl @@ -9,6 +9,7 @@ {"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/SafetyTriangle.idr","id":"safety-triangle","kind":"engineering","lane":"idris2","names":["tierGTIrreflexive","tierGTAsymmetric","tierGTTransitive","tierTrichotomy","eliminateAlwaysChosen"],"obligation":"Tiers form a strict total order and routing picks the highest available tier (P2)","status":"proven","trust_boundary":"Over the Idris2 model; the Elixir TriangleRouter is not shown to follow it"} {"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/DispatchStrategy.idr","id":"dispatch-strategy","kind":"engineering","lane":"idris2","names":["highConfidenceIsAuto","midConfidenceIsReview","lowConfidenceIsReport"],"obligation":"Confidence maps monotonically to dispatch strategy at the 95/85 boundaries; nascent recipes never auto-execute (P3)","status":"proven","trust_boundary":"Over integer percentages; the Elixir FleetDispatcher is not shown to follow it"} {"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/VerisimdbConnector.idr","id":"verisimdb-connector","kind":"engineering","lane":"idris2","names":["cleanFindingCompleteness","cleanFindingSoundness","factPreservesData","parseSeverityTotal"],"obligation":"Raw records with every mandatory field parse, records missing one are rejected, and projection to FindingFact keeps repo, file, category and severity (P4; statement superseded 2026-11-01)","status":"proven","trust_boundary":"Over the Idris2 records; lib/verisim_connector.ex is not shown to follow them"} +{"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/ActionsLockClosure.idr","id":"actions-lock-closure","kind":"engineering","lane":"idris2","names":["closedIffNoDangling","danglingSound","danglingComplete","decClosed","rowClosedV00x","rowClosedCaseVariant","rowDanglingNested","rowDanglingWorkflowRef"],"obligation":"An actions.lock is closed exactly when its dangling list is empty; that list is sound and complete, closure is decidable, and each shared closure-corpus row has the verdict and dangling refs expected.tsv gives it (standards#963)","status":"proven","trust_boundary":"Over the Idris2 model; lib/rules/actions_lock.ex and standards scripts/close-lock.sh agree with it on the corpus only (row actions-lock-closure-corpus), and the owner/repo fold happens before the model"} {"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/Quarantine.idr","id":"quarantine","kind":"engineering","lane":"idris2","names":["failuresTriggerHard","highFPTriggersSoft","releaseRestoresOk","hardQuarantineBlocksAuto"],"obligation":"Quarantine triggers, release and routing blockage behave as specified (P5)","status":"proven","trust_boundary":"Over the Idris2 model; lib/safety/quarantine.ex is not called by any dispatch path (CLAUDE.md Known Gap 2)"} {"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/BatchRollback.idr","id":"batch-rollback","kind":"engineering","lane":"idris2","names":["rollbackRestoresOriginal","reversibility","batchIsTransactional"],"obligation":"Batch execution is all-or-nothing and rollback restores the original snapshot (P6)","status":"proven","trust_boundary":"Over the Idris2 model; lib/safety/batch_rollback.ex is not called by any dispatch path"} {"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/NeuralConsensus.idr","id":"neural-consensus","kind":"engineering","lane":"idris2","names":["sumPredsBounded","aggregateInBounds","minLteLeft"],"obligation":"Uniform-mean aggregation of n predictions stays in [0,1] and above n times the minimum (H9)","status":"proven","trust_boundary":"Over natural-number predictions; the Elixir coordinator's floats are not modelled"} @@ -36,6 +37,7 @@ {"axioms":[],"bounds":"3 bots x 2 repos, MaxRequests = 4: 444715 distinct states, depth 13, no error","checker":"TLC 2.19 (rev 5a47802), -workers auto -config KinGate.cfg","file":"verification/proofs/tlaplus/KinGate.tla","id":"kin-gate","kind":"engineering","lane":"tlc","names":["KinGateSafe","MutualExclusionByType","MutualExclusionBotView","ViewCoherentWithLocks","NoOrphanView","GrantsAreWellBracketed","EveryRequestProcessed"],"obligation":"Kin-gate atomicity: mutual exclusion by type and in the bot view, view coherent with locks, no orphan view, well-bracketed grants, and every request processed (H8)","status":"tested-only","trust_boundary":"One bounded instance; the Elixir kin gate is not shown to follow the spec"} {"axioms":[],"bounds":"","checker":"Agda 2.8.0.2, builtins only, --safe --without-K --cubical-compatible","file":"verification/proofs/agda/LogtalkMigration.agda","foundation_diverse":false,"id":"logtalk-migration","kind":"theory","lane":"agda","legs":[],"names":["categoriesAgree","severitiesAgree","autoFixableAgrees","fixPresenceAgrees","preventionAgreesToken","preventionAgreesPinned","preventionAgreesMissing","preventionAgreesHardCoded","preventionAgreesVulnerabilities","preventionAgreesSecurityPolicy","preventionBranchSource","preventionBranchTarget","preventionCodeReviewSource","preventionCodeReviewTarget"],"obligation":"The 18 transcribed alert types agree between security_learning.lgt and Hypatia.Rules.SecurityErrors on category, severity, auto-fixability and fix presence; prevention agrees except the two ledgered non-equalities","pwg":"3","status":"proven","trust_boundary":"The finite table as transcribed; fix strings and Elixir runtime behaviour are outside the model. No Rocq or Lean leg yet"} {"axioms":[],"bounds":"ExUnit cases over the migrated alert types","checker":"ExUnit (mix test)","file":"test/security_errors_test.exs","id":"logtalk-runtime","kind":"engineering","lane":"exunit","names":["SecurityErrors"],"obligation":"Hypatia.Rules.SecurityErrors at runtime follows the table the Agda model states","status":"tested-only","trust_boundary":"Example-based; the transcription into the Agda table is not itself checked"} +{"axioms":[],"bounds":"5 corpus locks, 6 refs, lockfile versions v0.0.2 and v0.0.3","checker":"ExUnit (mix test)","file":"test/rules/actions_lock_closure_corpus_test.exs","id":"actions-lock-closure-corpus","kind":"engineering","lane":"exunit","names":["ActionsLockClosureCorpusTest"],"obligation":"ActionsLock.parse/1 reproduces every expected.tsv row of the shared closure corpus, and the Idris2 model transcribes every fixture and states every row","status":"tested-only","trust_boundary":"The corpus only; standards close-lock-test.sh replays the same byte-identical corpus against close-lock.sh"} {"axioms":[],"bounds":"","checker":"-","file":"-","foundation_diverse":false,"id":"pagerank-convergence","kind":"theory","lane":"none","legs":[],"names":[],"obligation":"Damped PageRank iteration converges to a unique stationary vector","pwg":"ungraded","status":"open","trust_boundary":"Not stated in any prover. Agda statement first (PROOF-POLICY section 2), over constructive reals, then Rocq and Lean legs; no Mathlib"} {"axioms":[],"bounds":"","checker":"-","file":"-","foundation_diverse":false,"id":"esn-echo-state","kind":"theory","lane":"none","legs":[],"names":[],"obligation":"With leak rate 0 < a <= 1 and the reservoir scaled to infinity-norm at most 0.95, two state trajectories under the same input converge geometrically (echo-state property), and [-1,1]^n is invariant","pwg":"ungraded","status":"open","trust_boundary":"Not stated in any prover. Agda statement first (PROOF-POLICY section 2), over constructive reals, then Rocq and Lean legs; no Mathlib. The runtime scales by the induced infinity-norm, not the spectral radius"} {"axioms":[],"bounds":"","checker":"-","file":"-","id":"models-runtime-refinement","kind":"engineering","lane":"none","names":[],"obligation":"The Elixir runtime follows the Idris2 and TLA+ models above","status":"open","trust_boundary":"No correspondence evidence beyond the rows that name a runtime test; a model row proves its model only (README-EXPLAINME section 5 rule 3)"} From 10fe9b388eafe41b69be9ebd2f5ee0bea5786112 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 16 Nov 2026 20:01:41 +0000 Subject: [PATCH 2/2] proof(actions-lock): proven row claims the model only; reject duplicate records Codex review on #1187: * The proven row said each corpus row has the verdict expected.tsv gives it. Idris2 proves equations over the model's own constants; agreement with the fixtures and expected.tsv is what the tested-only row actions-lock-closure-corpus establishes. The proven row now claims only that each transcribed row evaluates to its stated dangling list and names the tested row for the rest. * model_lock/2 built a map, so a record key listed twice in the model vanished: closedV00x with (1, [1]), (1, [2]), (2, []) passed all 17 tests. A repeated key, or record text the pattern does not match, now raises, and so does a fixture that lists a record twice. That mutant now fails 2 tests. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01TbbnKqskQA5mj5gfMniPzi --- .../actions_lock_closure_corpus_test.exs | 21 +++++++++++++++---- verification/PROOF-STATUS.adoc | 2 +- verification/proof-ledger.jsonl | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/test/rules/actions_lock_closure_corpus_test.exs b/test/rules/actions_lock_closure_corpus_test.exs index f111262a..48ae89df 100644 --- a/test/rules/actions_lock_closure_corpus_test.exs +++ b/test/rules/actions_lock_closure_corpus_test.exs @@ -115,14 +115,23 @@ defmodule Hypatia.Rules.ActionsLockClosureCorpusTest do end # ` = MkLock [w, ...] [(k, [u, ...]), ...]` + # A record the pattern does not match, or a key listed twice, would vanish + # from the map below while the row's equation still held, so both raise. defp model_lock(src, row) do [_, wf, recs] = Regex.run(~r/^#{row} = MkLock \[([\d, ]*)\] \[(.*)\]\s*$/m, src) + record = ~r/\((\d+), \[([\d, ]*)\]\)/ - records = - Regex.scan(~r/\((\d+), \[([\d, ]*)\]\)/, recs) - |> Map.new(fn [_, k, uses] -> {String.to_integer(k), uses |> nats() |> Enum.sort()} end) + leftover = record |> Regex.replace(recs, "") |> String.replace(",", "") |> String.trim() + if leftover != "", do: raise("#{row}: unparsed text in its records: #{inspect(leftover)}") - {nats(wf), records} + pairs = + Regex.scan(record, recs) + |> Enum.map(fn [_, k, uses] -> {String.to_integer(k), uses |> nats() |> Enum.sort()} end) + + keys = Enum.map(pairs, &elem(&1, 0)) + if keys != Enum.uniq(keys), do: raise("#{row}: a record key appears twice: #{inspect(keys)}") + + {nats(wf), Map.new(pairs)} end # `row : danglingOf ActionsLockClosure. = [n, ...]` @@ -170,6 +179,10 @@ defmodule Hypatia.Rules.ActionsLockClosureCorpusTest do state != :workflows and state != :top and Regex.match?(~r/^ '[^']+':$/, line) -> [_, ref] = Regex.run(~r/^ '([^']+)':$/, line) + + if Map.has_key?(records, id.(ref)), + do: raise("a closure fixture lists the record #{ref} twice") + {{:record, id.(ref)}, refs, Map.put(records, id.(ref), [])} match?({:record, _}, state) and Regex.match?(field, line) -> diff --git a/verification/PROOF-STATUS.adoc b/verification/PROOF-STATUS.adoc index de97a65e..122d52c2 100644 --- a/verification/PROOF-STATUS.adoc +++ b/verification/PROOF-STATUS.adoc @@ -132,7 +132,7 @@ Checked against PROOF-POLICY as pinned by `+metadatastician/standards 3-practice |`+verification/proofs/idris2/VerisimdbConnector.idr+`: `+cleanFindingCompleteness+`, `+cleanFindingSoundness+`, `+factPreservesData+`, `+parseSeverityTotal+` |Over the Idris2 records; lib/verisim_connector.ex is not shown to follow them -|An actions.lock is closed exactly when its dangling list is empty; that list is sound and complete, closure is decidable, and each shared closure-corpus row has the verdict and dangling refs expected.tsv gives it (standards#963) +|An actions.lock is closed exactly when its dangling list is empty; that list is sound and complete, closure is decidable, and each of the four corpus rows transcribed into the model evaluates to the dangling list stated for it (standards#963). That those rows and lists match the fixtures and expected.tsv is the tested-only row actions-lock-closure-corpus |proven |Idris2 0.7.0, idris2 --check (--total) |`+verification/proofs/idris2/ActionsLockClosure.idr+`: `+closedIffNoDangling+`, `+danglingSound+`, `+danglingComplete+`, `+decClosed+`, `+rowClosedV00x+`, `+rowClosedCaseVariant+`, `+rowDanglingNested+`, `+rowDanglingWorkflowRef+` diff --git a/verification/proof-ledger.jsonl b/verification/proof-ledger.jsonl index b4c52d7e..5578ab2b 100644 --- a/verification/proof-ledger.jsonl +++ b/verification/proof-ledger.jsonl @@ -9,7 +9,7 @@ {"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/SafetyTriangle.idr","id":"safety-triangle","kind":"engineering","lane":"idris2","names":["tierGTIrreflexive","tierGTAsymmetric","tierGTTransitive","tierTrichotomy","eliminateAlwaysChosen"],"obligation":"Tiers form a strict total order and routing picks the highest available tier (P2)","status":"proven","trust_boundary":"Over the Idris2 model; the Elixir TriangleRouter is not shown to follow it"} {"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/DispatchStrategy.idr","id":"dispatch-strategy","kind":"engineering","lane":"idris2","names":["highConfidenceIsAuto","midConfidenceIsReview","lowConfidenceIsReport"],"obligation":"Confidence maps monotonically to dispatch strategy at the 95/85 boundaries; nascent recipes never auto-execute (P3)","status":"proven","trust_boundary":"Over integer percentages; the Elixir FleetDispatcher is not shown to follow it"} {"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/VerisimdbConnector.idr","id":"verisimdb-connector","kind":"engineering","lane":"idris2","names":["cleanFindingCompleteness","cleanFindingSoundness","factPreservesData","parseSeverityTotal"],"obligation":"Raw records with every mandatory field parse, records missing one are rejected, and projection to FindingFact keeps repo, file, category and severity (P4; statement superseded 2026-11-01)","status":"proven","trust_boundary":"Over the Idris2 records; lib/verisim_connector.ex is not shown to follow them"} -{"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/ActionsLockClosure.idr","id":"actions-lock-closure","kind":"engineering","lane":"idris2","names":["closedIffNoDangling","danglingSound","danglingComplete","decClosed","rowClosedV00x","rowClosedCaseVariant","rowDanglingNested","rowDanglingWorkflowRef"],"obligation":"An actions.lock is closed exactly when its dangling list is empty; that list is sound and complete, closure is decidable, and each shared closure-corpus row has the verdict and dangling refs expected.tsv gives it (standards#963)","status":"proven","trust_boundary":"Over the Idris2 model; lib/rules/actions_lock.ex and standards scripts/close-lock.sh agree with it on the corpus only (row actions-lock-closure-corpus), and the owner/repo fold happens before the model"} +{"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/ActionsLockClosure.idr","id":"actions-lock-closure","kind":"engineering","lane":"idris2","names":["closedIffNoDangling","danglingSound","danglingComplete","decClosed","rowClosedV00x","rowClosedCaseVariant","rowDanglingNested","rowDanglingWorkflowRef"],"obligation":"An actions.lock is closed exactly when its dangling list is empty; that list is sound and complete, closure is decidable, and each of the four corpus rows transcribed into the model evaluates to the dangling list stated for it (standards#963). That those rows and lists match the fixtures and expected.tsv is the tested-only row actions-lock-closure-corpus","status":"proven","trust_boundary":"Over the Idris2 model; lib/rules/actions_lock.ex and standards scripts/close-lock.sh agree with it on the corpus only (row actions-lock-closure-corpus), and the owner/repo fold happens before the model"} {"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/Quarantine.idr","id":"quarantine","kind":"engineering","lane":"idris2","names":["failuresTriggerHard","highFPTriggersSoft","releaseRestoresOk","hardQuarantineBlocksAuto"],"obligation":"Quarantine triggers, release and routing blockage behave as specified (P5)","status":"proven","trust_boundary":"Over the Idris2 model; lib/safety/quarantine.ex is not called by any dispatch path (CLAUDE.md Known Gap 2)"} {"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/BatchRollback.idr","id":"batch-rollback","kind":"engineering","lane":"idris2","names":["batchAllOrNothing","rollbackRestoresOriginal","commitsIffAllSucceed","rollsBackIffSomeStepFails","setStepReversible","repoBatchAllOrNothing"],"obligation":"A batch of reversible steps either commits every step (its result is the sequential application of all of them) or rolls back to exactly the starting state; nothing in between is reachable. The executor journals each successful step's undo and unwinds the journal on failure. For repository content overwrites every step is proved reversible, so that batch is all-or-nothing with no premise (P6)","status":"proven","trust_boundary":"Over the Idris2 executor model. lib/safety/batch_rollback.ex does not run steps: it marks a batch's outcomes and emits one git revert per outcome; that the Elixir module follows this discipline, and that git revert inverts a change (the Reversible premise), are ASSUMED"} {"axioms":[],"bounds":"","checker":"Idris2 0.7.0, idris2 --check (--total)","file":"verification/proofs/idris2/NeuralConsensus.idr","id":"neural-consensus","kind":"engineering","lane":"idris2","names":["sumPredsBounded","aggregateInBounds","minLteLeft"],"obligation":"Uniform-mean aggregation of n predictions stays in [0,1] and above n times the minimum (H9)","status":"proven","trust_boundary":"Over natural-number predictions; the Elixir coordinator's floats are not modelled"}