{"abstract":"Hunks inside labels or macros that start with \"_\" or \"$\" show an older heading.","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.","evaluation_group":"w2-text-diff-merge-hunk-function-context","failed_approach":"Adding only the underscore still ignores \"$\" headings.","family":"w2-text-diff-merge-hunk-function-context-heading-symbols","id":"FA-75801","implementations":{"attempt":{"sha256":"5524544a41146205b9097c80e58933c40c8ceadd0eca111e1b02ee1107a5500c","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] == '_':\n                found = ln.rstrip()[:limit]\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":"59c5073ff4557b3302dc7f48c73c075380ef9a90988c302e4305cf92e1ebc786","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():\n                found = ln.rstrip()[:limit]\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"},"fixed":{"sha256":"901da1a275d0f58e8736851aa5793dfd12de27b10320289125820fbedb2270c5","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]\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-symbols","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.","repair":"Also accept \"_\" and \"$\" as heading starts.","root_cause":"The predicate accepts only alphabetic first characters.","sha256":"c5efb8f24f2b7b99450a1f5b02c058dc69f66d6cfa6cb552dbf40bf7ae7da53c","title":"Hunk function context: underscore and dollar headings are ignored · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.573,"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":["int main(void)","_private:"],"check":"dollar and underscore headings","expected":["$macro","_private:"],"passed":false},{"actual":[""],"check":"nothing before the first line","expected":[""],"passed":true},{"actual":["def xxxxxxx"],"check":"long heading is truncated","expected":["def xxxxxxx"],"passed":true},{"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\": [\"int main(void)\", \"_private:\"], \"expected\": [\"$macro\", \"_private:\"], \"passed\": false}, {\"check\": \"nothing before the first line\", \"actual\": [\"\"], \"expected\": [\"\"], \"passed\": true}, {\"check\": \"long heading is truncated\", \"actual\": [\"def xxxxxxx\"], \"expected\": [\"def xxxxxxx\"], \"passed\": true}, {\"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.325,"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":["int main(void)","int main(void)"],"check":"dollar and underscore headings","expected":["$macro","_private:"],"passed":false},{"actual":[""],"check":"nothing before the first line","expected":[""],"passed":true},{"actual":["def xxxxxxx"],"check":"long heading is truncated","expected":["def xxxxxxx"],"passed":true},{"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\": [\"int main(void)\", \"int main(void)\"], \"expected\": [\"$macro\", \"_private:\"], \"passed\": false}, {\"check\": \"nothing before the first line\", \"actual\": [\"\"], \"expected\": [\"\"], \"passed\": true}, {\"check\": \"long heading is truncated\", \"actual\": [\"def xxxxxxx\"], \"expected\": [\"def xxxxxxx\"], \"passed\": true}, {\"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"},"fixed":{"elapsed_ms":38.065,"exit_code":0,"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 xxxxxxx"],"check":"long heading is truncated","expected":["def xxxxxxx"],"passed":true},{"actual":["label:"],"check":"digits do not start a heading","expected":["label:"],"passed":true},{"actual":["text"],"check":"trailing whitespace trimmed","expected":["text"],"passed":true}],"passed":true,"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 xxxxxxx\"], \"expected\": [\"def xxxxxxx\"], \"passed\": true}, {\"check\": \"digits do not start a heading\", \"actual\": [\"label:\"], \"expected\": [\"label:\"], \"passed\": true}, {\"check\": \"trailing whitespace trimmed\", \"actual\": [\"text\"], \"expected\": [\"text\"], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}