Repository navigation
fix(rejection): notify the next signing order only after the commit - #8912
Conversation
|
Thanks for opening your first pull request in this repository! ✌️ |
A rejection that lets the workflow continue releases the next signing order inside its transaction. releaseNextOrder() persisted ABLE_TO_SIGN and dispatched the notification in the same method, so on an envelope with several documents the signers released for an earlier document were already notified when a later document failed and rolled the transaction back: the message was delivered for an activation that no longer existed. activateSignersForOrder() now only persists the state and returns the signers it activated. activateNextOrder() exposes that for callers that run inside a transaction and notifyActivatedSigners() dispatches the notifications, which SignatureRejectionService calls after commit(). releaseNextOrder() keeps activating and notifying in one step, so the non-transactional callers are unchanged, and a failing listener can no longer undo a recorded rejection. Signed-off-by: Turgay Nalbant <182372382+tnalbant@users.noreply.github.com>
9372013 to
ed8d833
Compare
Every signer/identify-method notification is isolated: a failed delivery is logged with the sign request id and the identify method, and the remaining activated signers are still notified instead of being skipped. The post-commit catch in SignatureRejectionService now catches recoverable exceptions (\Exception) instead of \Throwable, so programming errors are not converted into a logged delivery failure; the log includes the sign request id. Adds regression tests for both behaviours. Signed-off-by: Turgay Nalbant <182372382+tnalbant@users.noreply.github.com>
|
Both review points are addressed:
Regression tests cover both behaviours. The focused suites pass |
|
Thanks for flagging this, and sorry for the confusion in our review process. We approved a second implementation of #8803 while your PR was already open and under review; that coordination mistake was ours. We plan to consolidate the fix in #8948, which also includes the later notification lookup and event-ordering fixes. We have prepared additional changes based on your PR: stronger persistence and rollback assertions, an explicit no-notification expectation after a failed release, and appending activated signers without rebuilding the accumulated list. These changes have not been pushed yet because our commit-signing service failed. Please hold off on further updates here while we finish the consolidation. Thank you for your work and for raising the overlap before spending more time on it. |
Keep recoverable notification failures in SequentialSigningService, extract per-signer delivery, and preserve rollback assertions. Adapt identification lookup isolation from PR LibreSign#8948 while keeping rejection event ordering for that follow-up PR. Co-authored-by: André Maia <andrefnkmm@gmail.com> Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
|
Update to our earlier consolidation plan: we will merge this PR first, preserving your original implementation and commits, then adapt #8948 into a complementary follow-up for rejection-event ordering. I pushed fb8ad1a to address the outstanding review: extracted per-signer notification handling, removed the redundant catch in SignatureRejectionService, isolated identification lookup failures, and strengthened notification and rollback assertions. The lookup isolation builds on André Maia's contribution in #8948, credited in the commit. The commit is cryptographically signed with DCO. git diff --check passed; PHP/Composer/Nextcloud are unavailable in this environment, so runtime validation is pending CI. GitHub currently marks the workflow runs as action_required, awaiting maintainer authorization. Sorry again for approving overlapping work while your PR was already under review. That coordination mistake was ours. Both contributions will be retained. |
Return activated signers after committing the rejection and dispatch SignatureRejectedEvent before attempting their notifications. Preserve event delivery when a post-commit notification error propagates. Adapt the event-ordering correction from PR LibreSign#8948 and strengthen the successful-order and notification-error regression assertions. Co-authored-by: André Maia <andrefnkmm@gmail.com> Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
|
/backport to stable35 |
|
Hi @tnalbant, your first pull request to LibreSign has been merged. 🎉 Your work is part of LibreSign now, and everyone who signs a document with it benefits from the time and knowledge you shared. Thank you. You are very welcome to contribute again. The good first issue list is a good place to look next, and you no longer have to wonder how the process works. If you have a few minutes and feel like it, we would love to hear how this went for you: https://ls.librecode.coop/index.php/645932?lang=en&source=github-first-merged-pr&repository=libresign. It is entirely optional; nothing is expected of you in return for contributing. Come say hello in the LibreSign community: https://t.me/LibreSign |
|
/backport to stable34 |
|
/backport to stable33 |
|
The backport to # Switch to the target branch and update it
git checkout stable34
git pull origin stable34
# Create the new backport branch
git checkout -b backport/8912/stable34
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick ed8d8335 d4fe1be5 fb8ad1a4 f067b559
# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/8912/stable34Error: Failed to check for changes with origin/stable34: No changes found in backport branch Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports. |
|
The backport to # Switch to the target branch and update it
git checkout stable33
git pull origin stable33
# Create the new backport branch
git checkout -b backport/8912/stable33
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick ed8d8335 d4fe1be5 fb8ad1a4 f067b559
# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/8912/stable33Error: Failed to check for changes with origin/stable33: No changes found in backport branch Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports. |
|
After taking a closer look, we don't need to backport this fix to the stable branches. The issue was introduced only on the main branch and does not affect the current stable releases. Thanks for your contribution, and you're very welcome to join our community on Telegram: https://t.me/LibreSign |
|
@tnalbant don't forgot the survey: |
Preserve the remaining applicable coverage from André Maia's #8948 series after resolving the follow-up against current main. The production fixes and error-ordering changes from 7cee8ff are already present through #8912, so only the distinct notification coverage remains to apply. Cherry-picked-from: 7cee8ff Co-authored-by: André Maia <andrefnkmm@gmail.com> Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Preserve the original commits from #8948 as ancestors of this merge while reconciling the branch with current main and the focused tests from #9041. The production fix and overlapping tests remain as integrated by #8912; the diff against main consists exclusively of the 38 additional test lines from #9041. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Cherry-pick the remaining applicable coverage from André Maia's 0eb8da9 after resolving it against LibreSign#8912, which already merged the production changes and overlapping tests. Cherry-picked-from: 0eb8da9 Co-authored-by: André Maia <andrefnkmm@gmail.com> Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Fixes #8803
When
rejection_behaviorlets the workflow continue,persistRejection()releases the next signing order inside its transaction.activateSignersForOrder()persistedABLE_TO_SIGNand dispatched the notification in the same method, so on an envelope with several documents the signers released for an earlier document were already notified when a later document failed and rolled the transaction back: the message went out for an activation that no longer existed.activateSignersForOrder()now only persists the state and returns the signers it activated.activateNextOrder()exposes that for callers running inside a transaction, andnotifyActivatedSigners()dispatches the notifications, whichSignatureRejectionServicecalls aftercommit(). Recoverable lookup and delivery failures are isolated in the notification service. After committing the rejection,reject()dispatchesSignatureRejectedEventbefore notifying the released signers, so a programming error during notification cannot prevent the rejection event from being dispatched.releaseNextOrder()keeps activating and notifying in one step, so the non-transactional callers (SignFileService,RequestSignatureService::reorderAfterDeletion) are unchanged.Four existing tests in
SignatureRejectionServiceTestare updated because the call site moved fromreleaseNextOrder()toactivateNextOrder(); their assertions keep testing the same behaviour.Tests:
testARolledBackRejectionDoesNotNotifyAnOrderReleasedForAnEarlierDocument— envelope with two documents, the first releases the next order, the second throws, the transaction rolls back and no signing notification is dispatched for the released order.testTheReleasedOrderIsNotifiedOnlyAfterTheRejectionIsCommitted— the successful release still notifies, after the commit.testAnUnexpectedNotificationExceptionDoesNotRollBackACommittedRejectiontestActivateNextOrderReturnsTheActivatedSignersWithoutNotifyingThem,testNotifyActivatedSignersNotifiesEverySignerItReceives,testNotifyActivatedSignersIsANoOpWithoutActivatedSignersOriginal contributor verification, before the maintainer follow-up commits: PHPUnit on the two touched test classes (82 tests) passed,
php-cs-fixerreported no change over the whole repository and psalm reported no errors on the two changed services.Maintainer follow-up validation:
git diff --checkpassed. Runtime tests and static analysis have not been rerun locally because PHP, Composer, and a Nextcloud runtime are unavailable in the editing environment; current CI validation is pending. Regression assertions now enforce commit → rejection event → notifications and require rejection event dispatch even when a notification error propagates. Identification lookup isolation and rejection-event ordering were adapted from André Maia's contribution in #8948, credited in the signed DCO commits.This change was prepared with AI coding assistance. I remain responsible for the submitted change.