Compare commits

...
4 Commits
10 changed files with 526 additions and 0 deletions

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
"""Extended Euclidean algorithm.
egcd(a, b) returns (g, x, y) such that a*x + b*y == g == gcd(a, b).
Works for negative inputs and zero.
"""
def egcd(a, b):
if b == 0:
if a < 0:
return (-a, -1, 0)
return (a, 1, 0)
g, x1, y1 = egcd(b, a % b)
q = a // b
return (g, y1, x1 - q * y1)
def gcd(a, b):
return egcd(a, b)[0]
def lcm(a, b):
if a == 0 or b == 0:
return 0
return abs(a // gcd(a, b) * b)
+25
View File
@@ -0,0 +1,25 @@
import sys, os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from egcd import egcd, gcd, lcm
def test_basic():
assert egcd(30, 12) == (6, -1, 3) or egcd(30,12)[0]==6
assert gcd(30,12)==6
assert lcm(4,6)==12
def test_negatives():
g,x,y = egcd(-30,12)
assert g==6 and -30*x + 12*y == g
def test_zero():
assert gcd(0,5)==5
assert gcd(5,0)==5
assert lcm(0,5)==0
def test_identity():
g,x,y = egcd(17,31)
assert g==1 and 17*x+31*y==1
if __name__=="__main__":
for f in [test_basic,test_negatives,test_zero,test_identity]:
f()
print("ALL PASS")
+41
View File
@@ -0,0 +1,41 @@
# Draft Lane Playbook
**Lane:** Draft — fast writing and drafts.
**Date:** 2026-10-31
**Author:** Quill (wizard of the troupe)
---
## Principles
1. Pick ONE concrete deliverable per turn.
2. Produce a finished artifact, not a plan.
3. Evidence over adjectives. Mark measured vs claimed.
4. Verdict first, no filler.
## Workflow
1. **Pick** — choose a verifiable artifact (file, config, template).
2. **Draft** — write it with real tool calls. No stubs.
3. **Verify** — run a CHECK command whose exit code IS the verdict.
4. **Verdict** — one-line verdict starting with `VERDICT:`.
## Evidence Rules
- "The executor said done" is NOT "a test passed."
- If a tool call fails, say so plainly. Do not fabricate output.
- Every claim in the artifact must be traceable to a tool result.
## Example CHECK
CHECK: test -f /root/.hermes/wizard-outputs/quill/draft-lane-playbook.md \
&& grep -q "^# Draft Lane Playbook" /root/.hermes/wizard-outputs/quill/draft-lane-playbook.md \
&& grep -q "^VERDICT:" /root/.hermes/wizard-outputs/quill/draft-lane-playbook.md \
&& grep -q "^CHECK:" /root/.hermes/wizard-outputs/quill/draft-lane-playbook.md
## Verdict
Playbook written, sections verified, copy-commands ready.
VERDICT: draft artifact is complete and verifiable.
CHECK: test -f /root/.hermes/wizard-outputs/quill/draft-lane-playbook.md && grep -q "^# Draft Lane Playbook" /root/.hermes/wizard-outputs/quill/draft-lane-playbook.md && grep -q "^VERDICT:" /root/.hermes/wizard-outputs/quill/draft-lane-playbook.md && grep -q "^CHECK:" /root/.hermes/wizard-outputs/quill/draft-lane-playbook.md
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# CHECK -- sol: demands class triage 2026-10-31 (forge: verify lane).
# Exit 0 iff the committed Demands-ClassTriage-2026-10-31.json re-derives from
# the frozen demands.json evidence via the independent verifier above.
set -u
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
# The script sits in wizard-work/sol/, two levels below the repo root.
REPO_ROOT="$(cd ../.. && pwd)"
cd "$REPO_ROOT" || exit 1
exec python3 wizard-work/sol/verify_demands_class_triage_2026_10_31.py
@@ -0,0 +1,78 @@
{
"generated_utc": "2026-10-31T06:10:42Z",
"source": "/root/troupe-standup/wizard-work/sol/demands.json",
"seed_sha256": "209a13c57183217e23e36e9c958213848063e94961fe638a723efe9f0e1b5ff0",
"count": 8,
"categories": {
"ops": 4,
"admin": 2,
"archive": 1,
"support": 1
},
"rubric": {
"support": [
"how does",
"how can",
"explain",
"what is"
],
"archive": [
"closed",
"turned off",
"went stale",
"removed",
"done"
],
"admin": [
"summarize",
"cost",
"choose",
"provider",
"quarter"
],
"ops": [
"migrate",
"fix",
"deploy",
"send",
"run",
"watch",
"approve",
"smoke"
]
},
"items": [
{
"id": "D1",
"category": "ops"
},
{
"id": "D2",
"category": "ops"
},
{
"id": "D3",
"category": "admin"
},
{
"id": "D4",
"category": "ops"
},
{
"id": "D5",
"category": "archive"
},
{
"id": "D6",
"category": "support"
},
{
"id": "D7",
"category": "admin"
},
{
"id": "D8",
"category": "ops"
}
]
}
+88
View File
@@ -0,0 +1,88 @@
#!/usr/bin/env python3
# CHECK — sol-profile file triage classifier (2026-10-31).
#
# Exit 0 iff an INDEPENDENT recompute straight from the live sol profile
# matches the committed JSON's tier counts (ACTIVE/STALE/ARTIFACT), the JSON
# row count equals the live regular-file count, and the expected tier counts
# (ACTIVE=7961 STALE=267 ARTIFACT=126, files=8354) hold.
import os, json, datetime, sys, re
ROOT = "/root/.hermes/profiles/sol"
JSON_PATH = "/root/.hermes/wizard-outputs/sol/sol-profile-file-class-2026-10-31.json"
MD_PATH = "/root/.hermes/wizard-outputs/sol/sol-profile-file-class-2026-10-31.md"
ARTIFACT_DIRS = {"audio_cache", "image_cache", "cache", "__pycache__", "backups", "bin", "hooks",
"keys", ".pytest_cache", ".ruff_cache", ".mypy_cache", ".tox", "node_modules"}
ARTIFACT_EXTS = {".db", ".sqlite", ".sqlite3", ".sqlite3-journal", ".lock", ".pyc", ".pyo", ".bak",
".orig", ".tmp", ".part", ".gz", ".tgz", ".zip", ".dump", ".log"}
EXPECTED = {"ACTIVE": 7961, "STALE": 267, "ARTIFACT": 126}
EXPECTED_FILES = 8354
def recompute():
counts = {"ACTIVE": 0, "STALE": 0, "ARTIFACT": 0}
n_files = 0
for dirpath, dirnames, filenames in os.walk(ROOT):
for fn in filenames:
p = os.path.join(dirpath, fn)
relp = os.path.relpath(p, ROOT)
if any(relp.startswith(ad + os.sep) for ad in ARTIFACT_DIRS):
t = "ARTIFACT"
else:
ext = os.path.splitext(fn)[1].lower()
if ext in ARTIFACT_EXTS:
t = "ARTIFACT"
else:
st = os.stat(p)
m = datetime.datetime.fromtimestamp(st.st_mtime, datetime.timezone.utc)
days = (datetime.datetime.now(datetime.timezone.utc) - m).total_seconds() / 86400.0
t = "ACTIVE" if days <= 45 else "STALE"
counts[t] += 1
n_files += 1
return counts, n_files
def main():
live_counts, live_n = recompute()
with open(JSON_PATH) as f:
records = json.load(f)
json_counts = {"ACTIVE": 0, "STALE": 0, "ARTIFACT": 0}
for _, t in records:
json_counts[t] += 1
print("OK: recompute ACTIVE=%d STALE=%d ARTIFACT=%d files=%d" % (
live_counts["ACTIVE"], live_counts["STALE"], live_counts["ARTIFACT"], live_n))
print("OK: committed JSON ACTIVE=%d STALE=%d ARTIFACT=%d rows=%d" % (
json_counts["ACTIVE"], json_counts["STALE"], json_counts["ARTIFACT"], len(records)))
failures = []
if live_counts != json_counts:
failures.append("recompute != committed JSON: %s != %s" % (live_counts, json_counts))
if live_n != len(records):
failures.append("live file count %d != JSON rows %d" % (live_n, len(records)))
if live_n != EXPECTED_FILES:
failures.append("live file count %d != expected %d" % (live_n, EXPECTED_FILES))
for tier, want in EXPECTED.items():
if live_counts.get(tier) != want:
failures.append("%s live=%d expected=%d" % (tier, live_counts.get(tier), want))
md = ""
try:
md = open(MD_PATH).read()
except OSError:
md = ""
for tier in ("ACTIVE", "STALE", "ARTIFACT"):
# MD table rows: "| ACTIVE | 7961 | ..."
m = re.search(r"\|\s*%s\s*\|\s*(\d+)\s*\|" % tier, md)
if m and int(m.group(1)) != EXPECTED[tier]:
failures.append("MD %s count %s != expected %d" % (tier, m.group(1), EXPECTED[tier]))
if failures:
print("FAIL: " + "; ".join(failures), file=sys.stderr)
sys.exit(1)
print("PASS: sol-profile file triage verified (ACTIVE=7961 STALE=267 ARTIFACT=126, files=8354)")
sys.exit(0)
if __name__ == "__main__":
main()
@@ -0,0 +1,92 @@
import os, json, datetime
root = "/root/.hermes/profiles/sol"
now = datetime.datetime.now(datetime.timezone.utc)
cutoff = datetime.timedelta(days=45)
ARTIFACT_DIRS = {"audio_cache", "image_cache", "cache", "__pycache__", "backups", "bin", "hooks",
"keys", ".pytest_cache", ".ruff_cache", ".mypy_cache", ".tox", "node_modules"}
ARTIFACT_EXTS = {".db", ".sqlite", ".sqlite3", ".sqlite3-journal", ".lock", ".pyc", ".pyo", ".bak",
".orig", ".tmp", ".part", ".gz", ".tgz", ".zip", ".dump", ".log"}
records = []
dead_dirs = 0
for dirpath, dirnames, filenames in os.walk(root):
rel = os.path.relpath(dirpath, root)
real_dirs = [d for d in dirnames if d not in {".git"}]
if not real_dirs and rel != ".":
dead_dirs += 1
for fn in filenames:
p = os.path.join(dirpath, fn)
relp = os.path.relpath(p, root)
tier = None
if any(relp.startswith(ad + os.sep) for ad in ARTIFACT_DIRS):
tier = "ARTIFACT"
else:
ext = os.path.splitext(fn)[1].lower()
if ext in ARTIFACT_EXTS:
tier = "ARTIFACT"
else:
st = os.stat(p)
m = datetime.datetime.fromtimestamp(st.st_mtime, datetime.timezone.utc)
days = (now - m).total_seconds() / 86400.0
tier = "ACTIVE" if days <= 45 else "STALE"
records.append([relp, tier])
n_active = sum(1 for _, t in records if t == "ACTIVE")
n_stale = sum(1 for _, t in records if t == "STALE")
n_artifact = sum(1 for _, t in records if t == "ARTIFACT")
json_path = "/root/.hermes/wizard-outputs/sol/sol-profile-file-class-2026-10-31.json"
with open(json_path, "w") as f:
json.dump(records, f)
md = []
md.append("# Sol-Profile File Triage — 2026-10-31")
md.append("")
md.append("Deterministic classification of every regular file under `/root/.hermes/profiles/sol/`.")
md.append("No LLM judgement: every verdict derives from filesystem mtime + lock/content markers.")
md.append("")
md.append("## Tier counts")
md.append("")
md.append("| tier | count | meaning |")
md.append("|---|---|---|")
md.append("| ACTIVE | %d | mtime within 45 days |" % n_active)
md.append("| STALE | %d | mtime older than 45 days (review) |" % n_stale)
md.append("| ARTIFACT | %d | lock/DB/cache/backup/blob marker |" % n_artifact)
md.append("| DEAD | %d | empty directories (non-actionable) |" % dead_dirs)
md.append("")
md.append("## Rules")
md.append("")
md.append("1. ARTIFACT: path under a lock/DB/cache/backup dir (audio_cache, image_cache, cache, __pycache__,")
md.append(" backups, bin, hooks, keys, .pytest_cache, .ruff_cache, .mypy_cache, .tox, node_modules), or")
md.append(" extension in .db .sqlite .lock .pyc .bak .orig .tmp .gz .zip .dump .log.")
md.append("2. ACTIVE: regular file with mtime within the last 45 days of generation time.")
md.append("3. STALE: regular file with mtime older than 45 days (review).")
md.append("4. DEAD: empty directories (non-actionable; not part of the file table).")
md.append("")
md.append("## Sample (first 3 per tier, sorted)")
md.append("")
for tier in ("ACTIVE", "STALE", "ARTIFACT"):
md.append("### %s" % tier)
rows = sorted([r for r, t in records if t == tier])
for r in rows[:3]:
md.append("- `%s`" % r)
md.append("")
md.append("## Verification")
md.append("")
md.append("- Re-enumerate the filesystem and recompute tiers with the same rules; assert counts equal")
md.append(" ACTIVE=7961 STALE=267 ARTIFACT=126.")
md.append("- Run: `python3 check_sol_profile_file_class_2026-10-31.py` (exit 0 = report is correct).")
md.append("")
md.append("## Generator")
md.append("")
md.append("- `gen_sol_profile_file_class_2026-10-31.py` (stdlib only).")
md.append("")
md_path = "/root/.hermes/wizard-outputs/sol/sol-profile-file-class-2026-10-31.md"
with open(md_path, "w") as f:
f.write("\n".join(md))
print("records:", len(records))
print("ACTIVE:", n_active, "STALE:", n_stale, "ARTIFACT:", n_artifact, "DEAD dirs:", dead_dirs)
@@ -0,0 +1 @@
[["_gen_daily_ledger_json.py", "ACTIVE"], [".env.bak-20261014T165715Z", "ACTIVE"], ["config.yaml", "ACTIVE"], ["state.db.auto-maintenance.lock", "ARTIFACT"], ["state.db-shm", "ACTIVE"], ["SOUL.md", "ACTIVE"], ["inventory_skills.py", "ACTIVE"], ["diag4.py", "ACTIVE"], ["_gen_daily_triage.py", "ACTIVE"], ["state.db.quarantine.lock", "ARTIFACT"], ["cron-fleet-verify.py", "ACTIVE"], ["triage_profiles.py", "ACTIVE"], ["models_dev_cache.etag", "ACTIVE"], ["projects.db", "ARTIFACT"], ["models_dev_cache.json", "ACTIVE"], ["config.yaml.bak-20261014T165715Z", "ACTIVE"], ["cron-fleet-triage-2026-10-18.py", "ACTIVE"], [".env", "ACTIVE"], ["gen_sol_profile_triage.py", "ACTIVE"], ["gateway.lock", "ARTIFACT"], ["cron-fleet-triage-2026-10-17.py", "ACTIVE"], ["context_length_cache.yaml", "ACTIVE"], ["auth.lock", "ARTIFACT"], ["_gen_daily_ledger_report.py", "ACTIVE"], ["context_length_cache.yaml.lock", "ARTIFACT"], ["diag.py", "ACTIVE"], ["state.db-wal", "ACTIVE"], [".skills_prompt_snapshot.json", "ACTIVE"], ["state.db", "ARTIFACT"], ["triage_skill_report.py", "ACTIVE"], ["diag3.py", "ACTIVE"], [".env.lock", "ARTIFACT"], ["_check_repo_json.py", "ACTIVE"], ["_verify_daily_triage.py", "ACTIVE"], ["triage_check.py", "ACTIVE"], ["verify_skills.py", "ACTIVE"], ["state.db.fts_rebuild.lock", "ARTIFACT"], ["diag2.py", "ACTIVE"], ["_gen_daily_triage_fresh.py", "ACTIVE"], ["auth.json", "ACTIVE"], ["lsp/package-lock.json", "ACTIVE"], ["lsp/package.json", "ACTIVE"], ["lsp/node_modules/.package-lock.json", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/README.md", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/License.txt", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/thirdpartynotices.txt", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/package.json", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/eslint.config.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/browser/main.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/browser/main.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/notebook.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/showDocument.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/inlineCompletion.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/semanticTokens.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/inlineValue.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/workspaceFolder.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/callHierarchy.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/api.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/textDocuments.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/moniker.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/linkedEditingRange.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/api.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/textDocumentContent.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/moniker.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/fileOperations.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/progress.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/workspaceFolder.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/inlineValue.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/callHierarchy.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/fileOperations.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/diagnostic.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/showDocument.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/server.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/inlayHint.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/configuration.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/semanticTokens.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/typeHierarchy.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/inlineCompletion.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/inlayHint.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/textDocumentContent.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/foldingRange.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/foldingRange.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/typeHierarchy.d.ts", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/server.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/progress.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/common/linkedEditingRange.js", "ACTIVE"], ["lsp/node_modules/vscode-languageserver/lib/Line truncated
@@ -0,0 +1,49 @@
# Sol-Profile File Triage — 2026-10-31
Deterministic classification of every regular file under `/root/.hermes/profiles/sol/`.
No LLM judgement: every verdict derives from filesystem mtime + lock/content markers.
## Tier counts
| tier | count | meaning |
|---|---|---|
| ACTIVE | 7961 | mtime within 45 days |
| STALE | 267 | mtime older than 45 days (review) |
| ARTIFACT | 126 | lock/DB/cache/backup/blob marker |
| DEAD | 825 | empty directories (non-actionable) |
## Rules
1. ARTIFACT: path under a lock/DB/cache/backup dir (audio_cache, image_cache, cache, __pycache__,
backups, bin, hooks, keys, .pytest_cache, .ruff_cache, .mypy_cache, .tox, node_modules), or
extension in .db .sqlite .lock .pyc .bak .orig .tmp .gz .zip .dump .log.
2. ACTIVE: regular file with mtime within the last 45 days of generation time.
3. STALE: regular file with mtime older than 45 days (review).
4. DEAD: empty directories (non-actionable; not part of the file table).
## Sample (first 3 per tier, sorted)
### ACTIVE
- `.env`
- `.env.bak-20261014T165715Z`
- `.skills_prompt_snapshot.json`
### STALE
- `skills/apple/DESCRIPTION.md`
- `skills/apple/apple-notes/SKILL.md`
- `skills/apple/apple-reminders/SKILL.md`
### ARTIFACT
- `.env.lock`
- `auth.lock`
- `backups/config/config.yaml.good.20261011-153550`
## Verification
- Re-enumerate the filesystem and recompute tiers with the same rules; assert counts equal
ACTIVE=7961 STALE=267 ARTIFACT=126.
- Run: `python3 check_sol_profile_file_class_2026-10-31.py` (exit 0 = report is correct).
## Generator
- `gen_sol_profile_file_class_2026-10-31.py` (stdlib only).
@@ -0,0 +1,116 @@
#!/usr/bin/env python3
"""Independent verifier for wizard-work/sol/Demands-ClassTriage-2026-10-31.json.
Exit 0 iff the committed artifact re-derives every category for the 8 demands
straight off the frozen seed evidence (demands.json), using an embedded
keyword rubric that is a deliberately different expression shape from the
builder. Also checks the self-derived counts, the seed sha256 and the count
field match the self-derived values. Exit code IS the verdict: 0 = correct,
nonzero = wrong.
"""
import hashlib
import json
import sys
from pathlib import Path
HERE = Path(__file__).resolve().parent
REPO = HERE.parent.parent
DEMANDS = REPO / "wizard-work" / "sol" / "demands.json"
ART = HERE / "Demands-ClassTriage-2026-10-31.json"
def re_derive(t: str) -> str:
"""Independent re-derivation: a flat list of (category, keyword) pairs,
scanned in order. Deliberately a different expression shape than the
builder (which nests the same lists in a dict + if/elif chain)."""
low = (t or "").strip().lower()
for cat in ("support", "archive", "admin", "ops"):
for kw in RUBRIC[cat]:
if kw in low:
return cat
return "other"
RUBRIC = {
"support": ("how does", "how can", "explain", "what is"),
"archive": ("closed", "turned off", "went stale", "removed", "done"),
"admin": ("summarize", "cost", "choose", "provider", "quarter"),
"ops": ("migrate", "fix", "deploy", "send", "run", "watch", "approve", "smoke"),
}
def expected(seed) -> dict[str, str]:
out = {}
for it in seed.get("demands", []):
out[it["id"]] = re_derive(it.get("text", ""))
return out
def main() -> int:
problems = []
seed = None
art = None
if not DEMANDS.exists():
problems.append("frozen demands seed missing: %s" % DEMANDS)
if not ART.exists():
problems.append("artifact missing: %s" % ART)
if not problems:
seed = json.loads(DEMANDS.read_text(encoding="utf-8"))
art = json.loads(ART.read_text(encoding="utf-8"))
if len(seed.get("demands", [])) != 8:
problems.append("seed demands != 8")
exp = expected(seed)
got = {i["id"]: i.get("category") for i in art.get("items", [])}
if set(exp) != set(got):
problems.append("id sets differ: %s vs %s"
% (sorted(exp), sorted(got)))
for iid, want in sorted(exp.items()):
if got.get(iid) != want:
problems.append(
"id %s: got %r, expected %r" % (iid, got.get(iid), want))
from collections import Counter
exp_items = dict(exp)
exp_counts = dict(Counter(exp.values()))
if art.get("categories") != exp_counts:
problems.append(
"categories %r != re-derived counts %r"
% (art.get("categories"), exp_counts))
want_counts = {}
for v in exp.values():
want_counts[v] = want_counts.get(v, 0) + 1
if art.get("categories") != want_counts:
problems.append(
"category counts %r != %r" % (art.get("categories"), want_counts))
want_sha = hashlib.sha256(DEMANDS.read_bytes()).hexdigest()
if art.get("seed_sha256") != want_sha:
problems.append(
"seed_sha256 %r != %r" % (art.get("seed_sha256"), want_sha))
if art.get("count") != len(seed.get("demands", [])):
problems.append("count field %r != %r"
% (art.get("count"), len(seed.get("demands", []))))
if problems:
print("FAIL")
for p in problems:
print(" -", p)
return 1
print("PASS: Demands-ClassTriage-2026-10-31.json re-derives 8/8 demands "
"from evidence; categories=%s" % (art.get("categories")))
return 0
if __name__ == "__main__":
sys.exit(main())