{"abstract":"Very long signatures overflow the hunk header.","category":"Text diff and three-way merge","checks":8,"contract":"For each hunk whose old range starts at 1-based line s, search the old lines strictly before s, nearest first, for a line whose first character is a letter, \"_\" or \"$\". The heading is that line with trailing whitespace removed, truncated to limit characters; \"\" if none.","contract_signature":"old, starts, limit","evaluation_group":"w2-text-diff-merge-hunk-function-context","failed_approach":"Truncating to one less than the limit cuts every long heading short by a character.","family":"w2-text-diff-merge-hunk-function-context-heading-truncation","id":"FA-75796","implementations":{"attempt":{"sha256":"ea1ff680f070f8347f705dbd3eb06e014fed47132ed3bbd0afd54f87efa5b17b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(old, starts, limit):\n    res = []\n    for s in starts:\n        found = ''\n        for k in range(s - 2, -1, -1):\n            ln = old[k]\n            if ln[:1].isalpha() or ln[:1] in ('_', '$'):\n                found = ln.rstrip()[:limit - 1]\n                break\n        res.append(found)\n    return res\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = {\n    1: [('nearest preceding definition', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [5], 40], ['int main(void)']), ('the hunk start line itself is not searched', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [2, 3], 40], ['', 'int main(void)']), ('indented lines are not headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [6], 40], ['int main(void)']), ('dollar and underscore headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [10, 12], 40], ['$macro', '_private:']), ('nothing before the first line', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [1], 40], ['']), ('long heading is truncated', [['def xxxxxxxxxxxxxxxxxxxxx(): ', '    pass', '    pass'], [3], 11], ['def xxxxxxx']), ('digits do not start a heading', [['label:', '42 items', 'y'], [3], 40], ['label:']), ('trailing whitespace trimmed', [['Section   ', 'text', 'more'], [3], 40], ['text'])],\n    2: [('nearest preceding definition', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [5], 40], ['int main(void)']), ('the hunk start line itself is not searched', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [2, 3], 40], ['', 'int main(void)']), ('indented lines are not headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [6], 40], ['int main(void)']), ('dollar and underscore headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [10, 12], 40], ['$macro', '_private:']), ('nothing before the first line', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [1], 40], ['']), ('long heading is truncated', [['def xxxxxxxxxxxxxxxxxxxxxx(): ', '    pass', '    pass'], [3], 12], ['def xxxxxxxx']), ('digits do not start a heading', [['label:', '42 items', 'y'], [3], 40], ['label:']), ('trailing whitespace trimmed', [['Section   ', 'text', 'more'], [3], 40], ['text'])],\n    3: [('nearest preceding definition', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [5], 40], ['int main(void)']), ('the hunk start line itself is not searched', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [2, 3], 40], ['', 'int main(void)']), ('indented lines are not headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [6], 40], ['int main(void)']), ('dollar and underscore headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [10, 12], 40], ['$macro', '_private:']), ('nothing before the first line', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [1], 40], ['']), ('long heading is truncated', [['def xxxxxxxxxxxxxxxxxxxxxxx(): ', '    pass', '    pass'], [3], 13], ['def xxxxxxxxx']), ('digits do not start a heading', [['label:', '42 items', 'y'], [3], 40], ['label:']), ('trailing whitespace trimmed', [['Section   ', 'text', 'more'], [3], 40], ['text'])],\n    4: [('nearest preceding definition', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [5], 40], ['int main(void)']), ('the hunk start line itself is not searched', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [2, 3], 40], ['', 'int main(void)']), ('indented lines are not headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [6], 40], ['int main(void)']), ('dollar and underscore headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [10, 12], 40], ['$macro', '_private:']), ('nothing before the first line', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [1], 40], ['']), ('long heading is truncated', [['def xxxxxxxxxxxxxxxxxxxxxxxx(): ', '    pass', '    pass'], [3], 14], ['def xxxxxxxxxx']), ('digits do not start a heading', [['label:', '42 items', 'y'], [3], 40], ['label:']), ('trailing whitespace trimmed', [['Section   ', 'text', 'more'], [3], 40], ['text'])],\n    5: [('nearest preceding definition', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [5], 40], ['int main(void)']), ('the hunk start line itself is not searched', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [2, 3], 40], ['', 'int main(void)']), ('indented lines are not headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [6], 40], ['int main(void)']), ('dollar and underscore headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [10, 12], 40], ['$macro', '_private:']), ('nothing before the first line', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [1], 40], ['']), ('long heading is truncated', [['def xxxxxxxxxxxxxxxxxxxxxxxxx(): ', '    pass', '    pass'], [3], 15], ['def xxxxxxxxxxx']), ('digits do not start a heading', [['label:', '42 items', 'y'], [3], 40], ['label:']), ('trailing whitespace trimmed', [['Section   ', 'text', 'more'], [3], 40], ['text'])],\n}[N]\nfor label, args, expected in cases:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"9a971b619b6c6037fc1263d5a559fb1df05d8aec359dc62b8f0aad808249ca1a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(old, starts, limit):\n    res = []\n    for s in starts:\n        found = ''\n        for k in range(s - 2, -1, -1):\n            ln = old[k]\n            if ln[:1].isalpha() or ln[:1] in ('_', '$'):\n                found = ln.rstrip()\n                break\n        res.append(found)\n    return res\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = {\n    1: [('nearest preceding definition', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [5], 40], ['int main(void)']), ('the hunk start line itself is not searched', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [2, 3], 40], ['', 'int main(void)']), ('indented lines are not headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [6], 40], ['int main(void)']), ('dollar and underscore headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [10, 12], 40], ['$macro', '_private:']), ('nothing before the first line', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [1], 40], ['']), ('long heading is truncated', [['def xxxxxxxxxxxxxxxxxxxxx(): ', '    pass', '    pass'], [3], 11], ['def xxxxxxx']), ('digits do not start a heading', [['label:', '42 items', 'y'], [3], 40], ['label:']), ('trailing whitespace trimmed', [['Section   ', 'text', 'more'], [3], 40], ['text'])],\n    2: [('nearest preceding definition', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [5], 40], ['int main(void)']), ('the hunk start line itself is not searched', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [2, 3], 40], ['', 'int main(void)']), ('indented lines are not headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [6], 40], ['int main(void)']), ('dollar and underscore headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [10, 12], 40], ['$macro', '_private:']), ('nothing before the first line', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [1], 40], ['']), ('long heading is truncated', [['def xxxxxxxxxxxxxxxxxxxxxx(): ', '    pass', '    pass'], [3], 12], ['def xxxxxxxx']), ('digits do not start a heading', [['label:', '42 items', 'y'], [3], 40], ['label:']), ('trailing whitespace trimmed', [['Section   ', 'text', 'more'], [3], 40], ['text'])],\n    3: [('nearest preceding definition', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [5], 40], ['int main(void)']), ('the hunk start line itself is not searched', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [2, 3], 40], ['', 'int main(void)']), ('indented lines are not headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [6], 40], ['int main(void)']), ('dollar and underscore headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [10, 12], 40], ['$macro', '_private:']), ('nothing before the first line', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [1], 40], ['']), ('long heading is truncated', [['def xxxxxxxxxxxxxxxxxxxxxxx(): ', '    pass', '    pass'], [3], 13], ['def xxxxxxxxx']), ('digits do not start a heading', [['label:', '42 items', 'y'], [3], 40], ['label:']), ('trailing whitespace trimmed', [['Section   ', 'text', 'more'], [3], 40], ['text'])],\n    4: [('nearest preceding definition', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [5], 40], ['int main(void)']), ('the hunk start line itself is not searched', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [2, 3], 40], ['', 'int main(void)']), ('indented lines are not headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [6], 40], ['int main(void)']), ('dollar and underscore headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [10, 12], 40], ['$macro', '_private:']), ('nothing before the first line', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [1], 40], ['']), ('long heading is truncated', [['def xxxxxxxxxxxxxxxxxxxxxxxx(): ', '    pass', '    pass'], [3], 14], ['def xxxxxxxxxx']), ('digits do not start a heading', [['label:', '42 items', 'y'], [3], 40], ['label:']), ('trailing whitespace trimmed', [['Section   ', 'text', 'more'], [3], 40], ['text'])],\n    5: [('nearest preceding definition', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [5], 40], ['int main(void)']), ('the hunk start line itself is not searched', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [2, 3], 40], ['', 'int main(void)']), ('indented lines are not headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [6], 40], ['int main(void)']), ('dollar and underscore headings', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [10, 12], 40], ['$macro', '_private:']), ('nothing before the first line', [['#include <x>', 'int main(void)', '{', '  int a;', '  helper();', '  return 0;', '}', '', '$macro', '  body', '_private:', '  x = 1'], [1], 40], ['']), ('long heading is truncated', [['def xxxxxxxxxxxxxxxxxxxxxxxxx(): ', '    pass', '    pass'], [3], 15], ['def xxxxxxxxxxx']), ('digits do not start a heading', [['label:', '42 items', 'y'], [3], 40], ['label:']), ('trailing whitespace trimmed', [['Section   ', 'text', 'more'], [3], 40], ['text'])],\n}[N]\nfor label, args, expected in cases:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"A deterministic, bounded teaching model of one diff, patch or merge rule with stipulated conventions; it is not a production diff or version-control implementation and makes no claim of conformance to any specific tool. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-text-diff-merge-hunk-function-context-heading-truncation","generated_at":"2026-09-29T14:49:10.267505+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"The text after the @@ header helps reviewers locate a hunk; choosing the wrong line or including the hunk itself misleads.","root_cause":"The heading is used without applying the length limit.","sha256":"94832932e2ae64f0c772ded174548903bc46c30ac46c8e4ef3589f9a51e23103","title":"Hunk function context: long headings are not truncated · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":40.184,"exit_code":1,"observations":[{"actual":["int main(void)"],"check":"nearest preceding definition","expected":["int main(void)"],"passed":true},{"actual":["","int main(void)"],"check":"the hunk start line itself is not searched","expected":["","int main(void)"],"passed":true},{"actual":["int main(void)"],"check":"indented lines are not headings","expected":["int main(void)"],"passed":true},{"actual":["$macro","_private:"],"check":"dollar and underscore headings","expected":["$macro","_private:"],"passed":true},{"actual":[""],"check":"nothing before the first line","expected":[""],"passed":true},{"actual":["def xxxxxx"],"check":"long heading is truncated","expected":["def xxxxxxx"],"passed":false},{"actual":["label:"],"check":"digits do not start a heading","expected":["label:"],"passed":true},{"actual":["text"],"check":"trailing whitespace trimmed","expected":["text"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"nearest preceding definition\", \"actual\": [\"int main(void)\"], \"expected\": [\"int main(void)\"], \"passed\": true}, {\"check\": \"the hunk start line itself is not searched\", \"actual\": [\"\", \"int main(void)\"], \"expected\": [\"\", \"int main(void)\"], \"passed\": true}, {\"check\": \"indented lines are not headings\", \"actual\": [\"int main(void)\"], \"expected\": [\"int main(void)\"], \"passed\": true}, {\"check\": \"dollar and underscore headings\", \"actual\": [\"$macro\", \"_private:\"], \"expected\": [\"$macro\", \"_private:\"], \"passed\": true}, {\"check\": \"nothing before the first line\", \"actual\": [\"\"], \"expected\": [\"\"], \"passed\": true}, {\"check\": \"long heading is truncated\", \"actual\": [\"def xxxxxx\"], \"expected\": [\"def xxxxxxx\"], \"passed\": false}, {\"check\": \"digits do not start a heading\", \"actual\": [\"label:\"], \"expected\": [\"label:\"], \"passed\": true}, {\"check\": \"trailing whitespace trimmed\", \"actual\": [\"text\"], \"expected\": [\"text\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.011,"exit_code":1,"observations":[{"actual":["int main(void)"],"check":"nearest preceding definition","expected":["int main(void)"],"passed":true},{"actual":["","int main(void)"],"check":"the hunk start line itself is not searched","expected":["","int main(void)"],"passed":true},{"actual":["int main(void)"],"check":"indented lines are not headings","expected":["int main(void)"],"passed":true},{"actual":["$macro","_private:"],"check":"dollar and underscore headings","expected":["$macro","_private:"],"passed":true},{"actual":[""],"check":"nothing before the first line","expected":[""],"passed":true},{"actual":["def xxxxxxxxxxxxxxxxxxxxx():"],"check":"long heading is truncated","expected":["def xxxxxxx"],"passed":false},{"actual":["label:"],"check":"digits do not start a heading","expected":["label:"],"passed":true},{"actual":["text"],"check":"trailing whitespace trimmed","expected":["text"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"nearest preceding definition\", \"actual\": [\"int main(void)\"], \"expected\": [\"int main(void)\"], \"passed\": true}, {\"check\": \"the hunk start line itself is not searched\", \"actual\": [\"\", \"int main(void)\"], \"expected\": [\"\", \"int main(void)\"], \"passed\": true}, {\"check\": \"indented lines are not headings\", \"actual\": [\"int main(void)\"], \"expected\": [\"int main(void)\"], \"passed\": true}, {\"check\": \"dollar and underscore headings\", \"actual\": [\"$macro\", \"_private:\"], \"expected\": [\"$macro\", \"_private:\"], \"passed\": true}, {\"check\": \"nothing before the first line\", \"actual\": [\"\"], \"expected\": [\"\"], \"passed\": true}, {\"check\": \"long heading is truncated\", \"actual\": [\"def xxxxxxxxxxxxxxxxxxxxx():\"], \"expected\": [\"def xxxxxxx\"], \"passed\": false}, {\"check\": \"digits do not start a heading\", \"actual\": [\"label:\"], \"expected\": [\"label:\"], \"passed\": true}, {\"check\": \"trailing whitespace trimmed\", \"actual\": [\"text\"], \"expected\": [\"text\"], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}