Skip to content

feat: scheduled canvas PDF export - #9770

Open
nishantmonu51 wants to merge 4 commits into
mainfrom
nishant/scheduled-canvas-pdf-export
Open

feat: scheduled canvas PDF export#9770
nishantmonu51 wants to merge 4 commits into
mainfrom
nishant/scheduled-canvas-pdf-export

Conversation

@nishantmonu51

@nishantmonu51 nishantmonu51 commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Adds scheduled PDF exports for canvas dashboards, reusing the scheduled-reports machinery end-to-end. Recipients get the usual link-only report email; clicking "Download PDF file" opens the report export page, which renders the canvas in the browser (authenticated by the report's magic token) and generates the PDF with the existing client-side pipeline.

  • A canvas PDF report is a Report with export.format: pdf, a canvas annotation, and no data/query (nothing executes server-side at send time). New EXPORT_FORMAT_PDF enum value; parser and admin server validate the combination.
  • ReportReconciler.ResolveTransitiveAccess now reuses the canvas transitive-access logic (extracted as canvasTransitiveConditionResources) so magic-token recipients can query the canvas's components and metrics views.
  • Canvas filter/time state at scheduling time is captured as URL search params in the web_open_state annotation and replayed on the export and open pages; PDF options are persisted as pdf_include_filters / pdf_all_tabs annotations (new ReportOptions fields).
  • UI: "Schedule email delivery…" in the Share popover's PDF tab, a canvas variant of ScheduledReportDialog (schedule, recipients, PDF options; no query fields), a canvas-PDF branch on the report export page (CanvasPdfReportExport), and canvas support on the report open/metadata pages.
  • Tests: parser validation cases, a reconciler transitive-access test (TestReportCanvasResolveTransitiveAccess), and unit tests for the report form utils.

Adds scheduled PDF exports for canvas dashboards, reusing the Report
resource end-to-end. A canvas PDF report has export format 'pdf', a
'canvas' annotation, and no query; the reconciler emails the usual
link-only report email, and the export page renders the canvas in the
recipient's browser (via magic token) and generates the PDF with the
existing client-side pipeline. Canvas filter/time state captured at
scheduling time is stored in web_open_state and replayed on the export
and open pages.
@nishantmonu51
nishantmonu51 requested a review from pjain1 July 29, 2026 15:56
Shows the canvas filter bar (time range, comparison, and filter pills) in the
canvas variant of the scheduled report dialog, matching the filters section in
explore scheduled reports. The bar is backed by the live canvas store, which
edits the page URL: the dialog snapshots the URL when it opens (replaying the
report's stored state in edit mode), captures the edited state into
web_open_state on submit, and restores the original URL when it closes so the
dashboard behind the dialog is left unchanged.
@nishantmonu51 nishantmonu51 changed the title feat: scheduled canvas PDF export via email link feat: scheduled canvas PDF export Jul 30, 2026
@nishantmonu51

Copy link
Copy Markdown
Collaborator Author

@codex: review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e0673f3588

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread admin/server/reports.go
Comment thread runtime/reconcilers/report.go
Comment thread runtime/reconcilers/report.go
Comment thread proto/rill/admin/v1/api.proto Outdated
Comment thread runtime/reconcilers/canvas.go Outdated
Comment thread runtime/reconcilers/report.go Outdated
@pjain1

pjain1 commented Jul 30, 2026

Copy link
Copy Markdown
Member

Manual end-to-end verification on a cloud stack (email delivery, tokened download in incognito, recipient mode) is still pending.

I believe this is done?

@nishantmonu51

Copy link
Copy Markdown
Collaborator Author

Manual end-to-end verification on a cloud stack (email delivery, tokened download in incognito, recipient mode) is still pending.

I believe this is done?

Yes, I tested it manually.

- Bake the canvas's filters into the report's security rules: the dialog
  captures per-metrics-view filter expressions (metrics_view_filters in
  ReportOptions), the admin server stores them in a report annotation, and
  the report reconciler converts them to row-filter rules so magic-token
  recipients cannot query data beyond the report's filters.
- Remove the pdf_include_filters/pdf_all_tabs proto fields and annotations;
  the PDF options are now stored as extra params in web_open_state, which
  is only read by the UI.
- GenerateReportYAML: emit canvas/explore annotations and canvas state so
  generated canvas PDF report YAML passes parser validation.
- Report/canvas reconcilers: use the controller directly instead of
  re-fetching it; propagate canvas lookup errors other than not-found.
- Rename the share popover button to "Create scheduled export..." since
  scheduled exports deliver to Slack as well as email.
Comment thread web-common/src/features/scheduled-reports/ScheduledReportDialog.svelte Outdated
…ion time

- The canvas filter bar in the scheduled report dialog is now read-only
  (report forms must not change the underlying dashboard view); editing
  returns once unified filters support in-memory editing.
- Anchor relative time ranges at the report's execution time on the export
  page: TimeManager gains an executionTimeStore that TimeState passes
  through deriveInterval to MetricsViewTimeRanges' execution_time, which
  replaces now/latest/watermark server-side. This keeps the rendered data
  consistent with the scheduled run for every range format, across all of
  the canvas's metrics views.
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.

3 participants