Datasets:
Formats:
json
Languages:
English
Size:
< 1K
Tags:
artificial-intelligence
recursive-self-improvement
continual-learning
representation-learning
world-models
cognitive-architecture
File size: 7,307 Bytes
1c1abed | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | #!/usr/bin/env python3
"""Offline release checks; explicit manifest refresh after intentional edits."""
from __future__ import annotations
import argparse
import hashlib
import json
from pathlib import Path
import re
import sys
ROOT = Path(__file__).resolve().parent
IGNORED_DIRS = {".git", ".venv", "venv", "__pycache__", ".pytest_cache", "local_runs", "build", "dist"}
IGNORED_NAMES = {".env", "upload_error.log"}
REQUIRED = ["README.md", "AGENTS.md", "AGENT_CAPABILITIES.json", "RESEARCH_INDEX.json",
"agent_request.schema.json", "agent_interface.py", "CITATION.cff", "STATUS.json",
"docs/CLAIMS.json", "docs/EXPERT_REVIEW.md", "docs/AGENT_SUPPORT.md",
"manuscript/FNE_AXIOMESH_Manuscript.pdf", "src/axiomesh/core.py",
"data/experiment_runs.jsonl", "data/README.md"]
def release_files(root=ROOT):
files = []
for path in root.rglob("*"):
relative = path.relative_to(root)
if any(part in IGNORED_DIRS or part.endswith(".egg-info") for part in relative.parts):
continue
if path.name in IGNORED_NAMES or path.name.startswith(".env."):
continue
if path.suffix.lower() in {".pyc", ".pyo"} or path.is_symlink():
continue
if path.is_file():
files.append(path)
return sorted(files)
def hashes(root=ROOT):
return {p.relative_to(root).as_posix(): hashlib.sha256(p.read_bytes()).hexdigest()
for p in release_files(root) if p.name != "MANIFEST.json"}
def check_manifest(root=ROOT):
obj = json.loads((root / "MANIFEST.json").read_text(encoding="utf-8"))
if obj.get("algorithm") != "sha256" or not isinstance(obj.get("files"), dict):
raise ValueError("invalid release manifest")
problems = []
for name, expected in obj["files"].items():
if not isinstance(name, str) or "\\" in name or Path(name).is_absolute():
raise ValueError("unsafe manifest path")
path = root / name
if not path.resolve().is_relative_to(root.resolve()) or path.is_symlink():
raise ValueError("unsafe manifest path")
if not isinstance(expected, str) or not re.fullmatch(r"[0-9a-f]{64}", expected):
raise ValueError("invalid checksum")
if not path.is_file():
problems.append({"file": name, "problem": "missing"})
elif hashlib.sha256(path.read_bytes()).hexdigest() != expected:
problems.append({"file": name, "problem": "hash mismatch"})
for name in REQUIRED:
if name not in obj["files"]:
problems.append({"file": name, "problem": "not manifest-controlled"})
if problems:
raise ValueError("release integrity failed: " + json.dumps(problems))
return obj
def check_links(root, files):
count = 0
for name in files:
if not name.endswith(".md"):
continue
data = (root / name).read_text(encoding="utf-8")
for target in re.findall(r"\[[^\]\n]+\]\(([^\s)]+)\)", data):
if ":" in target or target.startswith("#"):
continue
target = target.split("#", 1)[0]
if target and not (root / name).parent.joinpath(target).exists():
raise ValueError(f"broken local Markdown link: {name} -> {target}")
count += 1
return count
def check_schemas(root):
from jsonschema import Draft202012Validator
from jsonschema.exceptions import SchemaError, ValidationError
try:
schema = json.loads((root / "agent_request.schema.json").read_text())
Draft202012Validator.check_schema(schema)
validator = Draft202012Validator(schema)
for name in ["agent_recover.json", "agent_revalidate.json", "agent_compile.json"]:
validator.validate(json.loads((root / "examples" / name).read_text()))
except (SchemaError, ValidationError) as exc:
raise ValueError("agent request schema validation failed: " + exc.message) from exc
return 3
def check_navigation(root):
index = json.loads((root / "RESEARCH_INDEX.json").read_text())
capabilities = json.loads((root / "AGENT_CAPABILITIES.json").read_text())
paths = [*index["entrypoints"].values(), *index["evidence"].values(),
index["manuscript"]["pdf"], index["manuscript"]["source"],
capabilities["invocation"]["file"], capabilities["invocation"]["schema"],
*capabilities["routes"].values(), index["hosting"]["data_file"]]
for name in paths:
if not (root / name).is_file():
raise ValueError("missing research-index target: " + name)
return len(paths)
def check_dataset(root):
records = [json.loads(line) for line in (root / "data/experiment_runs.jsonl").read_text().splitlines() if line.strip()]
if len(records) != 5 or len({row["seed"] for row in records}) != 5:
raise ValueError("expected five distinct seeded experiment-summary rows")
for row in records:
source = json.loads((root / row["source_result_file"]).read_text())
learned = source["learned_esre_pipeline"]
if row["seed"] != source["seed"] or row["weave_correct"] != learned["weave_correct"] or row["pooled_baseline_correct"] != learned["conventional_pooled_group_correct"]:
raise ValueError("dataset row differs from its recorded source")
return len(records)
def main(argv=None):
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--refresh-manifest", action="store_true", help="write checksums after intended edits")
parser.add_argument("--schemas", action="store_true", help="validate requests with optional jsonschema")
args = parser.parse_args(argv)
try:
if args.refresh_manifest:
obj = {"version": "0.2.0-hf3-dataset", "source_release": "FNE-AXIOMESH v0.2.0",
"packaging_date": "2026-10-07", "algorithm": "sha256", "files": hashes(),
"note": "Dataset edition with agent and expert support; checksum of this manifest is excluded. Core unchanged. No reuse license selected."}
(ROOT / "MANIFEST.json").write_text(json.dumps(obj, indent=2) + "\n", encoding="utf-8")
manifest = check_manifest()
json_count = 0
for name in manifest["files"]:
if name.endswith(".json"):
json.loads((ROOT / name).read_text(encoding="utf-8"))
json_count += 1
links = check_links(ROOT, manifest["files"])
research_links = check_navigation(ROOT)
dataset_rows = check_dataset(ROOT)
schema_count = check_schemas(ROOT) if args.schemas else 0
print(json.dumps({"status": "passed", "manifest_files": len(manifest["files"]),
"json_files": json_count, "local_links": links,
"research_index_targets": research_links,
"dataset_rows": dataset_rows,
"schema_validated_examples": schema_count,
"scope": "release integrity and structure; not scientific peer review"}))
return 0
except (OSError, ValueError, ImportError) as exc:
print(json.dumps({"status": "error", "detail": str(exc)}))
return 1
if __name__ == "__main__":
raise SystemExit(main())
|