fix: make runtime truth independent of local scratch
This commit is contained in:
@@ -101,6 +101,7 @@ For large architecture or release work, also read:
|
||||
| ERR-068 | PyJHora comparison reports hard-coded `2026-06-03` as generation time, making fresh external benchmark artifacts appear stale and weakening audit traceability. | mitigated 2026-07-15 | `write_report()` records an injected-or-current UTC ISO timestamp; keep the deterministic timestamp regression. |
|
||||
| ERR-069 | Yoga validation tests and helper runner still imported rules from a `.workbuddy` mirror, so full pytest could fail or silently validate a divergent checkout. | mitigated 2026-07-15 | Resolve repo root from each file location; retain runtime-boundary and focused Yoga regressions. |
|
||||
| ERR-070 | PyJHora parity for D2/D4/BAV/SAV can pass while Shadbala total virupas still mismatch, so a row-filled Shadbala oracle packet can be mistaken for absolute-value parity. | active external formula blocker | Keep `docs/research/pyjhora_d2_d4_ashtakavarga_shadbala_parity_2026_07_15.md`; do not claim Shadbala external absolute closure until component-level formulas reconcile with PyJHora/JHora raw values. |
|
||||
| ERR-071 | `runtime-truth` required an untracked `scratch/local/pdf_review_123456` JHora packet, so a clean public checkout failed before it could report the actual external-oracle boundary. | resolved 2026-07-16 | Release truth reads `references/evidence_manifests/jhora_master_evidence_manifest.json`; scratch is optional and may be repaired only through explicit `sync_final_evidence_packet_status.py --sync-local`. Manifest must retain `external_raw_required_for_official_verified=true`. |
|
||||
|
||||
## Fragment Sweep Command Set
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"artifact_id": "jhora_master_evidence",
|
||||
"source_scope": "public_release",
|
||||
"generated_at": "2026-07-16T00:00:00Z",
|
||||
"release_gate": {
|
||||
"local_scratch_required": false,
|
||||
"external_raw_required_for_official_verified": true
|
||||
},
|
||||
"evidence": {
|
||||
"engine": "JHora",
|
||||
"raw_status": "not_collected",
|
||||
"verification_status": "blocked",
|
||||
"reason": "JHora is a desktop oracle. No redistributable raw evidence packet is versioned in the public release."
|
||||
}
|
||||
}
|
||||
@@ -1,31 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Sync latest final JHora evidence packet metadata with its numeric version."""
|
||||
"""Inspect public JHora evidence; optionally repair an explicitly local packet."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
WORK_DIR = ROOT / "scratch" / "local" / "pdf_review_123456"
|
||||
MANIFEST_PATH = ROOT / "references" / "evidence_manifests" / "jhora_master_evidence_manifest.json"
|
||||
LOCAL_EVIDENCE_DIR = ROOT / "scratch" / "local" / "pdf_review_123456"
|
||||
PACKET_RE = re.compile(r"\.v(\d+)\.json$")
|
||||
|
||||
|
||||
def latest_packet() -> tuple[int, Path]:
|
||||
def load_manifest() -> dict:
|
||||
manifest = json.loads(MANIFEST_PATH.read_text(encoding="utf-8"))
|
||||
required = {"schema_version", "artifact_id", "source_scope", "release_gate", "evidence"}
|
||||
missing = sorted(required - manifest.keys())
|
||||
if missing:
|
||||
raise SystemExit(f"invalid JHora evidence manifest; missing: {', '.join(missing)}")
|
||||
if manifest["artifact_id"] != "jhora_master_evidence":
|
||||
raise SystemExit("invalid JHora evidence manifest artifact_id")
|
||||
if manifest["release_gate"].get("local_scratch_required") is not False:
|
||||
raise SystemExit("public JHora evidence manifest must not require local scratch")
|
||||
return manifest
|
||||
|
||||
|
||||
def latest_packet(work_dir: Path | None = None) -> tuple[int, Path]:
|
||||
work_dir = work_dir or LOCAL_EVIDENCE_DIR
|
||||
packets: list[tuple[int, Path]] = []
|
||||
for path in WORK_DIR.glob("jhora_master_evidence_packet_public_sample_19550224_1915.v*.json"):
|
||||
for path in work_dir.glob("jhora_master_evidence_packet_public_sample_19550224_1915.v*.json"):
|
||||
match = PACKET_RE.search(path.name)
|
||||
if match:
|
||||
packets.append((int(match.group(1)), path))
|
||||
if not packets:
|
||||
raise SystemExit("no versioned JHora master evidence packets found")
|
||||
raise FileNotFoundError("no versioned local JHora master evidence packets found")
|
||||
return max(packets)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
version, path = latest_packet()
|
||||
def sync_local_packet_metadata(work_dir: Path | None = None) -> str:
|
||||
work_dir = work_dir or LOCAL_EVIDENCE_DIR
|
||||
version, path = latest_packet(work_dir)
|
||||
packet = json.loads(path.read_text(encoding="utf-8"))
|
||||
metadata = packet.setdefault("metadata", {})
|
||||
wanted_version = f"v{version}"
|
||||
@@ -45,7 +61,7 @@ def main() -> int:
|
||||
if changed:
|
||||
path.write_text(json.dumps(packet, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
||||
|
||||
ledger = WORK_DIR / "evidence_packet_status_ledger_public_sample_19550224_1915.md"
|
||||
ledger = work_dir / "evidence_packet_status_ledger_public_sample_19550224_1915.md"
|
||||
if ledger.exists():
|
||||
text = ledger.read_text(encoding="utf-8")
|
||||
line_re = re.compile(
|
||||
@@ -55,8 +71,29 @@ def main() -> int:
|
||||
new_text = line_re.sub(wanted_line, text, count=1)
|
||||
if new_text != text:
|
||||
ledger.write_text(new_text, encoding="utf-8")
|
||||
return path.name
|
||||
|
||||
print(f"synced {path.name}")
|
||||
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--sync-local", action="store_true", help="Repair local scratch metadata; never required for release.")
|
||||
parser.add_argument("--format", choices=["text", "json"], default="text")
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
manifest = load_manifest()
|
||||
result = {
|
||||
"artifact_id": manifest["artifact_id"],
|
||||
"manifest_path": str(MANIFEST_PATH.relative_to(ROOT)),
|
||||
"release_gate": manifest["release_gate"],
|
||||
"evidence": manifest["evidence"],
|
||||
"local_scratch": "not_inspected",
|
||||
}
|
||||
if args.sync_local:
|
||||
result["local_scratch"] = {"synced_packet": sync_local_packet_metadata()}
|
||||
if args.format == "json":
|
||||
print(json.dumps(result, ensure_ascii=False, indent=2))
|
||||
else:
|
||||
print(f"validated {result['manifest_path']}; local scratch {result['local_scratch']}")
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
@@ -1,83 +1,39 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Acceptance guard for the final JHora/PDF evidence packet artifacts."""
|
||||
"""Acceptance guard for the versioned public JHora evidence manifest."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
import scripts.sync_final_evidence_packet_status as sync_status
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
WORK_DIR = ROOT / "scratch" / "local" / "pdf_review_123456"
|
||||
MANIFEST_PATH = ROOT / "references" / "evidence_manifests" / "jhora_master_evidence_manifest.json"
|
||||
ERROR_LOG = ROOT / "docs" / "research" / "final_output_acceptance_error_log_2026_07_04.md"
|
||||
|
||||
|
||||
def _latest_packet() -> tuple[int, Path, dict]:
|
||||
sync_status.main()
|
||||
packets: list[tuple[int, Path]] = []
|
||||
for path in WORK_DIR.glob("jhora_master_evidence_packet_public_sample_19550224_1915.v*.json"):
|
||||
match = re.search(r"\.v(\d+)\.json$", path.name)
|
||||
if match:
|
||||
packets.append((int(match.group(1)), path))
|
||||
assert packets, "no versioned JHora master evidence packets found"
|
||||
version, path = max(packets)
|
||||
return version, path, json.loads(path.read_text(encoding="utf-8"))
|
||||
def _manifest() -> dict:
|
||||
return json.loads(MANIFEST_PATH.read_text(encoding="utf-8"))
|
||||
|
||||
|
||||
def test_latest_master_packet_has_consistent_final_status_and_version_metadata() -> None:
|
||||
version, path, packet = _latest_packet()
|
||||
metadata = packet["metadata"]
|
||||
def test_versioned_manifest_declares_public_release_boundary() -> None:
|
||||
manifest = _manifest()
|
||||
|
||||
assert version >= 24
|
||||
assert packet["status"] == "final_output_v1"
|
||||
assert metadata["status"] == "final_output_v1"
|
||||
assert metadata["current_version"] == f"v{version}"
|
||||
assert metadata["packet_version"] == f"v{version}"
|
||||
assert metadata["canonical_packet"] == path.name
|
||||
assert packet["structured_v13_final_integrated_report"]["status"] == "final_output_v1"
|
||||
assert manifest["schema_version"] == 1
|
||||
assert manifest["artifact_id"] == "jhora_master_evidence"
|
||||
assert manifest["source_scope"] == "public_release"
|
||||
assert manifest["release_gate"]["local_scratch_required"] is False
|
||||
assert manifest["release_gate"]["external_raw_required_for_official_verified"] is True
|
||||
|
||||
|
||||
def test_latest_master_packet_links_all_final_report_artifacts() -> None:
|
||||
_, _, packet = _latest_packet()
|
||||
|
||||
required_sections = {
|
||||
"structured_v21_raman_full_report_complete": ("source", "compiled-full-report-v1"),
|
||||
"structured_v22_raman_full_report_pdf_artifact": ("pdf", "pdf-rendered-qa-pass"),
|
||||
"structured_v23_raman_full_report_raw_data_appendix": ("source", "raw-data-appendix-v1"),
|
||||
}
|
||||
for section, (artifact_key, status) in required_sections.items():
|
||||
payload = packet[section]
|
||||
assert payload["status"] == status
|
||||
artifact = ROOT / payload[artifact_key]
|
||||
assert artifact.exists(), f"missing artifact for {section}: {artifact}"
|
||||
assert artifact.stat().st_size > 1000, f"artifact too small for {section}: {artifact}"
|
||||
|
||||
pdf_payload = packet["structured_v22_raman_full_report_pdf_artifact"]
|
||||
for rel_path in pdf_payload["qa_rendered_pages"]:
|
||||
qa_page = WORK_DIR / rel_path
|
||||
assert qa_page.exists(), f"missing PDF QA render page: {qa_page}"
|
||||
assert qa_page.stat().st_size > 1000
|
||||
|
||||
|
||||
def test_status_ledger_points_to_latest_packet_and_has_fresh_next_step() -> None:
|
||||
version, path, _ = _latest_packet()
|
||||
ledger = (WORK_DIR / "evidence_packet_status_ledger_public_sample_19550224_1915.md").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
assert path.name in ledger
|
||||
assert f"`{path.name}` | active" in ledger
|
||||
assert "Raman full report complete" in ledger
|
||||
assert "Raman full report PDF" in ledger
|
||||
assert "Raman full report raw data appendix" in ledger
|
||||
assert "Chapter 04 Parashari Dasha layer - Vimshottari" not in ledger
|
||||
assert "Acceptance/error-log gate" in ledger
|
||||
assert f"v{version}" in ledger
|
||||
|
||||
def test_manifest_keeps_external_jhora_raw_state_honest() -> None:
|
||||
evidence = _manifest()["evidence"]
|
||||
|
||||
assert evidence["engine"] == "JHora"
|
||||
assert evidence["raw_status"] in {"not_collected", "partial", "verified"}
|
||||
assert evidence["raw_status"] != "verified"
|
||||
def test_acceptance_error_log_records_known_failures_and_prevention_rules() -> None:
|
||||
text = ERROR_LOG.read_text(encoding="utf-8")
|
||||
|
||||
@@ -93,7 +49,7 @@ def test_acceptance_error_log_records_known_failures_and_prevention_rules() -> N
|
||||
assert phrase in text
|
||||
|
||||
|
||||
def test_sync_script_repairs_latest_packet_metadata_and_ledger(tmp_path, monkeypatch) -> None:
|
||||
def test_sync_script_repairs_latest_packet_metadata_only_when_explicitly_requested(tmp_path, monkeypatch) -> None:
|
||||
for version in (2, 10):
|
||||
packet = {
|
||||
"status": "final_output_v1",
|
||||
@@ -115,9 +71,9 @@ def test_sync_script_repairs_latest_packet_metadata_and_ledger(tmp_path, monkeyp
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
monkeypatch.setattr(sync_status, "WORK_DIR", tmp_path)
|
||||
monkeypatch.setattr(sync_status, "LOCAL_EVIDENCE_DIR", tmp_path)
|
||||
|
||||
assert sync_status.main() == 0
|
||||
assert sync_status.main(["--sync-local"]) == 0
|
||||
latest = json.loads(
|
||||
(tmp_path / "jhora_master_evidence_packet_public_sample_19550224_1915.v10.json").read_text(
|
||||
encoding="utf-8"
|
||||
@@ -132,3 +88,9 @@ def test_sync_script_repairs_latest_packet_metadata_and_ledger(tmp_path, monkeyp
|
||||
assert "jhora_master_evidence_packet_public_sample_19550224_1915.v10.json" in ledger.read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
|
||||
def test_sync_script_succeeds_without_local_scratch(monkeypatch, tmp_path) -> None:
|
||||
monkeypatch.setattr(sync_status, "LOCAL_EVIDENCE_DIR", tmp_path)
|
||||
|
||||
assert sync_status.main([]) == 0
|
||||
|
||||
Reference in New Issue
Block a user