Skip to content

WtPage.edit() returns normally for a page that was not saved #233

Open

Description

@LukasGold

Problem

WtPage.edit() can return normally for a page that was not saved. A direct call to edit() has no check that the page exists afterwards. #182 added such a check to store_entity, but not to WtPage.edit().

Where

WtPage._edit() sends the editslots call and does not read its response:

WtPage.edit() returns the result of _edit() unchanged and retries only when _edit() raises:

So edit() can report success only on the basis that no exception was raised. That is not the same as a saved page. The same reasoning was the cause of #175.

Observed

On wiki-dev.open-semantic-lab.org, a script created a new page with three set_slot_content calls and then page.edit("..."):

  1. The script printed created and exited with code 0.
  2. The page does not exist: action=purge returns missing and the revision query returns no revisions.
  3. The same content sent with a direct mw_site.api("editslots", ...) call raises APIError('mwjson-category-edit-right-denied', '... The right mwjson-editpatch is required.').

The script finished within seconds. Five failed attempts with sleep(5) take at least 20 seconds, so edit() did not run the retry loop to its end. OSW_LOG_LEVEL=OFF was set, so warnings were not visible.

The reason why edit() did not raise is not known. Possible causes: the editslots response contained an error that mwclient did not raise, or the call was not sent. Neither is verified.

Expected

  • edit() raises when the page was not saved.
  • The editslots response is checked for an error entry, or the page is read back after the edit and compared with the requested content.

Notes

Activity

  1. self-assigned this
    on Nov 17, 2026
  2. added
    bugSomething isn't working
    and removed
    enhancementNew feature or request
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions