fix: always report broken internal links + show source pages
Previously, broken links that were part of the baseline ("known broken")
disappeared from the terminal output (score=0, no Klartext mention).
- differ.py: build reverse link index to record which pages link to
each broken URL; "pages" field added to new_broken/known_broken entries
- plain.py: klartext_befunde() now includes known_broken_urls alongside
new_broken_urls — broken links are always reported until fixed
- __main__.py: report shows "gefunden auf: <page>" for every broken entry,
known entries labelled "[bekannt, noch nicht behoben]"
- 3 new tests (169 total)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
30ac95a5cf
commit
b01344dcd8
5 changed files with 57 additions and 6 deletions
|
|
@ -70,6 +70,20 @@ class TestKlartextBefunde:
|
|||
assert any("funktionieren" in s.lower() or "website" in s.lower() for s in saetze)
|
||||
_no_jargon(saetze)
|
||||
|
||||
def test_new_broken_internal_link_plain(self):
|
||||
diff = {"new_broken_urls": [{"url": "https://x.de/gone", "status": 404, "pages": []}]}
|
||||
saetze = klartext_befunde(diff)
|
||||
assert any("leere" in s.lower() or "gefunden" in s.lower() for s in saetze)
|
||||
_no_jargon(saetze)
|
||||
|
||||
def test_known_broken_link_still_reported(self):
|
||||
"""known_broken_urls must appear in Klartext even with score=0."""
|
||||
diff = {"known_broken_urls": [{"url": "https://x.de/old", "status": 404, "pages": []}]}
|
||||
saetze = klartext_befunde(diff)
|
||||
assert any("leere" in s.lower() or "gefunden" in s.lower() for s in saetze), \
|
||||
"known_broken_urls müssen auch bei Score=0 im Klartext erscheinen"
|
||||
_no_jargon(saetze)
|
||||
|
||||
|
||||
class TestWasTun:
|
||||
def test_red_has_urgent_steps(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue