Skip to content

feat(launchpad): build scheduled-exports - #1307

Open
rubenvdlinde wants to merge 8 commits into
developmentfrom
quality/build-scheduled-exports-b2
Open

rubenvdlinde wants to merge 8 commits into
developmentfrom
quality/build-scheduled-exports-b2

Conversation

@rubenvdlinde

@rubenvdlinde rubenvdlinde commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Round 2 of scheduled-exports. Development already had the first slice: the four schemas, RecurrenceResolver and the RetryHandler policy. This PR builds the backend core on top of it.

Tasks done

  • Task 3 / Task 21: ScheduledExportService. CRUD on scheduled_export objects in OpenRegister through ScheduledExportStore, which uses openregister main's object API (ObjectFindOptions, ObjectSaveOptions, ObjectDeletion); there are no own tables.
    • Visibility is OpenRegister's RBAC for the signed-in user; the runner reads without it.
    • nextRunAt is always computed on the server.
    • Validation lists every problem.
    • Delete is a soft delete.
    • Enabling recomputes the next run from now.
    • Recipient secrets are answered as ********, and an edit that sends the placeholder back keeps the stored value (REQ-SCH-010).
  • Task 7: ScheduledExportAuditLog. One scheduled_export_run row per fire. Artefacts and each delivery attempt are written at once. History is newest first and paged. Only a scheduled run still running counts as an overlap.
  • Task 5 / Task 23: DeliveryDispatcher.
    • Email goes through the Nextcloud mailer: one message to every address, with the attachments.
    • Files delivery writes into a user's Files area; an existing file is replaced only with overwrite=true, and ./.. in the path are refused.
    • Webhooks are a multipart POST, HMAC-SHA256-signed over the exact body in X-LaunchPad-Signature.
    • SFTP uses phpseclib (v3, or the v2 Nextcloud bundles), checks the host key before login and confirms the uploaded size.
    • Each recipient gets the artefacts of its own filter context. A context that failed to render fails only that recipient.
    • Non-transient failures are not retried. Due retries read the stored artefact back from Files.
    • Artefacts live under Apps/LaunchPad/Exports/{exportId}/ in the owner's Files (ScheduledExportArtefactStorage).
  • Task 9 / Task 26: ScheduledExportJanitor. An hourly job registered in info.xml.
    • Expired artefact files are deleted and their storagePath nulled; hashes and deliveries stay.
    • Expired run-rows are deleted together with their files.
    • A null retention keeps forever, a running run is left alone, and the defaults are 30 / 365 days.
  • Task 38: design note D8.

Tasks left, and why

  • Task 4, the render pipeline. This is the blocker for the rest. It needs two decisions the change does not make:
    • where a widget's tabular data comes from for CSV/XLSX;
    • which headless Chromium service renders PDF/PNG.
  • Task 6: the retry mechanics are built (RetryHandler::afterAttempt/rearm plus DeliveryDispatcher::retryDue), but the run wiring arrives with Task 8.
  • Tasks 8, 10, 11, 25: they depend on Task 4.
  • Tasks 12–19: frontend.
  • Tasks 27–30: Playwright.
  • Tasks 31–37: quality gates, OpenAPI, i18n and changelog, once the feature is complete.
  • OpenConnector routing (REQ-SCH-010) is not built. A recipient with openconnectorSourceId fails with a clear error instead of being sent with local credentials.
  • The Nextcloud mailer exposes no message-id, so the email delivery records LaunchPad's own id.
  • Run-rows are removed through ObjectService's delete rather than the OpenRegister retention-rule hooks named in D6.

Tests

  • New tests: ScheduledExportServiceTest (13), ScheduledExportStoreTest (6), ScheduledExportAuditLogTest (8), DeliveryDispatcherTest (11), ScheduledExportSftpConnectorTest (4), ScheduledExportArtefactStorageTest (4) and ScheduledExportJanitorTest (4).
  • Unit suite: 4621 tests with no failures before this PR, 4671 with no failures after.
  • phpcs and phpstan pass on every new file.

Generated by Claude Code

ScheduledExportService (Task 3, Task 21): CRUD on scheduled_export
objects in OpenRegister through ScheduledExportStore (openregister main's
object API), the next run computed from the recurrence, validation, and
recipient secrets redacted on read and kept on an edit.

Assisted-by: ClaudeCode:claude-opus-5-5
ScheduledExportAuditLog (Task 7): one scheduled_export_run row per fire
in OpenRegister, artefacts and deliveries written at once, history
newest first, overlap detection for scheduled fires.

Assisted-by: ClaudeCode:claude-opus-5-5
DeliveryDispatcher (Task 5, Task 23): email through the Nextcloud mailer,
Files with the overwrite rule, a webhook signed over its exact multipart
body, SFTP through phpseclib with a host-key check; per-recipient filter
contexts, each attempt written to the run-row, due retries read the
stored artefact back. Artefacts live in the owner's Files area.

Assisted-by: ClaudeCode:claude-opus-5-5
ScheduledExportJanitor (Task 9, Task 26): hourly retention, artefact
files deleted and their paths nulled while hashes and deliveries stay,
expired run-rows deleted with their files, null keeps forever. Design
note D8 on recomputing the next run on every write (Task 38).

Assisted-by: ClaudeCode:claude-opus-5-5
ScheduledExportController with list, read, create, update, soft-delete,
run history and the retry of a run's permanently failed deliveries;
eight routes, two seeded actions, and their OpenAPI entries. Run now and
preview wait on the render pipeline (task 4).

Assisted-by: ClaudeCode:claude-opus-5-5
Frontend tasks 12-19: the export list, editor, run history, run detail
with retry and preview modals, the exports store and its helpers, and
"Scheduled exports…" in the dashboard's Meer menu. Ported from the first
build line and fitted to this line's controller: retry answers
{retried, run}, and the entry moves from the cog to DashboardMoreMenu.
en and nl strings for the new UI.

Assisted-by: ClaudeCode:claude-opus-5-5
Tasks 27-30: the full workflow, per-recipient filter contexts, failure
and retry, and retention, with a shared fixture that seeds exports
through the API. They need the run and preview routes of task 4, so the
Playwright config skips them until that lands.

Assisted-by: ClaudeCode:claude-opus-5-5
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.

1 participant