feat(masters): add --add-sitelink/--remove-sitelink to masters update - #802
Closed
axisrow wants to merge 2 commits into
Closed
feat(masters): add --add-sitelink/--remove-sitelink to masters update#802axisrow wants to merge 2 commits into
masters update#802axisrow wants to merge 2 commits into
Conversation
…e` (#648) Implements the "Быстрые ссылки" (sitelinks) section for Мастер кампаний, following the point-position pattern already used for audience tags: - Browser layer (direct_cli/browser/masters.py): _read_sitelinks, _add_sitelink, _remove_sitelink, plus testid constants and a Counter-based multiset verification in _verify_saved mirroring the audience-tags check. - CLI layer (direct_cli/commands/masters.py): --add-sitelink "Title|Href|Description" and --remove-sitelink <position> on `masters update`, with _parse_add_sitelink_options/ _parse_remove_sitelink_options helpers. - Tests (tests/test_masters.py): unit coverage for the readers/mutators, verification, CLI parsers, and CLI wiring. Based on two live, read-only recon passes (2026-08-06, campaign 713277109) that confirmed the section/card/row testids but NOT how the inline edit form closes/commits, whether its fields are plain textareas or contenteditable divs, or the real max sitelink count -- all documented inline as NOT LIVE-VERIFIED, with the contenteditable path assumed conservatively (reusing _clear_text_field). Closes #648 (Этап C sitelinks slice). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FF5MKQjSX89UpwHfFG3uBe
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FF5MKQjSX89UpwHfFG3uBe
Owner
Author
|
Закрываю — та же CI-проблема, что и на #800 (застрявшая ветка). Пересоздаю на новую ветку ao/direct-cli-84/masters-648-sitelinks-v2 для чистого webhook-цикла. |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements быстрые ссылки (sitelinks) support in
direct masters update— part of issue #648's Этап C (structural sections: sitelinks, audience, Metrika counters/goals). This is a browser-driven feature (Мастер кампаний has no API), following the same add/remove-by-position pattern already established for--add-audience-tag/--remove-audience-tag(#681), adapted for sitelinks' 3-field card structure (Title/Href/Description) instead of a plain text tag.--add-sitelink "Title|Href|Description"— pipe-delimited, adds a new card via the "Добавить" button.--remove-sitelink POSITION— removes a card by its 0-based on-page position._read_sitelinks/_add_sitelink/_remove_sitelinkindirect_cli/browser/masters.py, wired intoupdate_master(snapshot-before + high-to-low removal, mirroring the audience-tags convention) and_verify_saved(multiset check on(Title, Href)—Descriptionis not bulk-readable, see below).Testid structure was confirmed via two live read-only recon passes against campaign 713277109 (Playwright +
mcp claude-in-chrome, no mutations saved) — but the actual add/remove/save behavior has not been exercised end to end against a real Yandex session. Specifically open questions:SitelinkRow.*edit form closes/commits — no dedicated "Готово"/save testid appeared in recon. The code pressesEscapethen clicks the section container as a best-effort dismiss, relying onupdate_master's own re-read (_verify_saved) as the real proof of success rather than trusting the close action itself.contenteditablevs plain<textarea>forSitelinkRow.name/href/description.textarea— conservatively assumedcontenteditable(same class as headline/text slots), reusing_clear_text_field+.type(). If it turns out to be a plain textarea, this degrades to a harmless no-op equivalent, not a functional bug.SitelinkRow.*triple immediately available — assumed by analogy with every other "click Добавить, fill, commit" flow in this module (target actions, audience tags), never itself clicked in recon._SITELINKS_SLOT_COUNT = 5comes from UI copy ("добавить до 5 штук"), not from actually adding a 5th sitelink past the 4 the recon campaign already had.None of this is claimed as working in the docstrings/CLI help — see the module comment above
_SITELINKS_EDITOR_TESTIDindirect_cli/browser/masters.pyfor the full recon writeup. A live mutation-verification pass is planned as a follow-up (browser session currently queued for other in-flight work) before this is considered safe to rely on in production.Test plan
pytest tests/test_masters.py -k "sitelink or Sitelink"— 28 passedpytest -n auto— 3405 passed, 23 skipped, no regressionsblack/flake8clean on all changed filesRelates to #648 (no dedicated sub-issue for this specific section).
Supersedes #800 (closed — that PR's CI got stuck queued for 3+ hours with no new workflow runs ever triggered, even after an empty-commit push and a close/reopen cycle; recreating as a new PR to get a fresh webhook cycle).
🤖 Generated with Claude Code
https://claude.ai/code/session_01FF5MKQjSX89UpwHfFG3uBe