Skip to content

refactor: remove proprietary callbacks in favor of native Nextcloud webhooks - #9426

Merged
vitormattos merged 11 commits into
mainfrom
refactor/remove-legacy-callback-nextcloud-webhooks
Nov 14, 2026
Merged

vitormattos merged 11 commits into
mainfrom
refactor/remove-legacy-callback-nextcloud-webhooks

Conversation

@vitormattos

@vitormattos vitormattos commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Purpose

Remove the obsolete LibreSign HTTP callback mechanism from the unreleased development line (main, LibreSign 16.0.0-dev / Nextcloud 36), replacing it with the existing native OCA\Libresign\Events\SigningRequestCompletedEvent and Nextcloud Webhook Listeners.

This supersedes #9423, which repaired a legacy listener we no longer intend to maintain. It does not remove internal SignedEvent events used by Activity and notifications.

Implementation

  • Remove per-request callback, the fallback webhook_sign_url setting, multipart HTTP transport, and listener.
  • Remove storage/entity/query/response fields and regenerate public/full OpenAPI and TypeScript declarations.
  • Migration backs up configured callback destinations to LibreSign AppData before dropping libresign_file.callback and deleting obsolete app config; empty values produce no backup. Backup failure aborts migration.
  • Preserve existing SigningRequestCompletedEvent contract and internal SignedEvent.

Breaking migration

Nextcloud webhooks differ from the removed callback: no per-request destination URL and no pushed multipart PDF. Administrators install Webhook Listeners, register a subscription and configure Cron and receiver credentials. Integrators deduplicate by eventId, reconcile using an authorized OCS identity, then recover the final PDF via authorized Nextcloud WebDAV. Previously stored callback destinations are preserved in LibreSign AppData, but no longer used by the signing workflow.

Stable releases 13, 14, 15 are unchanged. LibreSign 16 is development, not stable. Documentation migration and example: LibreSign/documentation#130.

Evidence and status

Rebased the implementation onto main at f63d81447ba5e6bfec6266c55f9742cd60009728, preserving 11 separate signed/DCO commits. Resolved the previously blocking OpenAPI/TypeScript conflicts by running composer openapi against the integrated backend; the existing NativeWebhookEventPublisher introduced on main remains intact. The resulting head is 70ae26b4bb421be6223038496eab7eb3600de74f.

Focused validation on the integrated code:

  • PHPUnit with a source-only isolated Nextcloud autoloader: 189 tests, 501 assertions passed across migration, request controller, request workflow and signing service.
  • OpenAPI contract suite: 45 tests, 858 assertions passed.
  • npm run ts:check: passed.
  • composer openapi: passed; generated JSON and TypeScript API declarations updated.
  • git diff --check: passed.
  • Commits created with Git Signing MCP; GPG signature and DCO verified.

The previous disposable NC36 QA exercised browser signing without login, native authenticated webhook POST from the worker, authorized signed PDF retrieval, negative permissions, two-signer partial vs complete, envelope, cancellation, and concurrent signing. The full post-rebase GitHub Actions/Behat/Playwright CI matrix must still complete before merging. No merge or deployment is authorized.

@lfals lfals left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal looks complete to me: no reader of callback or webhook_sign_url is left, the remaining SignedEvent listeners are untouched, and the SignFileService constructor change is reflected in the tests. The legacy listener never fired on main (it checked getUpdatedFields()['signed'] on File, which has no such field), so this PR does not remove working behaviour.

Comments below are one correctness issue in the migration (Oracle), one product question (the ignored callback parameter), and two points about the backup.

The branch conflicts with main in the generated OpenAPI/TypeScript files, so the PHPUnit, Behat, Psalm and openapi jobs have not run on this head.

@vitormattos
vitormattos requested a review from lfals November 11, 2026 18:07
@vitormattos
vitormattos marked this pull request as ready for review November 11, 2026 18:07
@vitormattos
vitormattos requested a review from a team as a code owner November 11, 2026 18:07

@lfals lfals left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up on the latest commits. The earlier comments are resolved: the backup query uses nonEmptyString('callback'), both backups are announced through IOutput::info(), the CSV is fully built before anything is written to AppData, and the callback request parameter is an acknowledged contract decision.

One blocking regression remains, introduced by the new synchronous write: the CSV stream is closed twice, which aborts the migration on any instance that has a stored callback.

@vitormattos
vitormattos requested a review from lfals November 11, 2026 22:00

@lfals lfals left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The follow-up looks good: the double-close on the callback backup stream is fixed by reading the CSV into a string before newFile(), and the earlier migration points (portable non-empty predicate, credential-safe IOutput::info, synchronous verified write) hold. Remaining SignedEvent / SigningRequestCompletedEvent paths are untouched.

Please resolve the conflicts with main (generated OpenAPI/TypeScript) so the full CI matrix can run on this head.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…pt fixtures

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>
… writes

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>
@vitormattos
vitormattos force-pushed the refactor/remove-legacy-callback-nextcloud-webhooks branch from 31d3757 to 70ae26b Compare November 14, 2026 23:39
@github-actions

Copy link
Copy Markdown
Contributor

Code Metrics Report

Note: 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.

main (f63d814) #9426 (3233c2e) +/-
Coverage 76.7% 76.7% +0.0%
Test Execution Time 2m22s 3m16s +54s
Details
  |                     | main (f63d814) | #9426 (3233c2e) |  +/-  |
  |---------------------|----------------|-----------------|-------|
+ | Coverage            |          76.7% |           76.7% | +0.0% |
  |   Files             |            512 |             511 |    -1 |
  |   Lines             |          28881 |           28843 |   -38 |
- |   Covered           |          22176 |           22148 |   -28 |
- | Test Execution Time |          2m22s |           3m16s |  +54s |

Code coverage of files in pull request scope (79.0% → 79.1%)

Files Coverage +/- Status
lib/AppInfo/Application.php 0.0% 0.0% modified
lib/Controller/RequestSignatureController.php 90.3% -0.2% modified
lib/Db/File.php 91.1% -0.3% modified
lib/Db/IdDocsMapper.php 64.5% -0.5% modified
lib/Listener/SignedCallbackListener.php 0.0% 0.0% removed
lib/ResponseDefinitions.php 0.0% 0.0% modified
lib/Service/RequestSignatureService.php 79.9% +0.1% modified
lib/Service/RequestSignatureWorkflowService.php 100.0% 0.0% modified
lib/Service/SignFileService.php 79.3% -0.2% modified

Reported by octocov

@vitormattos
vitormattos merged commit 8c868c7 into main Nov 14, 2026
80 checks passed
@vitormattos
vitormattos deleted the refactor/remove-legacy-callback-nextcloud-webhooks branch November 14, 2026 23:51
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.

2 participants