diff --git a/docs/DEBT-REGISTER.adoc b/docs/DEBT-REGISTER.adoc index a68b5651..7d42d0a7 100644 --- a/docs/DEBT-REGISTER.adoc +++ b/docs/DEBT-REGISTER.adoc @@ -485,7 +485,16 @@ yields `+"X"+`); `+docs/api/cli-reference.adoc+` documents six commands === 8. Machine-readable / metadata debt -==== M-1 · HIGH · The descriptiles set is in the wrong directory per Hypatia’s own oracle · UNTRACKED +==== M-1 · HIGH · The descriptiles set is in the wrong directory per Hypatia’s own oracle · superseded 2026-11-14 + +_Superseded._ The descriptiles are no longer files: the A2ML migration moved +them into `+hypatia_chora.deed+` clauses, and the oracle reads those first, +with the `+.a2ml+` as the fallback (A7 M5): 3.1.2-3.1.9 by clause, 3.1.1 by +the deed carrying any descriptile clause, and 3.2.1 by every carrier parsing, +the deed first. Against the bundled criteria hypatia now fails 1.2.4, 2.1.4, +2.2.1, 3.1.8 (no `+(anchor)+` clause: the source anchor had no `+authority+`) +and 3.2.2 (no `+(rsr-profile)+` clause). The record below is the 2026-08 +state. RSR v2.0 criteria 3.1.1-3.1.9 require `+.machine_readable/descriptiles/+`; the files live in diff --git a/lib/rules/rsr_conformance.ex b/lib/rules/rsr_conformance.ex index 12f8b621..2aed4da2 100644 --- a/lib/rules/rsr_conformance.ex +++ b/lib/rules/rsr_conformance.ex @@ -474,19 +474,37 @@ defmodule Hypatia.Rules.RsrConformance do # (state-v1-decision.adoc, option B, ruled 2026-11-10: the one lifecycle # claim is the (status) clause, and the journal is not translated). # - # A2ML is retired, so the deed is the successor and the .a2ml the transition - # form; 2.3.1 accepts its two carriers the same way. The deed must parse - # (Hypatia.Deed is the reader that agrees with the standards gate): a deed - # that does not parse declares nothing, and a clause nested inside another - # clause is not the descriptile. + # A2ML is retired, so the deed is the successor and is read first; the + # .a2ml is the fallback a shared reader keeps until its callers migrate + # (standards A7 M5 to M7, "new input first"); 2.3.1 accepts its two + # carriers the same way. The deed must parse (Hypatia.Deed is the reader + # that agrees with the standards gate): a deed that does not parse declares + # nothing, and a clause nested inside another clause is not the descriptile. defp descriptile(name, clause) do a2ml = descriptile(name) fn repo -> - case a2ml.(repo) do - :pass -> :pass - _ -> if deed_clause?(repo, clause), do: :pass, else: :fail - end + if deed_clause?(repo, clause), do: :pass, else: a2ml.(repo) + end + end + + # The top-level chora-deed clauses that carry a descriptile family, one per + # criterion 3.1.2-3.1.9 (the mapping specs above; (anchor) by A7 ruling S1). + @descriptile_clauses ~w(status meta ecosystem agentic neurosym playbook anchor clade) + + # 3.1.1: the descriptile substrate. The criterion names the directory + # `.machine_readable/descriptiles/`, which was the only carrier while the + # descriptiles were .a2ml files. A repo that has moved them into its chora + # deed has the substrate there: deed first, the chora deed parses and + # carries at least one top-level descriptile clause; then the directory, + # which still counts (the legacy .a2ml home, and where standards A7 7.1 puts + # the ALL-CAPS descriptile deeds). A deed with none of the clauses, or with + # them only nested, is not the substrate, and nothing at all is :fail. + defp descriptile_carrier do + dir = present_mr("descriptiles") + + fn repo -> + if Enum.any?(@descriptile_clauses, &deed_clause?(repo, &1)), do: :pass, else: dir.(repo) end end @@ -561,11 +579,15 @@ defmodule Hypatia.Rules.RsrConformance do ) record_files = Enum.filter(candidates, &record_dialect?/1) + deed = deed_state(repo) cond do record_files == [] -> if deed_parses?(repo), do: :pass, else: :fail + record_files == [] -> + if deed == :ok, do: :pass, else: :fail + Enum.all?(record_files, fn f -> match?({:ok, _}, with({:ok, t} <- File.read(f), do: RecordDialect.parse(t))) end) -> diff --git a/test/rules/rsr_conformance_test.exs b/test/rules/rsr_conformance_test.exs index 16f2461d..505fa6dd 100644 --- a/test/rules/rsr_conformance_test.exs +++ b/test/rules/rsr_conformance_test.exs @@ -123,8 +123,8 @@ defmodule Hypatia.Rules.RsrConformanceTest do (repo-deed :schema-version "1.0.0" :canonical-name "x" - :repo-uuid #u5"github.com/o/x" - :beholding-chora #u5"estate/chora" + :repo-uuid #u8"chora-registry:github.com/o/x" + :beholding-chora #uuid"00000000-0000-8000-8000-0000000000b1" """ test "a deed-era repo declares its capabilities in (rsr-profile …)", %{tmp_dir: tmp} do @@ -248,8 +248,8 @@ defmodule Hypatia.Rules.RsrConformanceTest do (repo-deed :schema-version "1.0.0" :canonical-name "x" - :repo-uuid #u5"github.com/o/x" - :beholding-chora #u5"estate/chora" + :repo-uuid #u8"chora-registry:github.com/o/x" + :beholding-chora #uuid"00000000-0000-8000-8000-0000000000b1" (rsr-profile :version "1.0.0" :capabilities ("bash"))) """) @@ -267,8 +267,8 @@ defmodule Hypatia.Rules.RsrConformanceTest do (repo-deed :schema-version "1.0.0" :canonical-name "x" - :repo-uuid #u5"github.com/o/x" - :beholding-chora #u5"estate/chora" + :repo-uuid #u8"chora-registry:github.com/o/x" + :beholding-chora #uuid"00000000-0000-8000-8000-0000000000b1" """ mk!(tmp, ".machine_readable/rsr-profile.a2ml", """ @@ -337,8 +337,8 @@ defmodule Hypatia.Rules.RsrConformanceTest do (repo-deed :schema-version "1.0.0" :canonical-name "x" - :repo-uuid #u5"github.com/o/x" - :beholding-chora #u5"estate/chora" + :repo-uuid #u8"chora-registry:github.com/o/x" + :beholding-chora #uuid"00000000-0000-8000-8000-0000000000b1" """ defp agentic_verdicts(tmp) do @@ -447,6 +447,59 @@ defmodule Hypatia.Rules.RsrConformanceTest do assert deed_era_verdicts(tmp)["3.2.1"] == :fail end + # The deed is read first: a broken chora deed fails 3.2.1 even when every + # record-dialect .a2ml left parses, and a valid deed does not excuse a + # malformed .a2ml. + test "3.2.1 needs every carrier to parse, the deed first", %{tmp_dir: tmp} do + mk!(tmp, ".machine_readable/descriptiles/STATE.a2ml", "[metadata]\nversion = \"0.1.0\"\n") + mk!(tmp, "x_chora.deed", @deed_head <> " (meta) ; )\n") + assert deed_era_verdicts(tmp)["3.2.1"] == :fail + + File.write!(Path.join(tmp, "x_chora.deed"), @deed_head <> " (meta))\n") + assert deed_era_verdicts(tmp)["3.2.1"] == :pass + + File.write!( + Path.join(tmp, ".machine_readable/descriptiles/STATE.a2ml"), + "[metadata]\nversion = unquoted-bare-scalar\n" + ) + + assert deed_era_verdicts(tmp)["3.2.1"] == :fail + end + + defp substrate_verdict(tmp) do + {:ok, catalogue} = RsrCriteria.load(@ssot) + {:ok, sc} = RsrConformance.score(catalogue, tmp) + sc.results |> Enum.find(&(&1.id == "3.1.1")) |> Map.fetch!(:verdict) + end + + # 3.1.1 names the descriptiles/ directory. A repo whose descriptiles moved + # into its chora deed has the substrate there (deed first); the directory + # still counts. + test "3.1.1: a chora deed with a top-level descriptile clause is the substrate", %{ + tmp_dir: tmp + } do + for clause <- ~w(status meta ecosystem agentic neurosym playbook anchor clade) do + File.write!(Path.join(tmp, "x_chora.deed"), @deed_head <> " (#{clause}))\n") + assert substrate_verdict(tmp) == :pass, "(#{clause}) should carry 3.1.1" + end + end + + test "3.1.1: a deed with none, or only nested, fails; the directory alone passes", %{ + tmp_dir: tmp + } do + mk!(tmp, "x_chora.deed", @deed_head <> " (identity :owner \"o\"))\n") + assert substrate_verdict(tmp) == :fail + + File.write!(Path.join(tmp, "x_chora.deed"), @deed_head <> " (notes (meta) (status)))\n") + assert substrate_verdict(tmp) == :fail + + File.write!(Path.join(tmp, "x_chora.deed"), @deed_head <> " (meta) ; )\n") + assert substrate_verdict(tmp) == :fail + + File.mkdir_p!(Path.join(tmp, ".machine_readable/descriptiles")) + assert substrate_verdict(tmp) == :pass + end + # 3.1.9 is the ESTATE clade (registers into gv-clade-index), which the # chora deed's (clade) clause carries. In-repo clade organisation (the # subtrees a repo groups its own content into, e.g. boj-server's @@ -555,7 +608,8 @@ defmodule Hypatia.Rules.RsrConformanceTest do # 2026-11-14) and has no descriptiles/ directory, which 3.1.1 still names: # the oracle must report that honestly rather than crash or invent a pass. verdicts = Map.new(sc.results, &{&1.id, &1.verdict}) - assert verdicts["3.1.1"] in [:pass, :fail] + assert verdicts["3.1.1"] == :pass + assert verdicts["3.2.1"] == :pass assert sc.provisional == true end end