Skip to content

API/MCP returns raw translation key when editing a finalized post #244

Description

@paulocastellano

Bug

When a client tries to edit/update a post that is already finalized (published, publishing, partially_published, or failed), the API and MCP return a broken error message: the raw translation key instead of the human-readable string.

Observed

{ "message": "posts.cannot_edit_finalized" }

Expected (English)

{ "message": "This post has already been processed and cannot be re-published. Duplicate it to try again." }

Root cause

App\Support\PostStatusRules::editBlockedMessage() uses:

private const EDIT_BLOCKED_MESSAGE_KEY = 'posts.cannot_edit_finalized';

But the string only exists under posts.flash.cannot_edit_finalized in lang/*/posts.php.

  • Web UI already uses the correct key: __('posts.flash.cannot_edit_finalized') (e.g. PostController).
  • API (Api\PostController) and MCP (UpdatePostTool, PublishPostTool) go through PostStatusRules::editBlockedMessage() and hit the wrong key.

Verified locally:

Call Result
__('posts.cannot_edit_finalized') posts.cannot_edit_finalized (missing)
__('posts.flash.cannot_edit_finalized') Correct English copy
PostStatusRules::editBlockedMessage() Raw key

Suggested fix

Either:

  1. Change EDIT_BLOCKED_MESSAGE_KEY to posts.flash.cannot_edit_finalized, or
  2. Add a top-level posts.cannot_edit_finalized key (and keep flash as an alias), so API/MCP and flash stay in sync.

Also update any MCP/API tests that assert __('posts.cannot_edit_finalized') so they assert the resolved human string (or the corrected key).

Affected surfaces

  • PUT /api/posts/{post} when the post is finalized
  • MCP update-post-tool / publish-post-tool when the post is finalized

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions