Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/onlyworlds/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.139.0"
__version__ = "0.139.1"
11 changes: 9 additions & 2 deletions src/onlyworlds/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]]:
Expand Down
14 changes: 11 additions & 3 deletions tests/test_push.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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)

Expand Down
Loading