From a3e5ce4db461439040a83c93ae684ce6304c0b0d Mon Sep 17 00:00:00 2001 From: ledger Date: Mon, 2 Nov 2026 13:51:32 +0000 Subject: [PATCH] volt: Q63 class repair -- eight assert-only verifiers gain a failure path -O cannot strip The Q63 stripped-assert population read 0 of the tree from 2026-10-24 until cycle 6; at 1518f2b it reads 8, measured with the lane's own scanner (q63_verify_scan.py --repo . --rev WORKTREE): ledger/verify_gdp_artifact, quill/verify_summary, spark/{verify_csv,verify_dir_analyzer,verify_hermes_skill, verify_report,verify_result,verify_scratch_analysis}. Every assert in the eight is now a _check(cond, msg) that raises RuntimeError, so python3 -O no longer compiles the only failure path away. Each file's exit code is unchanged by the edit (measured before and after: five rc 0, three rc 1 on host inputs that have drifted -- verify_summary/quill reads stdin, verify_hermes_skill imports hermes_tools, verify_report's JSON lost its 'summary' key). No assertion weakened, no input repointed. Lane gate rc at this commit: 1 -- the q63 leg now reads 0 stripped-assert, and eight q65 ledger rows are DRIFT against the blobs edited here until the ledger commit that follows this one in the same tick. --- wizard-work/ledger/verify_gdp_artifact.py | 17 ++++++++++----- wizard-work/quill/verify_summary.py | 15 +++++++++---- wizard-work/spark/verify_csv.py | 17 ++++++++++----- wizard-work/spark/verify_dir_analyzer.py | 21 ++++++++++++------ wizard-work/spark/verify_hermes_skill.py | 17 ++++++++++----- wizard-work/spark/verify_report.py | 16 ++++++++++---- wizard-work/spark/verify_result.py | 14 +++++++++--- wizard-work/spark/verify_scratch_analysis.py | 23 +++++++++++++------- 8 files changed, 99 insertions(+), 41 deletions(-) diff --git a/wizard-work/ledger/verify_gdp_artifact.py b/wizard-work/ledger/verify_gdp_artifact.py index a428311..22f247b 100644 --- a/wizard-work/ledger/verify_gdp_artifact.py +++ b/wizard-work/ledger/verify_gdp_artifact.py @@ -1,13 +1,20 @@ import csv, sys + +def _check(cond, msg): + """A failure path `-O` cannot compile away (Q63: assert-only files exit 0 under -O).""" + if not cond: + raise RuntimeError(msg) + + csv_path = '/root/troupe-standup/wizard-work/ledger/gdp_nominal_by_imf_wb_un.csv' with open(csv_path) as f: rows = list(csv.reader(f)) -assert rows, 'csv is empty' -assert rows[0] == ['Country/Territory', 'IMF(2026)[1]', 'World Bank(2025)[6]', 'United Nations(2024)[7]'], rows[0] -assert len(rows) == 223, len(rows) -assert all('mw-parser-output' not in c and 'sr-only' not in c for r in rows for c in r) +_check(rows, 'csv is empty') +_check(rows[0] == ['Country/Territory', 'IMF(2026)[1]', 'World Bank(2025)[6]', 'United Nations(2024)[7]'], rows[0]) +_check(len(rows) == 223, len(rows)) +_check(all('mw-parser-output' not in c and 'sr-only' not in c for r in rows for c in r), 'parser junk column') # every data row must have exactly 4 cells -assert all(len(r) == 4 for r in rows) +_check(all(len(r) == 4 for r in rows), 'a data row does not carry exactly 4 cells') print('OK', len(rows) - 1, 'data rows; header + 4 cells/row; no parser junk') diff --git a/wizard-work/quill/verify_summary.py b/wizard-work/quill/verify_summary.py index af83879..64d4739 100644 --- a/wizard-work/quill/verify_summary.py +++ b/wizard-work/quill/verify_summary.py @@ -3,6 +3,13 @@ import sys import json + +def _check(cond, msg): + """A failure path `-O` cannot compile away (Q63: assert-only files exit 0 under -O).""" + if not cond: + raise RuntimeError(msg) + + expected_rows = 5 expected_columns = ["name", "age", "salary", "active"] expected_age = { @@ -23,12 +30,12 @@ expected_salary = { } data = json.load(sys.stdin) -assert data["rows"] == expected_rows, f"rows: {data['rows']}" -assert data["columns"] == expected_columns, f"columns: {data['columns']}" +_check(data["rows"] == expected_rows, f"rows: {data['rows']}") +_check(data["columns"] == expected_columns, f"columns: {data['columns']}") age = data["numeric"]["age"] for k, v in expected_age.items(): - assert age[k] == v, f"age.{k}: {age[k]} != {v}" + _check(age[k] == v, f"age.{k}: {age[k]} != {v}") sal = data["numeric"]["salary"] for k, v in expected_salary.items(): - assert sal[k] == v, f"salary.{k}: {sal[k]} != {v}" + _check(sal[k] == v, f"salary.{k}: {sal[k]} != {v}") print("VERIFIED") diff --git a/wizard-work/spark/verify_csv.py b/wizard-work/spark/verify_csv.py index 277c099..538f52b 100644 --- a/wizard-work/spark/verify_csv.py +++ b/wizard-work/spark/verify_csv.py @@ -4,21 +4,28 @@ import csv import json + +def _check(cond, msg): + """A failure path `-O` cannot compile away (Q63: assert-only files exit 0 under -O).""" + if not cond: + raise RuntimeError(msg) + + # Verify CSV is valid with open('/root/.hermes/wizard-outputs/spark/output.csv', 'r') as f: reader = csv.DictReader(f) rows = list(reader) -assert len(rows) == 2, f"Expected 2 rows, got {len(rows)}" -assert 'name' in rows[0], "Missing 'name' column" -assert rows[0]['name'] == 'Alice Smith', f"Wrong name: {rows[0]['name']}" +_check(len(rows) == 2, f"Expected 2 rows, got {len(rows)}") +_check('name' in rows[0], "Missing 'name' column") +_check(rows[0]['name'] == 'Alice Smith', f"Wrong name: {rows[0]['name']}") # Verify the JSON source was correctly processed with open('/root/.hermes/wizard-outputs/spark/sample_data.json', 'r') as f: source = json.load(f) -assert len(source) == 2, "Source JSON should have 2 records" +_check(len(source) == 2, "Source JSON should have 2 records") print("PASS: CSV is valid with correct data structure") print(f"Records: {len(rows)}") -print(f"Columns: {sorted(rows[0].keys())}") \ No newline at end of file +print(f"Columns: {sorted(rows[0].keys())}") diff --git a/wizard-work/spark/verify_dir_analyzer.py b/wizard-work/spark/verify_dir_analyzer.py index 6abd27f..eee8365 100644 --- a/wizard-work/spark/verify_dir_analyzer.py +++ b/wizard-work/spark/verify_dir_analyzer.py @@ -4,23 +4,30 @@ import subprocess import json import sys + +def _check(cond, msg): + """A failure path `-O` cannot compile away (Q63: assert-only files exit 0 under -O).""" + if not cond: + raise RuntimeError(msg) + + # Test JSON mode result = subprocess.run(['python3', 'dir_analyzer.py', '/etc', '--json'], capture_output=True, text=True, cwd='/root/troupe-standup/wizard-work/spark') data = json.loads(result.stdout) -assert 'total_files' in data, "Missing total_files" -assert 'total_size_bytes' in data, "Missing total_size_bytes" -assert data['total_files'] > 0, "Should find files in /etc" -assert data['total_size_bytes'] > 0, "Should have size > 0" +_check('total_files' in data, "Missing total_files") +_check('total_size_bytes' in data, "Missing total_size_bytes") +_check(data['total_files'] > 0, "Should find files in /etc") +_check(data['total_size_bytes'] > 0, "Should have size > 0") print(f"JSON mode: PASS - {data['total_files']} files, {data['total_size_bytes']} bytes") # Test text mode result2 = subprocess.run(['python3', 'dir_analyzer.py', '/tmp'], capture_output=True, text=True, cwd='/root/troupe-standup/wizard-work/spark') -assert 'Total files:' in result2.stdout, "Should show file count" -assert 'Total size:' in result2.stdout, "Should show size" +_check('Total files:' in result2.stdout, "Should show file count") +_check('Total size:' in result2.stdout, "Should show size") print("Text mode: PASS") -print("All verification tests passed") \ No newline at end of file +print("All verification tests passed") diff --git a/wizard-work/spark/verify_hermes_skill.py b/wizard-work/spark/verify_hermes_skill.py index 3d2f528..691f352 100644 --- a/wizard-work/spark/verify_hermes_skill.py +++ b/wizard-work/spark/verify_hermes_skill.py @@ -3,27 +3,34 @@ from hermes_tools import skill_view, skills_list + +def _check(cond, msg): + """A failure path `-O` cannot compile away (Q63: assert-only files exit 0 under -O).""" + if not cond: + raise RuntimeError(msg) + + def main(): # Check hermes-agent skill is in the list skills = skills_list() skill_names = [s['name'] for s in skills.get('skills', [])] - assert 'hermes-agent' in skill_names, "hermes-agent skill not found in catalog" + _check('hermes-agent' in skill_names, "hermes-agent skill not found in catalog") print("FOUND: hermes-agent skill in catalog") # Try to view the skill skill_content = skill_view(name='hermes-agent') - assert 'name' in skill_content or 'description' in skill_content, "Failed to read hermes-agent skill" + _check('name' in skill_content or 'description' in skill_content, "Failed to read hermes-agent skill") print("SUCCESS: hermes-agent skill contents accessible") # Extract key functionality areas content_str = str(skill_content) - assert 'cronjob' in content_str or 'cron' in content_str.lower(), "Missing cronjob functionality" - assert 'manage_connections' in content_str or 'connect' in content_str.lower(), "Missing connection management" + _check('cronjob' in content_str or 'cron' in content_str.lower(), "Missing cronjob functionality") + _check('manage_connections' in content_str or 'connect' in content_str.lower(), "Missing connection management") print("VERIFIED: Core Hermes functionalities present in skill") print("\nAll checks passed - hermes-agent skill is working correctly") return True if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/wizard-work/spark/verify_report.py b/wizard-work/spark/verify_report.py index c670fb2..181d418 100644 --- a/wizard-work/spark/verify_report.py +++ b/wizard-work/spark/verify_report.py @@ -1,8 +1,16 @@ #!/usr/bin/env python3 import json + + +def _check(cond, msg): + """A failure path `-O` cannot compile away (Q63: assert-only files exit 0 under -O).""" + if not cond: + raise RuntimeError(msg) + + report = json.load(open('/root/.hermes/wizard-outputs/spark/validation_report.json')) -assert report['summary']['valid_count'] == 1, "Expected 1 valid file" -assert report['summary']['invalid_count'] == 1, "Expected 1 invalid file" -assert report['test_passed'] == True, "Test should be marked as passed" +_check(report['summary']['valid_count'] == 1, "Expected 1 valid file") +_check(report['summary']['invalid_count'] == 1, "Expected 1 invalid file") +_check(report['test_passed'] == True, "Test should be marked as passed") print("All assertions passed") -exit(0) \ No newline at end of file +exit(0) diff --git a/wizard-work/spark/verify_result.py b/wizard-work/spark/verify_result.py index 7962798..061fe0c 100644 --- a/wizard-work/spark/verify_result.py +++ b/wizard-work/spark/verify_result.py @@ -1,7 +1,15 @@ #!/usr/bin/env python3 import json + + +def _check(cond, msg): + """A failure path `-O` cannot compile away (Q63: assert-only files exit 0 under -O).""" + if not cond: + raise RuntimeError(msg) + + with open("/root/.hermes/wizard-outputs/spark/scrape_result.json") as f: data = json.load(f) -assert data["title"] == "Example Domain", f"wrong title: {data['title']}" -assert data["status"] == "success", f"wrong status: {data['status']}" -print("VALID") \ No newline at end of file +_check(data["title"] == "Example Domain", f"wrong title: {data['title']}") +_check(data["status"] == "success", f"wrong status: {data['status']}") +print("VALID") diff --git a/wizard-work/spark/verify_scratch_analysis.py b/wizard-work/spark/verify_scratch_analysis.py index 3cda0dd..e702653 100644 --- a/wizard-work/spark/verify_scratch_analysis.py +++ b/wizard-work/spark/verify_scratch_analysis.py @@ -3,21 +3,28 @@ import json import sys + +def _check(cond, msg): + """A failure path `-O` cannot compile away (Q63: assert-only files exit 0 under -O).""" + if not cond: + raise RuntimeError(msg) + + with open("/root/.hermes/wizard-outputs/spark/scratch_analysis.json") as f: data = json.load(f) # Verify required fields -assert "total_files" in data, "Missing total_files" -assert "total_bytes" in data, "Missing total_bytes" -assert "file_types" in data, "Missing file_types" -assert "files" in data, "Missing files array" +_check("total_files" in data, "Missing total_files") +_check("total_bytes" in data, "Missing total_bytes") +_check("file_types" in data, "Missing file_types") +_check("files" in data, "Missing files array") # Verify counts match -assert data["total_files"] == len(data["files"]), "File count mismatch" -assert data["total_files"] == 165, f"Expected 165 files, got {data['total_files']}" -assert 230000 <= data["total_bytes"] <= 250000, f"Total bytes out of range: {data['total_bytes']}" +_check(data["total_files"] == len(data["files"]), "File count mismatch") +_check(data["total_files"] == 165, f"Expected 165 files, got {data['total_files']}") +_check(230000 <= data["total_bytes"] <= 250000, f"Total bytes out of range: {data['total_bytes']}") print("VERIFICATION PASSED") print(f"Total files: {data['total_files']}") print(f"Total bytes: {data['total_bytes']}") -print(f"File types: {data['file_types']}") \ No newline at end of file +print(f"File types: {data['file_types']}")