{"id":"result-normalization-helper-pattern","text":"FTL2 module results can be dicts, lists (multi-host), or objects with `.output`/`.success` attributes. Production apps use a `_result_dict()` helper to normalize these into plain dicts for reliable field access.","truth_value":"IN","source":"repo:ftl2-servercraft/ftl2_servercraft/scripts/neoforge.py","source_url":"","source_hash":"","justifications":[],"dependents":[],"metadata":{"example":"def _result_dict(result) -> dict:\n    if isinstance(result, dict):\n        return result\n    if isinstance(result, list) and result:\n        return _result_dict(result[0])\n    if hasattr(result, \"output\"):\n        return _result_dict(result.output)\n    return {}\n\ndef _failed(result) -> bool:\n    if hasattr(result, \"success\"):\n        return not result.success\n    d = _result_dict(result)\n    return d.get(\"failed\", False) or d.get(\"rc\", 0) != 0"},"explanation":{"steps":[{"node":"result-normalization-helper-pattern","truth_value":"IN","reason":"premise"}]}}