From 55e290c5038b39420bce308cc0b3c31e9f780886 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Sun, 17 May 2026 02:42:31 +0100 Subject: [PATCH] fix(validate-a2ml): recognise clade- and anchor-shape A2ML doc types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The identity check only matched TOML `agent-id|name|project = ...`, so two legitimate, differently-shaped A2ML doc types produced false-positive "Missing required identity field" errors: - Clade files (CLADE.a2ml): gv-clade-index registry declarations whose identity is the registry uuid + `canonical-name` under `[identity]` plus a `[clade]` assignment. - Anchor files (ANCHOR.a2ml): YAML-flavoured, identity is the reverse-DNS `id:` value using `key: value` (never TOML `key = value`); forcing a `name =` line in would corrupt the YAML. Both are now detected structurally and exempted, mirroring the existing 6a2-manifest and contractile-shape carve-outs (hypatia#243: a validator that scans content patterns must distinguish a target file from a legitimately differently-shaped one). The change is strictly a relaxation — it can only clear false positives, never introduce errors. Refs hyperpolymath/neurophone#41 Co-Authored-By: Claude Opus 4.7 (1M context) --- validate-a2ml.sh | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/validate-a2ml.sh b/validate-a2ml.sh index bbbebc3..ea03642 100755 --- a/validate-a2ml.sh +++ b/validate-a2ml.sh @@ -173,12 +173,36 @@ validate_a2ml() { is_contractile_shape=true fi - if [[ "$has_identity" == "false" && "$is_manifest" == "false" && "$is_contractile_shape" == "false" ]]; then + # Clade-shape A2ML files (CLADE.a2ml) are gv-clade-index registry + # declarations. Their identity is the registry uuid + `canonical-name` + # under an `[identity]` block plus a `[clade]` assignment — not a TOML + # `name = ...` field. The regex above only recognises `name`, so these + # registry-governed files produce a false positive. Same doc-type + # carve-out as 6a2/contractile (hypatia#243): a validator that scans + # content patterns must distinguish a target file from a legitimately + # differently-shaped one. Detected structurally by the `[clade]` section + # or a `canonical-name` field. + local is_clade_shape=false + if grep -qE '^\[clade\][[:space:]]*$|^canonical-name[[:space:]]*=' "$file"; then + is_clade_shape=true + fi + + # Anchor-shape A2ML files (ANCHOR.a2ml) are YAML-flavoured: identity is + # the reverse-DNS `id:` (e.g. `id: "org.hyperpolymath."`) using + # `key: value`, never TOML `key = value`. Forcing a `name =` line into + # them would corrupt the YAML. Detected by the `⚓ ANCHOR` marker or a + # reverse-DNS top-level `id:` value. + local is_anchor_shape=false + if grep -qE '^#[[:space:]]*⚓[[:space:]]*ANCHOR|^id:[[:space:]]*"[a-z][a-z0-9]*(\.[a-z0-9-]+)+"' "$file"; then + is_anchor_shape=true + fi + + if [[ "$has_identity" == "false" && "$is_manifest" == "false" && "$is_contractile_shape" == "false" && "$is_clade_shape" == "false" && "$is_anchor_shape" == "false" ]]; then report_issue "error" "$file" 1 \ "Missing required identity field (agent-id, name, or project)" fi - if [[ "$has_version" == "false" && "$is_manifest" == "false" && "$is_contractile_shape" == "false" ]]; then + if [[ "$has_version" == "false" && "$is_manifest" == "false" && "$is_contractile_shape" == "false" && "$is_clade_shape" == "false" && "$is_anchor_shape" == "false" ]]; then report_issue "warning" "$file" 1 \ "Missing version or schema_version field" fi