Update Hashnode publish sheet recovery - #5522
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a5fa2e1839
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| @staticmethod | ||
| def _wait_for_public_article(public_url: str, canonical_url: str) -> bool: | ||
| deadline = time.time() + 45 |
There was a problem hiding this comment.
Import time before verifying Hashnode edit redirects
When Hashnode redirects a successful publish to /edit (the new path handled above), _publish_from_dialog calls _wait_for_public_article, but this method calls time.time()/time.sleep() without importing time. A direct call raises NameError, which submit_draft treats as a failed publish and then records no completed URL, so a live-published article can be reported as failed and retried/duplicated on the next run.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
Updates the Hashnode Playwright-based syndication flow to match the current Radix publish side-sheet UI, enforce canonical attribution + tag verification prior to publishing, and correctly handle Hashnode’s post-publish redirect behavior (authenticated /edit/... instead of the public article URL).
Changes:
- Treat Hashnode
/draft/...and/edit/...URLs as unpublished results when persisting publish state. - Update publish-dialog selectors and tag/canonical setting logic to work within the open Radix dialog/sheet and prevent Escape from closing the sheet.
- When Hashnode redirects to an authenticated edit URL after publishing, derive the expected public URL from the Discovery tab and verify it’s publicly reachable with the correct canonical before recording it.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| scripts/website/syndicate_browser_posts.py | Updates Hashnode publish workflow (selectors, tag/canonical verification gates, and public-URL verification after edit redirect). |
| scripts/website/test_syndicate_browser_posts.py | Adds unit assertions covering the new Hashnode completion rules and key automation safeguards (selectors, publish gating, no Escape during tag entry). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def _wait_for_public_article(public_url: str, canonical_url: str) -> bool: | ||
| deadline = time.time() + 45 | ||
| request = urllib.request.Request(public_url, headers={"User-Agent": _UA_STR}) |
| @@ -1058,14 +1121,10 @@ def _set_canonical_url(self, page, canonical_url: str, mod: str) -> bool: | |||
| # earlier syndication) is already in the field. Select-all | |||
| # + type generates real key events so React picks up the | |||
| ) | ||
| return f"{self.PUBLICATION_URL}/{match.group(1)}" | ||
|
|
||
| def _set_tags(self, page, mod: str) -> bool: |
Cloudflare Preview
|
Summary
Validation
PYTHONDONTWRITEBYTECODE=1 python3 scripts/website/test_syndicate_browser_posts.pyPYTHONDONTWRITEBYTECODE=1 python3 scripts/website/test_syndication_health.pyPYTHONDONTWRITEBYTECODE=1 python3 scripts/website/test_syndicate_blog_posts.pycompact-strings-parparvm; public sitemap, canonical URL, and all five tags verified