opencode-config/docs/handoff/pr-155-validate-switcher-anchor.md
Sergey 556a5b57eb
fix(create-readme): validate EN switcher anchor symmetrically (#155)
* fix(create-readme): validate EN switcher anchor symmetrically

* docs(handoff): add handoff and ADR for switcher validation

* docs(handoff): set PR number

---------

Co-authored-by: opencode-agent <agent@opencode.local>
2026-07-30 19:57:46 +03:00

19 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
pr: 155
title: Symmetric EN/RU switcher anchor validation in validateReadme
---
## Что сделано
- Удалены 2 избыточных substring-чека (`[English]` и `[Русский]` как подстроки) — они субсумируются строгими full-anchor чеками.
- Добавлен строгий full-anchor чек для EN: `[English](#-english)` (зеркало существующего RU-чека `[Русский](#-русский)`).
- Добавлен `export` к функции `validateReadme` для возможности импорта в тестах.
- Smoke-тест: 8/8 edge cases passed (валидный switcher, битые EN/RU anchors, отсутствие anchor, битые ссылки, не-markdown текст).
## Почему
Валидация language switcher была асимметричной: RU проверялся строго (полный anchor `[Русский](#-русский)`), а EN — только подстрокой `[English]` без проверки anchor. 4 класса дефектов EN-switcher пропускались: битый anchor, отсутствие anchor, битая ссылка, не-markdown-ссылка.
## Pending
## Watch out
Функция `validateReadme` теперь экспортируется — это публичный API. Ранее была module-private.