fix(issues): a send keeps its claim through every step, not just up to the issue

Creating the issue rebuilt the delivery state from scratch and dropped the
claim with it, so for a new issue the claim covered only the creation — a
draft, a screenshot or a second send could change the report under the uploads
and the body edit that follow, which is exactly what the claim is for. The
state is now built on what was read, and a test walks the send's checkpoints
to see the claim still held at each one.

Found by mutation-checking the round-2 tests: removing the claim's release
left them green, because for a new issue there was nothing left to release.
This commit is contained in:
2026-09-20 01:03:23 +02:00
parent 3f983e6d76
commit bc03e82687
2 changed files with 26 additions and 0 deletions
+22
View File
@@ -815,6 +815,28 @@ def test_an_issue_is_created_with_every_file_and_the_screenshots_shown(
assert len(gitea_fake.calls) == calls
def test_the_claim_is_held_through_every_step_of_a_send(gitea_fake, db, make_user, as_user):
"""The claim is what keeps a draft, a screenshot or a second send out of the way — so it has to
outlast the issue's creation, not just reach it: most of a slow send is the uploads after."""
from app.issues import gitea
user = make_user()
client = as_user(user)
sid = _start(client)["id"]
_upload(client, sid, _PNG)
_ready(client, sid)
session = db.get(DebugSession, sid)
debugsession.claim_send(session)
db.commit()
held: list[bool] = []
gitea.deliver(
db,
session,
checkpoint=lambda: (db.commit(), held.append(debugsession.sending(session)))[0],
)
assert held and all(held) # after the issue was created, and after every upload
def test_a_public_repository_gets_nothing(gitea_fake, db, client, make_user):
gitea_fake.private = False
_signed_in(client, make_user)