{ "build_script": "", "build_workdir": ".", "bundle_artifact": "", "decision_relevant_fields": [ "adapter_state.compact" ], "execution_mode": "node", "expected_page_errors": [], "instance_id": "googleapis_proto-plus-python_pr336", "language": "python", "payload": {}, "predicate_description": "The compact JSON output equals the expected single-line string with no newlines.", "predicate_js": "(s) => s.adapter_state.compact === '{\"massKg\": 100, \"name\": \"no_new_lines_squid\"}'", "product_output_kind": "rendered_document", "program_js": "import html\nimport json\nimport os\nimport sys\n\nsys.path.insert(0, \"/testbed\")\n\n\ndef main():\n state = {\n \"compact\": None,\n \"pretty\": None,\n \"compact_error\": None,\n \"pretty_error\": None,\n }\n\n try:\n import proto\n\n class Squid(proto.Message):\n mass_kg = proto.Field(proto.INT32, number=1)\n name = proto.Field(proto.STRING, number=2)\n\n s = Squid(mass_kg=100, name=\"no_new_lines_squid\")\n\n try:\n state[\"compact\"] = Squid.to_json(s, indent=None)\n except Exception as e:\n state[\"compact_error\"] = {\n \"type\": type(e).__name__,\n \"message\": str(e),\n }\n\n try:\n state[\"pretty\"] = Squid.to_json(s, indent=2)\n except Exception as e:\n state[\"pretty_error\"] = {\n \"type\": type(e).__name__,\n \"message\": str(e),\n }\n except Exception as e:\n state[\"import_error\"] = {\n \"type\": type(e).__name__,\n \"message\": str(e),\n }\n\n state[\"compact_has_newlines\"] = (\n isinstance(state[\"compact\"], str) and \"\\n\" in state[\"compact\"]\n )\n state[\"pretty_has_newlines\"] = (\n isinstance(state[\"pretty\"], str) and \"\\n\" in state[\"pretty\"]\n )\n\n output_path = sys.argv[2]\n\n if state[\"compact\"] is not None:\n compact_display = state[\"compact\"]\n compact_class = \"json-output\"\n elif state.get(\"compact_error\"):\n compact_display = (\n f\"Error: {state['compact_error']['type']}: \"\n f\"{state['compact_error']['message']}\"\n )\n compact_class = \"json-output error\"\n else:\n compact_display = \"N/A\"\n compact_class = \"json-output error\"\n\n if state[\"pretty\"] is not None:\n pretty_display = state[\"pretty\"]\n pretty_class = \"json-output\"\n elif state.get(\"pretty_error\"):\n pretty_display = (\n f\"Error: {state['pretty_error']['type']}: \"\n f\"{state['pretty_error']['message']}\"\n )\n pretty_class = \"json-output error\"\n else:\n pretty_display = \"N/A\"\n pretty_class = \"json-output error\"\n\n state_json = json.dumps(state).replace(\"<\", \"\\\\u003c\")\n\n page = f\"\"\"\n\n\n\nproto-plus to_json indent\n\n\n\n

proto-plus Message.to_json indent parameter

\n

indent=None (compact)

\n
{html.escape(compact_display)}
\n

indent=2 (pretty-printed)

\n
{html.escape(pretty_display)}
\n\n\n\"\"\"\n\n with open(output_path, \"w\", encoding=\"utf-8\") as f:\n f.write(page)\n\n trace_path = os.environ.get(\"WMMB_MODULE_TRACE_PATH\")\n if trace_path:\n loaded = sorted(\n {\n m.__file__\n for m in sys.modules.values()\n if getattr(m, \"__file__\", None) and \"/testbed/\" in m.__file__\n }\n )\n with open(trace_path, \"w\", encoding=\"utf-8\") as f:\n json.dump({\"repository_modules_loaded\": loaded}, f)\n\n\nif __name__ == \"__main__\":\n main()", "rationale": "Calling to_json with indent=None should return a single-line compact JSON string, but the buggy revision rejects the indent keyword and throws TypeError.", "repo": "googleapis/proto-plus-python", "schema_version": "worldmodelmmbench.render-probe.v3", "title": "Message.to_json indent=None produces compact JSON", "viewport": [ 1280, 960 ], "volatile_fields": [] }