{ "build_script": "", "build_workdir": ".", "bundle_artifact": "", "decision_relevant_fields": [ "adapter_state.img_present_keep", "adapter_state.img_present_default" ], "execution_mode": "node", "expected_page_errors": [], "instance_id": "buriy_python-readability_pr190", "language": "python", "payload": {}, "predicate_description": "The summary with keep_all_images=True contains an img tag and the default summary does not.", "predicate_js": "(s) => s.adapter_state.img_present_keep === true && s.adapter_state.img_present_default === false", "product_output_kind": "rendered_document", "program_js": "import base64\nimport json\nimport os\nimport sys\n\nsys.path.insert(0, \"/testbed\")\n\nfrom readability import Document\n\n# The framework passes base64-encoded JSON in sys.argv[1].\ninput_payload = json.loads(base64.b64decode(sys.argv[1]).decode(\"utf-8\"))\noutput_path = sys.argv[2]\n\n# Sample HTML from the issue's test fixture, inlined so the probe never reads test files.\nSAMPLE_HTML = \"\"\"\n\n\n\n

\n \n H2 Headline H2 Headline H2 Headline H2 Headline H2 Headline H2 Headline H2 Headline H2 Headline H2 Headline H2 Headline\n \n

\n

\n \n Text Text Text Text Text Text Text Text Text Text\n \n

\n
\n \n \n \n \n \n
\n

\n \n Text Text Text Text Text Text Text Text Text Text\n \n

\n\n\"\"\"\n\nrender_ok = False\nerror = None\nsummary_keep = \"\"\nsummary_default = \"\"\n\ntry:\n doc = Document(SAMPLE_HTML)\n summary_keep = doc.summary(keep_all_images=True)\n # Create a fresh Document because summary() mutates internal state.\n doc2 = Document(SAMPLE_HTML)\n summary_default = doc2.summary()\n render_ok = True\nexcept Exception as exc:\n error = {\"name\": type(exc).__name__, \"message\": str(exc)}\n\nimg_present_keep = \"\", \">\")\n .replace('\"', \""\")\n )\n\npage = f\"\"\"\n\n\n\n{esc_html(input_payload.get(\"title\", \"readability keep_all_images\"))}\n\n\n\n

Readability summary output

\n
\n

keep_all_images=True

\n{summary_keep if render_ok else '

' + esc_html(error[\"name\"] + \": \" + error[\"message\"]) + '

'}\n
\n
\n

keep_all_images=False (default)

\n{summary_default if render_ok else '

' + esc_html(error[\"name\"] + \": \" + error[\"message\"]) + '

'}\n
\n
\n\n\n\"\"\"\n\nwith open(output_path, \"w\", encoding=\"utf-8\") as fh:\n fh.write(page)\n\ntrace_path = os.environ.get(\"WMMB_MODULE_TRACE_PATH\")\nif 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 fh:\n json.dump({\"repository_modules_loaded\": loaded}, fh)", "rationale": "Document.summary() on the issue's sample HTML strips the image by default; the fix adds keep_all_images=True so the image is retained.", "repo": "buriy/python-readability", "schema_version": "worldmodelmmbench.render-probe.v3", "title": "keep_all_images preserves image in readability summary", "viewport": [ 1280, 960 ], "volatile_fields": [] }