Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/DEBT-REGISTER.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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+`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove 3.1.8 from the documented failure list

The repository's hypatia_chora.deed already contains a valid top-level (anchor) clause with an :authority, and anchor_present/0 recognizes that carrier, so the self-score passes 3.1.8. Listing it among the current failures makes this newly added debt status and its score summary inaccurate.

Useful? React with 👍 / 👎.

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
Expand Down
40 changes: 31 additions & 9 deletions lib/rules/rsr_conformance.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Comment on lines +503 to +507

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Wire 3.1.1 to the deed-aware detector

For every deed-era repository that has a top-level descriptile clause but no legacy descriptiles/ directory, this helper is never called because detectors/0 still maps 3.1.1 to present_mr("descriptiles"). Those repositories therefore continue to receive a false failure for 3.1.1; register descriptile_carrier() as the criterion's detector.

Useful? React with 👍 / 👎.

end
end

Expand Down Expand Up @@ -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
Comment on lines +588 to +589

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Check the deed when legacy record files are present

When at least one record-dialect file exists, both identical record_files == [] conditions are false, so execution only validates the legacy files and never considers the deed state. A repository with a malformed chora deed and a valid remaining .a2ml file consequently passes 3.2.1, contrary to the new every-carrier requirement and the added regression test.

Useful? React with 👍 / 👎.


Enum.all?(record_files, fn f ->
match?({:ok, _}, with({:ok, t} <- File.read(f), do: RecordDialect.parse(t)))
end) ->
Expand Down
72 changes: 63 additions & 9 deletions test/rules/rsr_conformance_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")))
""")

Expand All @@ -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", """
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading