From 43c5457e3f95cd46ef3ec9c1daa7fc69c743b819 Mon Sep 17 00:00:00 2001 From: Titus Date: Sat, 21 Nov 2026 04:09:41 +0100 Subject: [PATCH] 0.139.1: push goes on past keeper_only and the other element 403s A world's Charter and the elements it names now change only by the owner and co-builders (403 keeper_only). push treated every 403 but not_author as a refusal of the key and stopped the run, so a contributor's push that met one such element left its other edits unsent. keeper_only, review_by_another and not_reader are about one element too: that patch fails and the run goes on. Any other 403, and an unknown code, still stops it. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 4 ++++ src/onlyworlds/_version.py | 2 +- src/onlyworlds/push.py | 11 +++++++++-- tests/test_push.py | 14 +++++++++++--- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebef00a..81ba641 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ The package version runs on its own semver; the schema it is generated from is ` ## Unreleased +## 0.139.1 (2026-11-21) + +- **`push` goes on past a refusal about one element.** A world's Charter and the elements it names now change only by the owner and co-builders (`403` `keeper_only`); a contributor's push that met one of them stopped every later patch, as it does for a refused key. `keeper_only`, `review_by_another` and `not_reader` now join `not_author`: that patch is failed and the run goes on. Any other `403`, and one whose code is new, still stops the run (`push.ELEMENT_403`). + ## 0.139.0 (2026-11-21) - **`bulk(items, create_only=True)`**, sent as `create_only`: every item with an `id` is created as `create` creates it, never replaced. An id the world already holds answers that item's slot `409` `id_conflict`, and the element stays as it was; the rest of the batch goes on as before. Left `False`, the body is the one earlier releases sent; a value that is not a bool is refused before anything is sent. diff --git a/src/onlyworlds/_version.py b/src/onlyworlds/_version.py index 99ac4c4..727efd8 100644 --- a/src/onlyworlds/_version.py +++ b/src/onlyworlds/_version.py @@ -1 +1 @@ -__version__ = "0.139.0" +__version__ = "0.139.1" diff --git a/src/onlyworlds/push.py b/src/onlyworlds/push.py index 33445f7..3bb94e9 100644 --- a/src/onlyworlds/push.py +++ b/src/onlyworlds/push.py @@ -324,15 +324,22 @@ def _origin_to_send(world: Mapping[str, Any], folder_world: Mapping[str, Any] | return body +#: The 403 codes about one element, not the key: the run goes on to the next patch. +#: ``not_author`` (a contributor's change to an element someone else made), ``keeper_only`` +#: (a world's Charter and the elements it names change only by the owner and co-builders), +#: ``review_by_another`` (a review mark below co-builder) and ``not_reader`` (another reader's Read mark). +ELEMENT_403 = frozenset({"not_author", "keeper_only", "review_by_another", "not_reader"}) + + def stops_run(error: ApiError) -> bool: """An answer about the key, not the element: every later patch would get it too. 401 (``invalid_credentials``, ``key_revoked``), 429 ``rate_limited`` (keel's failed-PIN - throttle, its only 429), and any 403 but ``not_author``, which is about one element. + throttle), and any 403 whose code is not in ``ELEMENT_403``. """ if error.status == 401 or (error.status == 429 and error.code == "rate_limited"): return True - return error.status == 403 and not error.is_not_author + return error.status == 403 and error.code not in ELEMENT_403 def _load_done(log_path: Path) -> tuple[set[str], set[str], set[str]]: diff --git a/tests/test_push.py b/tests/test_push.py index 854fc48..2a7c817 100644 --- a/tests/test_push.py +++ b/tests/test_push.py @@ -237,7 +237,14 @@ def pin(eid: str, et: str) -> dict[str, Any]: @pytest.mark.parametrize( ("status", "code"), - [(401, "invalid_credentials"), (401, "key_revoked"), (429, "rate_limited"), (403, "permission_error")], + [ + (401, "invalid_credentials"), + (401, "key_revoked"), + (429, "rate_limited"), + (403, "permission_error"), + (403, "guest_not_supported"), + (403, "a_code_keel_adds_later"), + ], ) def test_a_refused_key_stops_the_run(tmp_path: Path, make_client: MakeClient, status: int, code: str) -> None: """A wrong PIN on every patch would lock the key (10 failures, 15 minutes) for every tool that uses it.""" @@ -252,12 +259,13 @@ def test_a_refused_key_stops_the_run(tmp_path: Path, make_client: MakeClient, st assert push(base, edit, client=make_client(t2), log_path=log, workers=1).ok == 5 # nothing was marked done -def test_not_author_does_not_stop_the_run(tmp_path: Path, make_client: MakeClient) -> None: +@pytest.mark.parametrize("code", ["not_author", "keeper_only", "review_by_another", "not_reader"]) +def test_an_element_403_does_not_stop_the_run(tmp_path: Path, make_client: MakeClient, code: str) -> None: base, edit = folders( tmp_path, {"character": [wire_char(C1, "A"), wire_char(C2, "A")]}, {"character": [wire_char(C1, "B"), wire_char(C2, "B")]}, ) # fmt: skip - t = FakeTransport(script=[jresp(403, {"error": {"code": "not_author"}})], handler=echo()) + t = FakeTransport(script=[jresp(403, {"error": {"code": code}})], handler=echo()) res = push(base, edit, client=make_client(t), log_path=tmp_path / "log.jsonl", workers=1) assert (res.ok, len(res.failed), res.aborted) == (1, 1, None)