Repository navigation
feat: expose signing lifecycle and delivery outcomes via native webhooks - #9427
Conversation
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Code Metrics ReportNote: Metrics describe the revision analyzed by the successful PHPUnit run. Newer commits with pending, canceled or failed checks may not yet be represented in this report.
Details | | main (b02d0b8) | #9427 (59669a1) | +/- |
|---------------------|----------------|-----------------|--------|
+ | Coverage | 76.1% | 76.4% | +0.2% |
| Files | 500 | 512 | +12 |
| Lines | 28578 | 28842 | +264 |
+ | Covered | 21776 | 22055 | +279 |
- | Test Execution Time | 1s | 3m44s | +3m43s |Code coverage of files in pull request scope (80.7% → 83.0%, patch 96.4%)Reported by octocov |
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…t failures Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
… tests Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…t state Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
There was a problem hiding this comment.
The core change looks correct to me: the native events are published after the business operation commits, the payloads carry only the documented correlation fields, and failures of native listeners are isolated from the persisted workflow.
Comments below are one regression in the legacy rejection path, three gaps in the ready event (envelopes, a failed signer transaction, and a repeated eventId), one behaviour question, and one diagnosability suggestion.
…ations Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
lfals
left a comment
There was a problem hiding this comment.
Follow-up on the latest commits. Most earlier comments are resolved: legacy listener failures no longer escape a committed rejection, the envelope ready event is reachable and tested, the status upgrade shares the signer transaction so a retry still publishes, ready_event_id gives each transition a distinct eventId without leaking into public responses, and the narrowed envelope lookup fails before any write, as documented by the new tests.
Comments below are the logging change that is only partly applied, and one side effect of moving persistFile() into the transaction.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Summary
Expose LibreSign's signing lifecycle and notification-submission outcomes as native Nextcloud Webhook Listeners events. Integrations can subscribe through Nextcloud's standard event infrastructure rather than a LibreSign-specific callback transport.
This targets LibreSign development
main/ Nextcloud 36. It does not change stable LibreSign 13–15 or introduce a new webhook HTTP endpoint. The existingSigningRequestCompletedEventis retained.Events
All new event classes implement
IWebhookCompatibleEventunderOCA\Libresign\Events, withcontractVersion: 1and aneventIdfor idempotent consumers.SigningRequestReadyEventABLE_TO_SIGN, including a newly created ready requestSignerSignedWebhookEventSignerRejectedWebhookEventSigningRequestCanceledEventNotificationDeliveryStatusChangedEventThe existing
SigningRequestCompletedEventcontinues to represent aggregate completion. A rejection under a continue policy can also complete a partially signed request.Behavior and implementation
ABLE_TO_SIGNupdates its children before publishing the root ready event. Ordinary envelope creation remains in draft.eventId.NativeWebhookEventPublisherseparates event preparation from listener dispatch. Failures raised by external listeners are logged without reversing completed business operations. Unexpected event-preparation errors remain visible rather than being silently suppressed.Security and integration contract
Webhook payloads contain correlation identifiers and status information only. They do not contain recipient addresses, phone numbers, invitation/signing URLs or tokens, private rejection comments, document bytes, certificate material or signing credentials.
The existing internal
SignRequestCanceledEventconcerns signer-removal notifications; it is not the new aggregateSigningRequestCanceledEvent.A notification result describes the submission state recorded by the delivery ledger. In particular,
accepteddoes not prove that the recipient received or read a message. Consumers must handle duplicate events and use authenticated LibreSign APIs to reconcile state or retrieve documents.Validation
Tested locally with Nextcloud 36, PHP 8.3 and isolated synthetic SQLite data in a network-disabled Docker runtime:
freetsa.orgwhile network access was disabled.git diff --checkpassed.InvalidArgumenterrors in unchangedlib/Service/Install/SignSetupService.php; no new static-analysis errors have been confirmed.Regression coverage includes root/child event payloads and privacy, duplicate event IDs across separate ready transitions, envelope readiness, failed signer writes and retries, transaction rollback, listener
TypeErrorisolation, rejection rules and notification outcomes.Delivery limits and compatibility
Related: #9426 (separate removal of the legacy callback mechanism).