Skip to content

fix: decrypt a submission once however many decryption tasks run - #3289

Open
kelvin-muchiri wants to merge 1 commit into
mainfrom
fix/decrypt-submission-once
Open

kelvin-muchiri wants to merge 1 commit into
mainfrom
fix/decrypt-submission-once

Conversation

@kelvin-muchiri

@kelvin-muchiri kelvin-muchiri commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Changes / Features implemented

  • An encrypted submission is now decrypted only once, even when more than one decryption is started for it at the same time. Previously this could leave a submission with duplicate copies of its images under altered file names, and with image links that no longer opened.
  • Submissions being decrypted now show a new "in progress" decryption status.
  • Submissions that could not be decrypted for a temporary reason, such as media not yet received or the encryption service being unreachable, stay pending and are decrypted again later, showing the reason from the last attempt. Only submissions that need someone to act on them are marked as failed.

Steps taken to verify this change does what is intended

  • Added tests

Side effects of implementing this change

None.

Before submitting this PR for review, please make sure you have:

  • Included tests
  • Updated documentation

Closes #3270


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

A decryption task claims the submission by moving its decryption status
from pending to the new in_progress status in a single update. A task
that cannot claim it returns without changes, so overlapping tasks no
longer decrypt a submission twice, duplicating its media and leaving
its attachments pointing at soft-deleted copies.

Failed now means the error needs a person. Missing media, KMS connection
errors and exhausted retries leave the submission pending with the
error recorded, so it is decrypted again later.

Saves that do not change the XML no longer write the decryption status,
so a copy loaded before the claim cannot overwrite it.

Closes #3270

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make decrypting a submission safe to run more than once

1 participant