docs: align lookback test purpose and spec normalization list

Honest test docstring (old/new semantics equivalent on contiguous
entries; test locks post-fix behavior against future regressions),
and add severity-prefix strip to the spec's normalization list.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-04 15:39:44 +00:00
parent 2e7bebc911
commit fdf70a0c06
2 changed files with 15 additions and 8 deletions

View File

@@ -169,12 +169,15 @@ class RawLineLookbackTests(unittest.TestCase):
path.unlink()
def test_multiline_entry_does_not_shrink_practical_lookback(self) -> None:
"""Multi-line entries inside the lookback window do not break
attribution. (Old body-line-budget and new raw-line-distance semantics
happen to be equivalent on contiguous PZ entries; this test locks the
post-fix semantic against future regression to a budget that *would*
differ — e.g. a body-line cap with a smaller value.)
"""
# Layout the file so a multi-line entry sits between marker and ERROR.
# Under the OLD body-line-budget semantics the multi-line entry's 5
# continuation lines would consume the budget and push the marker
# outside the window. Under raw-line semantics the marker on line 1 is
# still within 40 raw lines of the ERROR even though the file has a
# 6-line multi-line entry in between.
# The marker on line 1 is within 40 raw lines of the ERROR even though
# the file has a 6-line multi-line entry in between.
lines = [_make_marker_line(0)] # raw line 1: marker entry
# Single-line fillers on raw lines 2..30 (29 entries).
for i in range(1, 30):
@@ -207,9 +210,11 @@ class RawLineLookbackTests(unittest.TestCase):
self.assertEqual(entries[-1].line_start, 41)
records = pz_parser.classify_entries(entries, source_file="ml.txt")
self.assertEqual(len(records), 1)
# Under the OLD body-line-budget rule, the 5 stack-frame lines
# plus the surrounding fillers would have pushed the marker out
# of the budget. Under raw-line semantics it survives.
# Raw-line-distance semantics: the marker on line 1 is 40 raw
# lines from the ERROR on line 41, so attribution holds. (Old
# body-line-budget would also pass here on contiguous entries;
# this assertion locks the post-fix behavior against future
# regression to a tighter cap.)
self.assertEqual(records[0].attribution, "inferred")
self.assertEqual(records[0].mod_id, "testmodalpha")
finally: