fix: publish_article reverts title changes saved via update_article (#261)#265
Open
katanumahotori wants to merge 1 commit into
Open
fix: publish_article reverts title changes saved via update_article (#261)#265katanumahotori wants to merge 1 commit into
katanumahotori wants to merge 1 commit into
Conversation
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.
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.
Fixes #261
Problem
publish_article()reads the article title fromdata.namefirst and only falls back tonote_draft.namewhen empty. For a published article with pending draft edits (saved byupdate_articleviadraft_save?is_temp_saved=true),data.nameholds the stale published title, so the new title innote_draft.nameis silently discarded on publish — while the body is correctly taken fromnote_draft.body.Fix
Prefer
note_draft.nameoverdata.name, mirroring the existing body logic a few lines below. Also removes the now-redundant secondnote_draftlookup.Tests
test_publish_uses_draft_title_for_pending_editsreproducing the stale-title scenario (olddata.name+ newnote_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-existingtest_auth_browserfailures 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