diff --git a/src/void_tools/constitutional_linter.py b/src/void_tools/constitutional_linter.py index fcc8b3d..6987012 100755 --- a/src/void_tools/constitutional_linter.py +++ b/src/void_tools/constitutional_linter.py @@ -27,9 +27,26 @@ def lint_outbox(filepath): except Exception as e: logging.error(f"Failed to read outbox: {e}") return False - - if not data or 'actions' not in data: - return True + + if not data: + logging.error("Outbox file is empty or invalid YAML.") + return False + + # Schema validation: must have 'actions' key + if 'actions' not in data: + # Check for legacy schema (posts: at root with reply_to) + if 'posts' in data: + logging.error("Schema mismatch: Outbox uses legacy format ('posts:' at root).") + logging.error(" Expected: 'config:' and 'actions:' structure") + logging.error(" Migrate: wrap posts in action blocks with 'action: reply' and 'target_id'") + else: + logging.error("Schema validation failed: 'actions' key not found in outbox.") + return False + + actions = data.get('actions', []) + if not isinstance(actions, list): + logging.error("Schema validation failed: 'actions' must be a list.") + return False has_errors = False