Answer architecture round 1: 0 🔴, 2 🟡; finish "record", record the three meanings as a decision, name rule-hook's check once

This commit is contained in:
2026-10-23 10:54:24 +02:00
parent 8d2a1cf9fd
commit 387a5ce506
23 changed files with 113 additions and 102 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ def trust(config: pathlib.Path, roots: list[str]) -> None:
def mark_trusted(config: object, roots: list[str]) -> tuple[dict, list[str]] | Failure:
if not isinstance(config, dict) or not isinstance(projects := config.get("projects", {}), dict):
return Failure('not an object whose "projects" is an object')
if (wrong := next((path for path, record in projects.items() if not isinstance(record, dict)), None)) is not None:
if (wrong := next((path for path, settings in projects.items() if not isinstance(settings, dict)), None)) is not None:
return Failure(f"projects[{json.dumps(wrong)}] is not an object")
untrusted = [path for path in roots if not projects.get(path, {}).get("hasTrustDialogAccepted")]
marked = {path: {**projects.get(path, {}), "hasTrustDialogAccepted": True} for path in untrusted}