Skip to content

fix: publish_article reverts title changes saved via update_article (#261)#265

Open
katanumahotori wants to merge 1 commit into
drillan:mainfrom
katanumahotori:fix/publish-draft-title
Open

fix: publish_article reverts title changes saved via update_article (#261)#265
katanumahotori wants to merge 1 commit into
drillan:mainfrom
katanumahotori:fix/publish-draft-title

Conversation

@katanumahotori

Copy link
Copy Markdown

Fixes #261

Problem

publish_article() reads the article title from data.name first and only falls back to note_draft.name when empty. For a published article with pending draft edits (saved by update_article via draft_save?is_temp_saved=true), data.name holds the stale published title, so the new title in note_draft.name is silently discarded on publish — while the body is correctly taken from note_draft.body.

Fix

Prefer note_draft.name over data.name, mirroring the existing body logic a few lines below. Also removes the now-redundant second note_draft lookup.

Tests

  • New regression test test_publish_uses_draft_title_for_pending_edits reproducing the stale-title scenario (old data.name + new note_draft.name/body) and asserting the PUT payload uses the draft title and body.
  • uv run pytest tests/unit tests/integration: all pass (except 2 pre-existing test_auth_browser failures unrelated to this change).
  • ruff check / mypy: clean.

Verified E2E

Confirmed on a real note.com article (2026-06-10): update_article with a new title → publish_article → live page now shows the new title.

🤖 Generated with Claude Code

publish_article() read the stale published title from data.name before
falling back to note_draft.name. For published articles with pending
draft edits (saved by update_article via draft_save), the new title
lives in note_draft.name, so the title change was silently lost on
publish while the body was correctly taken from note_draft.body.

Prefer note_draft.name over data.name, mirroring the existing body
logic. Add a regression test reproducing the stale-title scenario.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

publish_article reverts title changes saved via note_update_article

1 participant