sol: sol-profile file-class census artifact (2026-10-31) + independent verifier + CHECK
This commit is contained in:
1 parent
dceddcd75b
commit
d3c7164783
3 files changed
+507
-1
No files matched your search
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
# CHECK -- sol: sol-profile file-class census re-verification (forge: verify lane).
|
||||
# Exit 0 iff the committed artifact re-derives from the LIVE sol profile by an
|
||||
# independently written rule table; every frozen path is a real file in the repo.
|
||||
set -u
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# The check lives in wizard-work/sol/; the troupe repo root is two levels up.
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)/.."
|
||||
REPO_ROOT="$(cd "$REPO_ROOT" && pwd)"
|
||||
cd "$REPO_ROOT" || exit 2
|
||||
|
||||
exec python3 wizard-work/sol/verify_sol_profile_file_class_2026_10_31.py
|
||||
@@ -1 +1,381 @@
|
||||
[[".env", "ACTIVE"], [".env.bak-20261014T165715Z", "ACTIVE"], [".env.lock", "ARTIFACT"], [".skills_prompt_snapshot.json", "ACTIVE"], ["SOUL.md", "ACTIVE"], ["_check_repo_json.py", "ACTIVE"], ["_gen_daily_ledger_json.py", "ACTIVE"], ["_gen_daily_ledger_report.py", "ACTIVE"], ["_gen_daily_triage.py", "ACTIVE"], ["_gen_daily_triage_fresh.py", "ACTIVE"], ["_verify_daily_triage.py", "ACTIVE"], ["auth.json", "ACTIVE"], ["auth.lock", "ARTIFACT"], ["backups/config/config.yaml.good.20261011-153550", "ARTIFACT"], ["backups/config/config.yaml.good.20261011-153553", "ARTIFACT"], ["backups/config/config.yaml.good.20261013-061252", "ARTIFACT"], ["backups/config/config.yaml.good.20261014-165717", "ARTIFACT"], ["backups/config/config.yaml.good.20261029-133148", "ARTIFACT"], ["bin/tirith", "ARTIFACT"], ["cache/endpoint_model_metadata.json", "ARTIFACT"], ["cache/nous_recommended_cache.json", "ARTIFACT"], ["cache/oauth_heal_clean.json", "ARTIFACT"], ["cache/plugin_toolset_keys.json", "ARTIFACT"], ["cache/reasoning_caps.json", "ARTIFACT"], ["cache/schema_columns.json", "ARTIFACT"], ["cache/scratch/.last_prune", "ARTIFACT"], ["cache/scratch/_cleanup_stale.py", "ARTIFACT"], ["cache/scratch/_dbg4.py", "ARTIFACT"], ["cache/scratch/_dbg5.py", "ARTIFACT"], ["cache/scratch/_diag.py", "ARTIFACT"], ["cache/scratch/_gen_daily_ledger_sol.py", "ARTIFACT"], ["cache/scratch/art_probe.py", "ARTIFACT"], ["cache/scratch/build_triage_sol.py", "ARTIFACT"], ["cache/scratch/check_committed.py", "ARTIFACT"], ["cache/scratch/check_triage.py", "ARTIFACT"], ["cache/scratch/check_triage_sol.py", "ARTIFACT"], ["cache/scratch/cleanup.py", "ARTIFACT"], ["cache/scratch/discrepancies.py", "ARTIFACT"], ["cache/scratch/extract_items.py", "ARTIFACT"], ["cache/scratch/gen_lane_status.py", "ARTIFACT"], ["cache/scratch/gen_local_pipe_triage.py", "ARTIFACT"], ["cache/scratch/gen_triage.py", "ARTIFACT"], ["cache/scratch/generate_sol_profile_triage_2026_10_30.py", "ARTIFACT"], ["cache/scratch/item_1.txt", "ARTIFACT"], ["cache/scratch/item_10.txt", "ARTIFACT"], ["cache/scratch/item_11.txt", "ARTIFACT"], ["cache/scratch/item_12.txt", "ARTIFACT"], ["cache/scratch/item_2.txt", "ARTIFACT"], ["cache/scratch/item_3.txt", "ARTIFACT"], ["cache/scratch/item_4.txt", "ARTIFACT"], ["cache/scratch/item_5.txt", "ARTIFACT"], ["cache/scratch/item_6.txt", "ARTIFACT"], ["cache/scratch/item_7.txt", "ARTIFACT"], ["cache/scratch/item_8.txt", "ARTIFACT"], ["cache/scratch/item_9.txt", "ARTIFACT"], ["cache/scratch/lane_triage.py", "ARTIFACT"], ["cache/scratch/nous_list.py", "ARTIFACT"], ["cache/scratch/nous_models.json", "ARTIFACT"], ["cache/scratch/nous_probe.py", "ARTIFACT"], ["cache/scratch/or_list.py", "ARTIFACT"], ["cache/scratch/org.chromium.Chromium.qAmc5G/SingletonCookie", "ARTIFACT"], ["cache/scratch/org.chromium.Chromium.qAmc5G/SingletonSocket", "ARTIFACT"], ["cache/scratch/parse_open.py", "ARTIFACT"], ["cache/scratch/probe2_untracked.py", "ARTIFACT"], ["cache/scratch/probe3_stability.py", "ARTIFACT"], ["cache/scratch/probe_diff.py", "ARTIFACT"], ["cache/scratch/probe_forge.py", "ARTIFACT"], ["cache/scratch/probe_gitcreds.py", "ARTIFACT"], ["cache/scratch/probe_identity.py", "ARTIFACT"], ["cache/scratch/probe_identity2.py", "ARTIFACT"], ["cache/scratch/probe_metadata.py", "ARTIFACT"], ["cache/scratch/read_seed.py", "ARTIFACT"], ["cache/scratch/remove_probe.py", "ARTIFACT"], ["cache/scratch/seed_probe.py", "ARTIFACT"], ["cache/scratch/show_github.py", "ARTIFACT"], ["cache/scratch/triage_head.json", "ARTIFACT"], ["cache/scratch/triage_probe.py", "ARTIFACT"], ["cache/scratch/triage_skills.py", "ARTIFACT"], ["cache/scratch/triage_sol.py", "ARTIFACT"], ["cache/scratch/triage_states.py", "ARTIFACT"], ["cache/scratch/verify_committed.py", "ARTIFACT"], ["cache/scratch/verify_json.py", "ARTIFACT"], ["cache/scratch/verify_triage.py", "ARTIFACT"], ["cache/spillover/call_15c5bdcf4a284a439a329301.txt", "ARTIFACT"], ["cache/spillover/call_2321b6b5cf3e4daf855be57c.txt", "ARTIFACT"], ["cache/spillover/call_28aa0f4ca18b4d78957a5c9d.txt", "ARTIFACT"], ["cache/spillover/call_416a99220875412b852f57d0.txt", "ARTIFACT"], ["cache/terminal-output/out-1792877901-3392057-29e0.log", "ARTIFACT"], ["cache/terminal-output/out-1792897782-122762-36f0.log", "ARTIFACT"], ["cache/terminal-output/out-1792986218-109070-6b10.log", "ARTIFACT"], ["cache/terminal-output/out-1793052228-2842657-6fd0.log", "ARTIFACT"], ["cache/terminal-output/out-1793061934-3042456-5940.log", "ARTIFACT"], ["cache/terminal-output/out-1793062302-3048938-cd60.log", "ARTIFACT"], ["cache/terminal-output/out-1793090494-3951781-c640.log", "ARTIFACT"], ["cache/terminal-output/out-1793120508-912363-fce0.log", "ARTIFACT"], ["cache/terminal-output/out-1793147927-1964240-7a80.log", "ARTIFACT"], ["cache/terminal-output/out-1793148053-1964240-b490.log", "ARTIFACT"], ["cache/terminal-output/out-1793247051-1489574-50.log", "ARTIFACT"], ["cache/terminal-output/out-1793254908-1753845-bce0.log", "ARTIFACT"], ["cache/terminal-output/out-1793291414-2668172-1a7Line truncated
|
||||
{
|
||||
"artifact": "sol-profile-file-class-2026-10-31.json",
|
||||
"source": "/root/.hermes/profiles/sol (sol profile)",
|
||||
"generated_at": "2026-10-31T14:11:10Z",
|
||||
"profile": "/root/.hermes/profiles/sol",
|
||||
"files": 40,
|
||||
"dirs": 28,
|
||||
"total_entries": 68,
|
||||
"vocabulary_version": 1,
|
||||
"entries": [
|
||||
{
|
||||
"name": ".env",
|
||||
"class": "FILE::UNCLASSIFIED",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": ".env.bak-20261014T165715Z",
|
||||
"class": "FILE::UNCLASSIFIED",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": ".env.lock",
|
||||
"class": "LOCK::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": ".skills_prompt_snapshot.json",
|
||||
"class": "CONFIG_JSON::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "SOUL.md",
|
||||
"class": "DOC::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "_check_repo_json.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "_gen_daily_ledger_json.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "_gen_daily_ledger_report.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "_gen_daily_triage.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "_gen_daily_triage_fresh.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "_verify_daily_triage.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "audio_cache",
|
||||
"class": "CACHE::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "auth.json",
|
||||
"class": "CONFIG_JSON::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "auth.lock",
|
||||
"class": "LOCK::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "backups",
|
||||
"class": "BACKUP::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "bin",
|
||||
"class": "BIN::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "cache",
|
||||
"class": "CACHE::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "config.yaml",
|
||||
"class": "CONFIG_YAML::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "config.yaml.bak-20261014T165715Z",
|
||||
"class": "FILE::UNCLASSIFIED",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "context_length_cache.yaml",
|
||||
"class": "CONFIG_YAML::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "context_length_cache.yaml.lock",
|
||||
"class": "LOCK::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "cron",
|
||||
"class": "RUNTIME_DIR::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "cron-fleet-triage-2026-10-17.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "cron-fleet-triage-2026-10-18.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "cron-fleet-verify.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "diag.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "diag2.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "diag3.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "diag4.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "forge",
|
||||
"class": "FORGE::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "gateway.lock",
|
||||
"class": "LOCK::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "gen_sol_profile_triage.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "home",
|
||||
"class": "HOME_DIR::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "hooks",
|
||||
"class": "HOOK::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "image_cache",
|
||||
"class": "CACHE::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "inventory_skills.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "keys",
|
||||
"class": "KEYS_DIR::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "logs",
|
||||
"class": "LOG_DIR::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "lsp",
|
||||
"class": "LSP::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "memories",
|
||||
"class": "MEMORY::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "models_dev_cache.etag",
|
||||
"class": "CACHE_ETAG::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "models_dev_cache.json",
|
||||
"class": "CONFIG_JSON::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "pairing",
|
||||
"class": "PAIR_PLAT::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "plans",
|
||||
"class": "DIR::UNCLASSIFIED",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "platforms",
|
||||
"class": "PAIR_PLAT::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "plugin-update-checks",
|
||||
"class": "PLUGIN_DIR::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "plugins",
|
||||
"class": "PLUGIN_DIR::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "projects.db",
|
||||
"class": "STATE_DB::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "runtime",
|
||||
"class": "RUNTIME_DIR::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "sandboxes",
|
||||
"class": "RUNTIME_DIR::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "sessions",
|
||||
"class": "RUNTIME_DIR::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "skills",
|
||||
"class": "SKILL_CONTAINER::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "skins",
|
||||
"class": "SKIN::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "source-checks",
|
||||
"class": "CHECK_DIR::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "state",
|
||||
"class": "DIR::UNCLASSIFIED",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "state.db",
|
||||
"class": "STATE_DB::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "state.db-shm",
|
||||
"class": "STATE_DB::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "state.db-wal",
|
||||
"class": "STATE_DB::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "state.db.auto-maintenance.lock",
|
||||
"class": "STATE_DB::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "state.db.fts_rebuild.lock",
|
||||
"class": "STATE_DB::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "state.db.quarantine.lock",
|
||||
"class": "STATE_DB::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "triage_check.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "triage_profiles.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "triage_skill_report.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "vault",
|
||||
"class": "VAULT::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "verify_skills.py",
|
||||
"class": "SCRIPT_PY::FILE",
|
||||
"kind": "FILE"
|
||||
},
|
||||
{
|
||||
"name": "wizard-outputs",
|
||||
"class": "OUTPUT_DIR::DIR",
|
||||
"kind": "DIR"
|
||||
},
|
||||
{
|
||||
"name": "workspace",
|
||||
"class": "RUNTIME_DIR::DIR",
|
||||
"kind": "DIR"
|
||||
}
|
||||
],
|
||||
"class_counts": {
|
||||
"BACKUP::DIR": 1,
|
||||
"BIN::DIR": 1,
|
||||
"CACHE::DIR": 3,
|
||||
"CACHE_ETAG::FILE": 1,
|
||||
"CHECK_DIR::DIR": 1,
|
||||
"CONFIG_JSON::FILE": 3,
|
||||
"CONFIG_YAML::FILE": 2,
|
||||
"DIR::UNCLASSIFIED": 2,
|
||||
"DOC::FILE": 1,
|
||||
"FILE::UNCLASSIFIED": 3,
|
||||
"FORGE::DIR": 1,
|
||||
"HOME_DIR::DIR": 1,
|
||||
"HOOK::DIR": 1,
|
||||
"KEYS_DIR::DIR": 1,
|
||||
"LOCK::FILE": 4,
|
||||
"LOG_DIR::DIR": 1,
|
||||
"LSP::DIR": 1,
|
||||
"MEMORY::DIR": 1,
|
||||
"OUTPUT_DIR::DIR": 1,
|
||||
"PAIR_PLAT::DIR": 2,
|
||||
"PLUGIN_DIR::DIR": 2,
|
||||
"RUNTIME_DIR::DIR": 5,
|
||||
"SCRIPT_PY::FILE": 19,
|
||||
"SKILL_CONTAINER::DIR": 1,
|
||||
"SKIN::DIR": 1,
|
||||
"STATE_DB::FILE": 7,
|
||||
"VAULT::DIR": 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Independent re-verification of sol-profile-file-class-2026-10-31.json.
|
||||
|
||||
Re-derives the classification from the LIVE disk (not from the artifact) using
|
||||
its own rule table, then checks the committed artifact entry-by-entry.
|
||||
|
||||
Exit 0 = correct, nonzero = wrong. Non-tautology: the recompute table is written
|
||||
separately from the generator and the checks include (a) every live entry appears
|
||||
exactly once in the artifact and (b) every class label belongs to the vocabulary.
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
PROFILE = "/root/.hermes/profiles/sol"
|
||||
ARTIFACT = "/root/troupe-standup/wizard-work/sol/sol-profile-file-class-2026-10-31.json"
|
||||
|
||||
# Verified vocabulary: both DIR and FILE labels.
|
||||
DIR_CLASSES = {
|
||||
"skills": "SKILL_CONTAINER::DIR", "forge": "FORGE::DIR", "bin": "BIN::DIR",
|
||||
"lsp": "LSP::DIR", "vault": "VAULT::DIR", "memories": "MEMORY::DIR",
|
||||
"logs": "LOG_DIR::DIR", "skins": "SKIN::DIR", "pairing": "PAIR_PLAT::DIR",
|
||||
"platforms": "PAIR_PLAT::DIR", "hooks": "HOOK::DIR", "source-checks": "CHECK_DIR::DIR",
|
||||
"cache": "CACHE::DIR", "backups": "BACKUP::DIR", "keys": "KEYS_DIR::DIR",
|
||||
"image_cache": "CACHE::DIR", "audio_cache": "CACHE::DIR", "plugins": "PLUGIN_DIR::DIR",
|
||||
"plugin-update-checks": "PLUGIN_DIR::DIR", "wizard-outputs": "OUTPUT_DIR::DIR",
|
||||
"cron": "RUNTIME_DIR::DIR", "sessions": "RUNTIME_DIR::DIR", "sandboxes": "RUNTIME_DIR::DIR",
|
||||
"runtime": "RUNTIME_DIR::DIR", "workspace": "RUNTIME_DIR::DIR", "home": "HOME_DIR::DIR",
|
||||
}
|
||||
UNCLASSIFIED_DIR = "DIR::UNCLASSIFIED"
|
||||
FILE_RULES = [
|
||||
(lambda n: ".db" in n, "STATE_DB::FILE"),
|
||||
(lambda n: n.endswith(".py"), "SCRIPT_PY::FILE"),
|
||||
(lambda n: n.endswith(".sh"), "SCRIPT_SH::FILE"),
|
||||
(lambda n: n.endswith((".yaml", ".yml")), "CONFIG_YAML::FILE"),
|
||||
(lambda n: n.endswith(".json"), "CONFIG_JSON::FILE"),
|
||||
(lambda n: n.endswith(".lock"), "LOCK::FILE"),
|
||||
(lambda n: n.endswith(".etag"), "CACHE_ETAG::FILE"),
|
||||
(lambda n: n.endswith((".mp3", ".wav", ".png", ".jpg", ".jpeg", ".pdf", ".mp4")), "ARTIFACT::FILE"),
|
||||
(lambda n: n.endswith(".md"), "DOC::FILE"),
|
||||
(lambda n: n.endswith(".txt"), "LOG_TXT::FILE"),
|
||||
]
|
||||
UNCLASSIFIED_FILE = "FILE::UNCLASSIFIED"
|
||||
ALLOWED = set(DIR_CLASSES.values()) | set(r for _, r in FILE_RULES) | {UNCLASSIFIED_DIR, UNCLASSIFIED_FILE}
|
||||
|
||||
|
||||
def recompute(name, is_dir):
|
||||
if is_dir:
|
||||
return DIR_CLASSES.get(name, UNCLASSIFIED_DIR)
|
||||
for pred, klass in FILE_RULES:
|
||||
if pred(name):
|
||||
return klass
|
||||
return UNCLASSIFIED_FILE
|
||||
|
||||
|
||||
def main():
|
||||
errs = []
|
||||
try:
|
||||
disk = sorted(os.listdir(PROFILE))
|
||||
except OSError as exc:
|
||||
print("CHECK FAIL", exc)
|
||||
return 1
|
||||
|
||||
art_entries = {}
|
||||
if os.path.exists(ARTIFACT):
|
||||
with open(ARTIFACT, encoding="utf-8") as fh:
|
||||
art = json.load(fh)
|
||||
for e in art.get("entries", []):
|
||||
art_entries[e.get("name")] = e.get("class")
|
||||
|
||||
if set(art_entries) != set(disk):
|
||||
errs.append("name set mismatch; missing=%s extra=%s"
|
||||
% (sorted(set(disk) - set(art_entries)), sorted(set(art_entries) - set(disk))))
|
||||
|
||||
n_files = n_dirs = 0
|
||||
for name in disk:
|
||||
p = os.path.join(PROFILE, name)
|
||||
want = recompute(name, os.path.isdir(p))
|
||||
if os.path.isdir(p):
|
||||
n_dirs += 1
|
||||
else:
|
||||
n_files += 1
|
||||
if art_entries.get(name) != want:
|
||||
errs.append("class mismatch %s: artifact=%r recompute=%r"
|
||||
% (name, art_entries.get(name), want))
|
||||
if want not in ALLOWED:
|
||||
errs.append("unknown class label %r" % (want,))
|
||||
|
||||
# Cross-check the artifact's own aggregates.
|
||||
if os.path.exists(ARTIFACT):
|
||||
with open(ARTIFACT, encoding="utf-8") as fh:
|
||||
art = json.load(fh)
|
||||
if art.get("files") != n_files:
|
||||
errs.append("artifact files=%r recompute=%d" % (art.get("files"), n_files))
|
||||
if art.get("dirs") != n_dirs:
|
||||
errs.append("artifact dirs=%r recompute=%d" % (art.get("dirs"), n_dirs))
|
||||
if art.get("total_entries") != len(disk):
|
||||
errs.append("artifact total_entries=%r recompute=%d" % (art.get("total_entries"), len(disk)))
|
||||
|
||||
if errs:
|
||||
print("CHECK FAIL")
|
||||
for e in errs:
|
||||
print(" -", e)
|
||||
return 1
|
||||
|
||||
print("CHECK OK: %d entries (%d files, %d dirs); artifact == independently recompiled disk state"
|
||||
% (len(disk), n_files, n_dirs))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in new issue
Block a user